Skip to content

Commit 5298867

Browse files
committed
Upgrade infra-operator to operator-sdk 1.41.1
Rescaffold the infra-operator to operator-sdk 1.41.1, which includes: - Reorganize project structure (pkg/ -> internal/) - Move webhook implementations to internal/webhook/v1beta1/ - Add new cmd/main.go entrypoint with updated controller initialization - Update RBAC, certmanager, and prometheus configurations - Enhance network policies for metrics and webhook traffic - Set infra as defaulting resource in PROJECT file - Remove auto-generated test suite scaffolding - Update build workflow and Dockerfile to version 1.41.1 This upgrade modernizes the operator structure and aligns with the latest operator-sdk best practices. Jira: OSPRH-22040
1 parent 1ff4069 commit 5298867

File tree

225 files changed

+2842
-2114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+2842
-2114
lines changed

.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.24-sdk-1.31
4+
tag: ci-build-root-golang-1.24-sdk-1.41.1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
operator_name: infra
1818
go_version: 1.24.x
19-
operator_sdk_version: 1.31.0
19+
operator_sdk_version: 1.41.1
2020
secrets:
2121
IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }}
2222
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
with:
1010
operator_name: infra
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
12+
custom_image: quay.io/openstack-k8s-operators/openstack-k8s-operators-ci-build-tools:golang-1.24-sdk-1.41.1
1313
secrets:
1414
FORCE_BUMP_PULL_REQUEST_PAT: ${{ secrets.FORCE_BUMP_PULL_REQUEST_PAT }}

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

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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
2626
RUN if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
2727

2828
# Build manager
29-
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; env ${GO_BUILD_EXTRA_ENV_ARGS} go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
29+
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; env ${GO_BUILD_EXTRA_ENV_ARGS} go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager cmd/main.go
3030

3131
RUN cp -r templates ${DEST_ROOT}/templates
3232

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ endif
4848

4949
# Set the Operator SDK version to use. By default, what is installed on the system is used.
5050
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51-
OPERATOR_SDK_VERSION ?= v1.31.0
51+
OPERATOR_SDK_VERSION ?= v1.41.1
5252

5353
# Image URL to use all building/pushing image targets
5454
DEFAULT_IMG ?= quay.io/openstack-k8s-operators/infra-operator:latest
@@ -125,13 +125,13 @@ PROC_CMD = --procs ${PROCS}
125125
test: manifests generate gowork fmt vet envtest ginkgo ## Run tests.
126126
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) -v debug --bin-dir $(LOCALBIN) use $(ENVTEST_K8S_VERSION) -p path)" \
127127
OPERATOR_TEMPLATES="$(PWD)/templates" \
128-
$(GINKGO) --trace --cover --coverpkg=./pkg/...,./controllers/...,./apis/network/v1beta1/...,./apis/rabbitmq/v1beta1/... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./tests/... ./apis/network/... ./apis/rabbitmq/...
128+
$(GINKGO) --trace --cover --coverpkg=./pkg/...,./internal/...,./apis/network/v1beta1/...,./apis/rabbitmq/v1beta1/... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./tests/... ./apis/network/... ./apis/rabbitmq/...
129129

130130
##@ Build
131131

132132
.PHONY: build
133133
build: generate fmt vet ## Build manager binary.
134-
go build -o bin/manager main.go
134+
go build -o bin/manager cmd/main.go
135135

136136
.PHONY: run
137137
run: export METRICS_PORT?=8080
@@ -141,7 +141,7 @@ run: export OPERATOR_TEMPLATES=./templates
141141
run: export ENABLE_WEBHOOKS?=false
142142
run: manifests generate fmt vet ## Run a controller from your host.
143143
/bin/bash hack/clean_local_webhook.sh
144-
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
144+
go run ./cmd/main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
145145

146146
# If you wish built the manager image targeting other platforms you can use the --platform flag.
147147
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
@@ -208,7 +208,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
208208
GINKGO ?= $(LOCALBIN)/ginkgo
209209

210210
## Tool Versions
211-
KUSTOMIZE_VERSION ?= v3.8.7
211+
KUSTOMIZE_VERSION ?= v5.6.0
212212
CONTROLLER_TOOLS_VERSION ?= v0.18.0
213213
GOTOOLCHAIN_VERSION ?= go1.24.0
214214

