Skip to content

Commit 03bf512

Browse files
committed
Upgrade to Operator SDK 1.41.1
This commit upgrades the mariadb-operator to use Operator SDK version 1.41.1, with the following major changes: Project Structure: - Move pkg/ packages to internal/ following Go best practices - Move controllers/ to internal/controller/ per new operator-sdk layout - Replace main.go with cmd/main.go - Add controller and webhook test suites Configuration Updates: - Split certificate management into separate metrics and webhook certs - Add network policies for metrics and webhook traffic - Rename auth_proxy resources to metrics for clarity - Add admin RBAC roles for all CRD types - Update manager deployment configuration and patches - Modernize kustomization configurations Webhook Changes: - Add dedicated webhook implementation in internal/webhook/v1beta1/ - Remove old CRD webhook and CA injection patches - Update webhook manifests and service configuration Cleanup: - Remove obsolete config patches and overlays Dependencies: - Update go.mod and go.sum for operator-sdk 1.41.1 dependencies Jira: OSPRH-22041 Assisted-by: claude-4-sonnet Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 84780d6 commit 03bf512

194 files changed

Lines changed: 1312 additions & 832 deletions

File tree

Some content is hidden

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

.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-mariadb-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: mariadb
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: mariadb
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: mariadb
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 }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ repos:
7474
rev: e30d72fcbced0ab8a7b6d23be1dee129e2a7b849
7575
hooks:
7676
- id: kuttl-single-test-assert
77-
args: ["tests/kuttl"]
77+
args: ["test/kuttl"]

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

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

Dockerfile.rhel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ WORKDIR ${REMOTE_SOURCE_DIR}/${REMOTE_SOURCE_SUBDIR}
1717
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
1818

1919
# Build
20-
RUN CGO_ENABLED=0 GO111MODULE=on go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/usr/local/bin/manager main.go
20+
RUN CGO_ENABLED=0 GO111MODULE=on go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/usr/local/bin/manager cmd/main.go
2121
RUN CGO_ENABLED=0 GO111MODULE=on go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/usr/local/bin/csv-generator tools/csv-generator.go
2222

2323
RUN cp tools/user_setup ${DEST_ROOT}/usr/local/bin/

Makefile

Lines changed: 4 additions & 4 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/mariadb-operator:latest
@@ -142,7 +142,7 @@ test: manifests generate gowork fmt vet envtest ginkgo ## Run tests.
142142

143143
.PHONY: build
144144
build: generate fmt vet ## Build manager binary.
145-
go build -o bin/manager main.go
145+
go build -o bin/manager cmd/main.go
146146

147147
.PHONY: run
148148
run: export METRICS_PORT?=8080
@@ -152,7 +152,7 @@ run: export OPERATOR_TEMPLATES=./templates/
152152
run: export ENABLE_WEBHOOKS?=false
153153
run: manifests generate fmt vet ## Run a controller from your host.
154154
/bin/bash hack/clean_local_webhook.sh
155-
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
155+
go run ./cmd/main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
156156

157157
.PHONY: docker-build
158158
docker-build: test ## Build docker image with the manager.
@@ -216,7 +216,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
216216
GINKGO ?= $(LOCALBIN)/ginkgo
217217

218218
## Tool Versions
219-
KUSTOMIZE_VERSION ?= v3.8.7
219+
KUSTOMIZE_VERSION ?= v5.6.0
220220
CONTROLLER_TOOLS_VERSION ?= v0.18.0
221221
GOTOOLCHAIN_VERSION ?= go1.24.0
222222

PROJECT

Lines changed: 1 addition & 1 deletion
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
plugins:
99
manifests.sdk.operatorframework.io/v2: {}
1010
scorecard.sdk.operatorframework.io/v2: {}

api/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ require (
1010
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251103072528-9eb684fef4ef
1111
k8s.io/api v0.31.13
1212
k8s.io/apimachinery v0.31.13
13-
k8s.io/client-go v0.31.13
1413
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
1514
sigs.k8s.io/controller-runtime v0.19.7
1615
)
@@ -24,7 +23,6 @@ require (
2423
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2524
github.com/fsnotify/fsnotify v1.9.0 // indirect
2625
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
27-
github.com/go-logr/zapr v1.3.0 // indirect
2826
github.com/go-openapi/jsonpointer v0.21.1 // indirect
2927
github.com/go-openapi/jsonreference v0.21.0 // indirect
3028
github.com/go-openapi/swag v0.23.1 // indirect
@@ -53,8 +51,6 @@ require (
5351
github.com/prometheus/procfs v0.16.1 // indirect
5452
github.com/spf13/pflag v1.0.7 // indirect
5553
github.com/x448/float16 v0.8.4 // indirect
56-
go.uber.org/multierr v1.11.0 // indirect
57-
go.uber.org/zap v1.27.0 // indirect
5854
go.yaml.in/yaml/v2 v2.4.2 // indirect
5955
go.yaml.in/yaml/v3 v3.0.4 // indirect
6056
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
@@ -72,6 +68,7 @@ require (
7268
gopkg.in/inf.v0 v0.9.1 // indirect
7369
gopkg.in/yaml.v3 v3.0.1 // indirect
7470
k8s.io/apiextensions-apiserver v0.33.2 // indirect
71+
k8s.io/client-go v0.31.13 // indirect
7572
k8s.io/klog/v2 v2.130.1 // indirect
7673
k8s.io/kube-openapi v0.0.0-20250902184714-7fc278399c7f // indirect
7774
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect

0 commit comments

Comments
 (0)