diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2a26067f3..f61149fb3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - run: make rollout-operator @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - run: make test - run: make test-boringcrypto @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - run: make build-image - run: make integration @@ -42,7 +42,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - run: make build-image-boringcrypto - run: make integration @@ -53,9 +53,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - - uses: golangci/golangci-lint-action@v4 + - uses: golangci/golangci-lint-action@v6 with: - version: v1.56 + version: v1.60.1 args: --timeout=5m diff --git a/CHANGELOG.md b/CHANGELOG.md index cad5b1d0e..63a035555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * `k8s.io/apimachinery` from `v0.30.0` to `v0.30.3` * `k8s.io/client-go` from `v0.30.0` to `v0.30.3` * `sigs.k8s.io/controller-runtime` from `v0.18.1` to `v0.18.5` +* [ENHANCEMENT] Update Go to `1.23`. #168 ## v0.18.0 diff --git a/Dockerfile b/Dockerfile index 22a6a17d0..8a277965c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG BASEIMAGE -FROM golang:1.22-bookworm AS build +FROM golang:1.23-bookworm AS build ARG TARGETOS ARG TARGETARCH diff --git a/go.mod b/go.mod index 963688297..709aec321 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/grafana/rollout-operator -go 1.22.4 - -toolchain go1.22.6 +go 1.23.0 require ( github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb diff --git a/pkg/admission/prep_downscale.go b/pkg/admission/prep_downscale.go index 9026f643d..c48882e76 100644 --- a/pkg/admission/prep_downscale.go +++ b/pkg/admission/prep_downscale.go @@ -138,6 +138,7 @@ func prepareDownscale(ctx context.Context, l log.Logger, ar v1.AdmissionReview, msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v was downscaled at %v and is labelled to wait %s between zone downscales", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.lastDownscaleTime, foundSts.waitTime) level.Warn(logger).Log("msg", msg, "err", err) + //nolint:govet return deny(msg) } foundSts, err = findStatefulSetWithNonUpdatedReplicas(ctx, api, ar.Request.Namespace, stsList, ar.Request.Name) @@ -145,12 +146,14 @@ func prepareDownscale(ctx context.Context, l log.Logger, ar v1.AdmissionReview, msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because an error occurred while checking whether StatefulSets have non-updated replicas", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas) level.Warn(logger).Log("msg", msg, "err", err) + //nolint:govet return deny(msg) } if foundSts != nil { msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v has %d non-updated replicas and %d non-ready replicas", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.nonUpdatedReplicas, foundSts.nonReadyReplicas) level.Warn(logger).Log("msg", msg) + //nolint:govet return deny(msg) } } diff --git a/pkg/admission/zone_tracker.go b/pkg/admission/zone_tracker.go index 23f688e0e..aaaaf6d1f 100644 --- a/pkg/admission/zone_tracker.go +++ b/pkg/admission/zone_tracker.go @@ -126,6 +126,7 @@ func (zt *zoneTracker) prepareDownscale(ctx context.Context, l log.Logger, ar v1 msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v was downscaled at %v and is labelled to wait %s between zone downscales", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.lastDownscaleTime, foundSts.waitTime) level.Warn(logger).Log("msg", msg, "err", err) + //nolint:govet return deny(msg) } foundSts, err = findStatefulSetWithNonUpdatedReplicas(ctx, api, ar.Request.Namespace, stsList, ar.Request.Name) @@ -133,12 +134,14 @@ func (zt *zoneTracker) prepareDownscale(ctx context.Context, l log.Logger, ar v1 msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because an error occurred while checking whether StatefulSets have non-updated replicas", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas) level.Warn(logger).Log("msg", msg, "err", err) + //nolint:govet return deny(msg) } if foundSts != nil { msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v has %d non-updated replicas and %d non-ready replicas", ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.nonUpdatedReplicas, foundSts.nonReadyReplicas) level.Warn(logger).Log("msg", msg) + //nolint:govet return deny(msg) } }