Skip to content

Commit

Permalink
Upgrade Go to version 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Nov 17, 2023
1 parent fd7f5ab commit a8c82a8
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 54 deletions.
12 changes: 6 additions & 6 deletions .buildkite/test-sample-yamls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,15 +14,15 @@

- 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
- source .venv/bin/activate && BUILDKITE_ENV=true RAY_IMAGE=rayproject/ray:2.7.0 OPERATOR_IMAGE=kuberay/operator:v1.0.0 python3 tests/test_sample_raycluster_yamls.py

- 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
Expand All @@ -34,15 +34,15 @@

- 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
- source .venv/bin/activate && BUILDKITE_ENV=true RAY_IMAGE=rayproject/ray:2.7.0 OPERATOR_IMAGE=kuberay/operator:v1.0.0 python3 tests/test_sample_rayjob_yamls.py

- 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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/consistency-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/image-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apiserver/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+ | |
Expand Down
2 changes: 1 addition & 1 deletion apiserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions apiserver/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion proto/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion proto/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 14 additions & 14 deletions ray-operator/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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"
```

Expand Down Expand Up @@ -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/[email protected]
Expand All @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions ray-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ray-operator/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit a8c82a8

Please sign in to comment.