From 1c266410960e35fd11f7cbc9f8fdd05aa3a531f7 Mon Sep 17 00:00:00 2001 From: Antonin Stefanutti Date: Wed, 15 Nov 2023 18:57:06 +0100 Subject: [PATCH] Upgrade Go to version 1.20 --- .buildkite/test-sample-yamls.yml | 12 +++++----- .github/workflows/consistency-check.yaml | 10 ++++----- .github/workflows/e2e-tests.yaml | 4 ++-- .github/workflows/image-release.yaml | 12 +++++----- .github/workflows/test-job.yaml | 18 +++++++-------- apiserver/DEVELOPMENT.md | 4 ++-- apiserver/Dockerfile | 2 +- apiserver/cmd/main.go | 5 +++-- apiserver/go.mod | 2 +- cli/go.mod | 2 +- proto/Dockerfile | 2 +- proto/go.mod | 2 +- ray-operator/DEVELOPMENT.md | 28 ++++++++++++------------ ray-operator/Dockerfile | 4 ++-- ray-operator/go.mod | 2 +- 15 files changed, 55 insertions(+), 54 deletions(-) diff --git a/.buildkite/test-sample-yamls.yml b/.buildkite/test-sample-yamls.yml index b3447de3d84..ba79597cede 100644 --- a/.buildkite/test-sample-yamls.yml +++ b/.buildkite/test-sample-yamls.yml @@ -2,7 +2,7 @@ - label: 'Test RayCluster Sample YAMLs (nightly operator)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Build nightly KubeRay operator image @@ -14,7 +14,7 @@ - label: 'Test RayCluster Sample YAMLs (latest release)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Use KubeRay operator image from the latest release @@ -22,7 +22,7 @@ - label: 'Test RayJob Sample YAMLs (nightly operator)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Build nightly KubeRay operator image @@ -34,7 +34,7 @@ - label: 'Test RayJob Sample YAMLs (latest release)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Use KubeRay operator image from the latest release @@ -42,7 +42,7 @@ - label: 'Test RayService Sample YAMLs (nightly operator)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Build nightly KubeRay operator image @@ -54,7 +54,7 @@ - label: 'Test RayService Sample YAMLs (latest release)' instance_size: large - image: golang:1.19 + image: golang:1.20 commands: - ./.buildkite/setup-env.sh # Use KubeRay operator image from the latest release diff --git a/.github/workflows/consistency-check.yaml b/.github/workflows/consistency-check.yaml index e342a921845..27d161d53b5 100644 --- a/.github/workflows/consistency-check.yaml +++ b/.github/workflows/consistency-check.yaml @@ -17,11 +17,11 @@ jobs: with: fetch-depth: 0 - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: # Use the same go version with build job - go-version: '1.19' + go-version: '1.20' - name: Check golang version working-directory: ./ray-operator @@ -44,11 +44,11 @@ jobs: with: fetch-depth: 0 - - name: Set up Go 1.19.x + - name: Set up Go uses: actions/setup-go@v2 with: # Use the same go version with build job - go-version: '1.19' + go-version: '1.20' - name: Update CRD/RBAC YAML files working-directory: ./ray-operator diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml index 3b927775e86..84f151cf694 100644 --- a/.github/workflows/e2e-tests.yaml +++ b/.github/workflows/e2e-tests.yaml @@ -39,10 +39,10 @@ jobs: with: submodules: recursive - - name: Set Go + - name: Set up Go uses: actions/setup-go@v3 with: - go-version: v1.19 + go-version: v1.20 - name: Set up gotestfmt uses: gotesttools/gotestfmt-action@v2 diff --git a/.github/workflows/image-release.yaml b/.github/workflows/image-release.yaml index d28bc93a457..3312ca5dc5f 100644 --- a/.github/workflows/image-release.yaml +++ b/.github/workflows/image-release.yaml @@ -18,10 +18,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: - go-version: '1.19' + go-version: '1.20' - name: Check out code into the Go module directory uses: actions/checkout@v2 @@ -90,10 +90,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: - go-version: '1.19' + go-version: '1.20' - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/.github/workflows/test-job.yaml b/.github/workflows/test-job.yaml index 2c21109bede..381f34f074a 100644 --- a/.github/workflows/test-job.yaml +++ b/.github/workflows/test-job.yaml @@ -12,11 +12,11 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: # Use the same go version with build job - go-version: '1.19' + go-version: '1.20' - name: Check out code into the Go module directory uses: actions/checkout@v2 @@ -107,10 +107,10 @@ jobs: name: Build Apiserver, CLI Binaries and Docker Images runs-on: ubuntu-latest steps: - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: - go-version: '1.19' + go-version: '1.20' - name: Check out code into the Go module directory uses: actions/checkout@v2 @@ -202,10 +202,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.19.x - uses: actions/setup-go@v2 + - name: Set up Go + uses: actions/setup-go@v3 with: - go-version: '1.19' + go-version: '1.20' - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/apiserver/DEVELOPMENT.md b/apiserver/DEVELOPMENT.md index 922571c265f..02dbd1de4a1 100644 --- a/apiserver/DEVELOPMENT.md +++ b/apiserver/DEVELOPMENT.md @@ -5,9 +5,9 @@ This guide covers the purpose, requirements, and deployment of the Kuberay API S ## Requirements | Software | Version | Link | -| :------- | :------: | ------------------------------------------------------------------: | +|:---------|:--------:|--------------------------------------------------------------------:| | kubectl | v1.18.3+ | [Download](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | -| Go | v1.19 | [Download](https://golang.org/dl/) | +| Go | v1.20 | [Download](https://golang.org/dl/) | | Docker | 19.03+ | [Download](https://docs.docker.com/install/) | | GNU Make | 3.81+ | | | curl | 7.88+ | | diff --git a/apiserver/Dockerfile b/apiserver/Dockerfile index d124a4abc1b..61402443739 100644 --- a/apiserver/Dockerfile +++ b/apiserver/Dockerfile @@ -1,5 +1,5 @@ # Build the backend service -FROM registry.access.redhat.com/ubi8/go-toolset:1.19.13 as builder +FROM registry.access.redhat.com/ubi9/go-toolset:1.20.10 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/apiserver/cmd/main.go b/apiserver/cmd/main.go index 11fbf9bd2fc..ecf3cbabfe5 100644 --- a/apiserver/cmd/main.go +++ b/apiserver/cmd/main.go @@ -15,9 +15,10 @@ import ( assetfs "github.com/elazarl/go-bindata-assetfs" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/reflection" "google.golang.org/protobuf/encoding/protojson" - klog "k8s.io/klog/v2" + "k8s.io/klog/v2" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" @@ -187,7 +188,7 @@ func serveSwaggerUI(mux *http.ServeMux) { func registerHttpHandlerFromEndpoint(handler RegisterHttpHandlerFromEndpoint, serviceName string, ctx context.Context, mux *runtime.ServeMux) { endpoint := "localhost" + *rpcPortFlag - opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32))} + opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32))} if err := handler(ctx, mux, endpoint, opts); err != nil { klog.Fatalf("Failed to register %v handler: %v", serviceName, err) diff --git a/apiserver/go.mod b/apiserver/go.mod index 30a22a67768..c8eb5484ed2 100644 --- a/apiserver/go.mod +++ b/apiserver/go.mod @@ -1,6 +1,6 @@ module github.com/ray-project/kuberay/apiserver -go 1.19 +go 1.20 require ( github.com/go-openapi/runtime v0.19.31 diff --git a/cli/go.mod b/cli/go.mod index c30465f71e2..f274f659505 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -1,6 +1,6 @@ module github.com/ray-project/kuberay/cli -go 1.19 +go 1.20 require ( github.com/fatih/color v1.13.0 diff --git a/proto/Dockerfile b/proto/Dockerfile index da919d82f3c..c1022b73e91 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -1,5 +1,5 @@ # Generate client code (go & json) from API protocol buffers -FROM registry.access.redhat.com/ubi8/go-toolset:1.19.13 as generator +FROM registry.access.redhat.com/ubi9/go-toolset:1.20.10 as generator ENV PROTOC_VERSION 3.17.3 ENV GOLANG_PROTOBUF_VERSION v1.5.2 diff --git a/proto/go.mod b/proto/go.mod index b1b18112f9a..17d7087e5f2 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -1,6 +1,6 @@ module github.com/ray-project/kuberay/proto -go 1.19 +go 1.20 require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 diff --git a/ray-operator/DEVELOPMENT.md b/ray-operator/DEVELOPMENT.md index 472e6614422..faa23b277f1 100644 --- a/ray-operator/DEVELOPMENT.md +++ b/ray-operator/DEVELOPMENT.md @@ -4,11 +4,11 @@ This section walks through how to build and test the operator in a running Kuber ## Requirements -software | version | link -:------------- | :---------------:| -------------: -kubectl | v1.21.0+ | [download](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -go | v1.19|[download](https://golang.org/dl/) -docker | 19.03+|[download](https://docs.docker.com/install/) +| software | version | link | +|:---------|:--------:|--------------------------------------------------------------------:| +| kubectl | v1.21.0+ | [download](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | +| go | v1.20 | [download](https://golang.org/dl/) | +| docker | 19.03+ | [download](https://docs.docker.com/install/) | Alternatively, you can use podman (version 4.5+) instead of docker. See [podman.io](https://podman.io/getting-started/installation) for installation instructions. The Makefile allows you to specify the container engine to use via the `ENGINE` variable. For example, to use podman, you can run `ENGINE=podman make docker-build`. @@ -18,14 +18,14 @@ The instructions assume you have access to a running Kubernetes cluster via `kub For local development, we recommend using [Kind](https://kind.sigs.k8s.io/) to create a Kubernetes cluster. -### Use go v1.19 +### Use go v1.20 -Currently, KubeRay uses go v1.19 for development. +Currently, KubeRay uses go v1.20 for development. ```bash -go install golang.org/dl/go1.19.12@latest -go1.19.12 download -export GOROOT=$(go1.19. env GOROOT) +go install golang.org/dl/go1.20.11@latest +go1.20.11 download +export GOROOT=$(go1.20. env GOROOT) export PATH="$GOROOT/bin:$PATH" ``` @@ -166,7 +166,7 @@ IMG=kuberay/operator:nightly make deploy KubeRay uses the gofumpt linter. -Download gofumpt version **0.5.0**. At the time of writing, v0.5.0 is the latest version compatible with go1.19. Run this command to download it: +Download gofumpt version **0.5.0**. At the time of writing, v0.5.0 is the latest version compatible with go1.20. Run this command to download it: ```bash go install mvdan.cc/gofumpt@v0.5.0 @@ -181,14 +181,14 @@ gofumpt --version # v0.5.0 (go1.19) ``` -Make sure your `go` version is still 1.19: +Make sure your `go` version is still 1.20: ```bash go version -# go version go1.19 darwin/amd64 +# go version go1.20 darwin/amd64 ``` -If your `go` version isn’t 1.19 any more, you may have installed a different `gofumpt` version (e.g. by downloading with Homebrew). If you accidentally installed `gofumpt` using Homebrew, run `brew uninstall gofumpt` and then `brew uninstall go`. Then check `brew install go@1.19`. It should be back to 1.19.x. +If your `go` version isn’t 1.20 any more, you may have installed a different `gofumpt` version (e.g. by downloading with Homebrew). If you accidentally installed `gofumpt` using Homebrew, run `brew uninstall gofumpt` and then `brew uninstall go`. Then check `brew install go@1.20`. It should be back to 1.20.x. Whenever you edit KubeRay code, run the `gofumpt` linter inside the KubeRay directory: diff --git a/ray-operator/Dockerfile b/ray-operator/Dockerfile index 33ee9077bf1..d834305599c 100644 --- a/ray-operator/Dockerfile +++ b/ray-operator/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM registry.access.redhat.com/ubi8/go-toolset:1.19.13 as builder +FROM registry.access.redhat.com/ubi9/go-toolset:1.20.10 as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -18,7 +18,7 @@ COPY controllers/ controllers/ USER root RUN CGO_ENABLED=1 GOOS=linux go build -tags strictfipsruntime -a -o manager main.go -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8 +FROM registry.access.redhat.com/ubi9/ubi-minimal:9.3 WORKDIR / COPY --from=builder /workspace/manager . USER 65532:65532 diff --git a/ray-operator/go.mod b/ray-operator/go.mod index 9af6901635e..2008ffc9976 100644 --- a/ray-operator/go.mod +++ b/ray-operator/go.mod @@ -1,6 +1,6 @@ module github.com/ray-project/kuberay/ray-operator -go 1.19 +go 1.20 require ( github.com/Masterminds/semver/v3 v3.2.0