Skip to content

Commit b3a43ae

Browse files
committed
bump to golang 1.24
* bump in go.mod (base and api) * bump go-toolset in Dockerfile * bump in github jobs ('.github/workflows') * Bump the golangci-lint version in the .pre-commit-config.yaml to v2.4.0 * Bump build_root_image in .ci-operator.yaml to ci-build-root-golang-1.24-sdk-1.31 Also fixes golangci-lint reported issues for new v2.4.0 version. Jira: OSPRH-12935 Signed-off-by: Martin Schuppert <mschuppert@redhat.com> Co-authored-by: Claude (Anthropic) claude@anthropic.com
1 parent 4aab51f commit b3a43ae

27 files changed

Lines changed: 104 additions & 73 deletions

.ci-operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build_root_image:
22
name: tools
33
namespace: openstack-k8s-operators
4-
tag: ci-build-root-golang-1.21-sdk-1.31
4+
tag: ci-build-root-golang-1.24-sdk-1.31

.github/workflows/build-cinder-operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/reusable-build-operator.yaml@main
1616
with:
1717
operator_name: cinder
18-
go_version: 1.21.x
18+
go_version: 1.24.x
1919
operator_sdk_version: 1.31.0
2020
secrets:
2121
IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }}

.github/workflows/force-bump-pr-manual.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ jobs:
99
with:
1010
operator_name: cinder
1111
branch_name: ${{ github.ref_name }}
12+
custom_image: quay.io/openstack-k8s-operators/openstack-k8s-operators-ci-build-tools:golang-1.24-sdk-1.31
1213
secrets:
1314
FORCE_BUMP_PULL_REQUEST_PAT: ${{ secrets.FORCE_BUMP_PULL_REQUEST_PAT }}

.github/workflows/force-bump-pr-scheduled.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ jobs:
1010
uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/force-bump-branches.yaml@main
1111
with:
1212
operator_name: cinder
13+
custom_image: quay.io/openstack-k8s-operators/openstack-k8s-operators-ci-build-tools:golang-1.24-sdk-1.31
1314
secrets:
1415
FORCE_BUMP_PULL_REQUEST_PAT: ${{ secrets.FORCE_BUMP_PULL_REQUEST_PAT }}

.golangci.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
version: 2
2+
13
linters:
24
# Enable specific linter
35
# https://golangci-lint.run/usage/linters/#enabled-by-default
46
enable:
57
- errorlint
68
- revive
79
- ginkgolinter
8-
- gofmt
910
- govet
11+
- gosec
12+
- errname
13+
- err113
14+
15+
formatters:
16+
enable:
17+
- gofmt
18+
1019
run:
1120
timeout: 5m

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/golangci/golangci-lint
3-
rev: v1.59.1
3+
rev: v2.4.0
44
hooks:
55
- id: golangci-lint-full
66
args: ["-v"]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.21
1+
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.24
22
ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest
33

44
# Build the manager binary

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ tidy: ## Run go mod tidy on every mod file in the repo
142142
go mod tidy
143143
cd ./api && go mod tidy
144144

145+
GOLANGCI_LINT_VERSION ?= v2.4.0
145146
.PHONY: golangci-lint
146147
golangci-lint:
147148
# NOTE this will install golangci-lint in to local bin dir
148-
test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
149+
test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_LINT_VERSION)
149150
$(LOCALBIN)/golangci-lint run --fix
150151

151152
.PHONY: ginkgo
@@ -248,7 +249,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
248249
## Tool Versions
249250
KUSTOMIZE_VERSION ?= v3.8.7
250251
CONTROLLER_TOOLS_VERSION ?= v0.14.0
251-
GOTOOLCHAIN_VERSION ?= go1.21.0
252+
GOTOOLCHAIN_VERSION ?= go1.24.0
252253

253254
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
254255
.PHONY: kustomize $(KUSTOMIZE)

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/openstack-k8s-operators/cinder-operator/api
22

3-
go 1.21
3+
go 1.24
44

55
require (
66
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f

controllers/cinder_common.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package controllers implements the cinder-operator Kubernetes controllers.
1718
package controllers
1819

1920
import (
2021
"context"
22+
"errors"
2123
"fmt"
24+
"time"
25+
2226
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2327
"github.com/openstack-k8s-operators/lib-common/modules/common/secret"
2428
"k8s.io/apimachinery/pkg/types"
25-
"time"
2629

2730
"github.com/openstack-k8s-operators/cinder-operator/pkg/cinder"
2831
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
@@ -35,6 +38,14 @@ import (
3538
"sigs.k8s.io/controller-runtime/pkg/log"
3639
)
3740

41+
// Common static errors for all cinder controllers
42+
var (
43+
ErrNetworkAttachmentWaiting = errors.New("network attachment waiting")
44+
ErrNetworkAttachmentNotFound = errors.New("network-attachment-definition not found")
45+
ErrStatefulSetWaiting = errors.New("waiting for StatefulSet to start reconciling")
46+
ErrNetworkAttachmentConfig = errors.New("not all pods have interfaces with ips as configured in NetworkAttachments")
47+
)
48+
3849
type conditionUpdater interface {
3950
Set(c *condition.Condition)
4051
MarkTrue(t condition.Type, messageFormat string, messageArgs ...interface{})

0 commit comments

Comments
 (0)