PROJECT

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# More info: https://book.kubebuilder.io/reference/project-config.html
55
domain: openstack.org
66
layout:
7-
- go.kubebuilder.io/v3
7+
- go.kubebuilder.io/v4
88
multigroup: true
99
plugins:
1010
manifests.sdk.operatorframework.io/v2: {}
@@ -55,7 +55,6 @@ resources:
5555
group: redis
5656
kind: Redis
5757
path: github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1
58-
plural: redises
5958
version: v1beta1
6059
webhooks:
6160
defaulting: true
@@ -86,6 +85,7 @@ resources:
8685
- api:
8786
crdVersion: v1
8887
namespaced: true
88+
controller: true
8989
domain: openstack.org
9090
group: network
9191
kind: NetConfig
@@ -98,6 +98,7 @@ resources:
9898
- api:
9999
crdVersion: v1
100100
namespaced: true
101+
controller: true
101102
domain: openstack.org
102103
group: network
103104
kind: Reservation
@@ -120,6 +121,15 @@ resources:
120121
defaulting: true
121122
validation: true
122123
webhookVersion: v1
124+
- api:
125+
crdVersion: v1
126+
namespaced: true
127+
controller: true
128+
domain: openstack.org
129+
group: topology
130+
kind: Topology
131+
path: github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1
132+
version: v1beta1
123133
- api:
124134
crdVersion: v1
125135
namespaced: true

apis/bases/memcached.openstack.org_memcacheds.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ spec:
142142
bundle file
143143
type: string
144144
mtls:
145+
description: MTLSSection contains mutual TLS configuration
145146
properties:
146147
authCertSecret:
147148
description: Name of the secret containing the client cert

apis/bases/topology.openstack.org_topologies.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,9 @@ spec:
11401140
type: object
11411141
type: array
11421142
type: object
1143+
status:
1144+
description: TopologyStatus defines the observed state of Topology
1145+
type: object
11431146
type: object
11441147
served: true
11451148
storage: true

apis/go.mod

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,32 @@ go 1.24.4
44

55
require (
66
github.com/go-logr/logr v1.4.3
7-
github.com/onsi/ginkgo/v2 v2.27.2
87
github.com/onsi/gomega v1.38.2
98
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251103072528-9eb684fef4ef
10-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20251103072528-9eb684fef4ef
119
github.com/rabbitmq/cluster-operator/v2 v2.16.0
1210
k8s.io/api v0.31.13
1311
k8s.io/apimachinery v0.31.13
14-
k8s.io/client-go v0.31.13
1512
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
1613
sigs.k8s.io/controller-runtime v0.19.7
1714
)
1815

1916
require (
20-
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2117
github.com/beorn7/perks v1.0.1 // indirect
2218
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2319
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2420
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
2521
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2622
github.com/fsnotify/fsnotify v1.9.0 // indirect
2723
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
28-
github.com/go-logr/zapr v1.3.0 // indirect
2924
github.com/go-openapi/jsonpointer v0.21.1 // indirect
3025
github.com/go-openapi/jsonreference v0.21.0 // indirect
3126
github.com/go-openapi/swag v0.23.1 // indirect
32-
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3327
github.com/gogo/protobuf v1.3.2 // indirect
3428
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3529
github.com/golang/protobuf v1.5.4 // indirect
3630
github.com/google/gnostic-models v0.7.0 // indirect
3731
github.com/google/go-cmp v0.7.0 // indirect
3832
github.com/google/gofuzz v1.2.0 // indirect
39-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
4033
github.com/google/uuid v1.6.0 // indirect
4134
github.com/imdario/mergo v0.3.16 // indirect
4235
github.com/josharian/intern v1.0.0 // indirect
@@ -52,27 +45,24 @@ require (
5245
github.com/prometheus/client_model v0.6.2 // indirect
5346
github.com/prometheus/common v0.65.0 // indirect
5447
github.com/prometheus/procfs v0.16.1 // indirect
48+
github.com/rogpeppe/go-internal v1.13.1 // indirect
5549
github.com/spf13/pflag v1.0.7 // indirect
5650
github.com/x448/float16 v0.8.4 // indirect
57-
go.uber.org/multierr v1.11.0 // indirect
58-
go.uber.org/zap v1.27.0 // indirect
5951
go.yaml.in/yaml/v2 v2.4.2 // indirect
6052
go.yaml.in/yaml/v3 v3.0.4 // indirect
6153
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
62-
golang.org/x/mod v0.27.0 // indirect
6354
golang.org/x/net v0.43.0 // indirect
6455
golang.org/x/oauth2 v0.30.0 // indirect
65-
golang.org/x/sync v0.16.0 // indirect
6656
golang.org/x/sys v0.35.0 // indirect
6757
golang.org/x/term v0.34.0 // indirect
6858
golang.org/x/text v0.28.0 // indirect
6959
golang.org/x/time v0.12.0 // indirect
70-
golang.org/x/tools v0.36.0 // indirect
7160
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
7261
google.golang.org/protobuf v1.36.7 // indirect
7362
gopkg.in/inf.v0 v0.9.1 // indirect
7463
gopkg.in/yaml.v3 v3.0.1 // indirect
7564
k8s.io/apiextensions-apiserver v0.33.2 // indirect
65+
k8s.io/client-go v0.31.13 // indirect
7666
k8s.io/klog/v2 v2.130.1 // indirect
7767
k8s.io/kube-openapi v0.0.0-20250902184714-7fc278399c7f // indirect
7868
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect

0 commit comments

Comments
 (0)