Skip to content

Commit 25b6fbb

Browse files
committed
Upgrade to Operator SDK 1.41.1
This commit upgrades the ovn-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-22013 Assisted-by: claude-4-sonnet Signed-off-by: Martin Schuppert <[email protected]>
1 parent cc9071d commit 25b6fbb

File tree

162 files changed

+1334
-869
lines changed

Some content is hidden

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

162 files changed

+1334
-869
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-swift-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: swift
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: swift
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: swift
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
@@ -29,7 +29,7 @@ RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
2929
RUN if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
3030

3131
# Build manager
32-
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
32+
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
3333

3434
RUN cp -r templates ${DEST_ROOT}/templates
3535

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/swift-operator:latest
@@ -132,7 +132,7 @@ PROC_CMD = --procs ${PROCS}
132132

133133
.PHONY: test
134134
test: manifests generate fmt vet envtest ginkgo ## Run tests.
135-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GINKGO) --trace --cover --coverpkg=../../pkg/swift,../../pkg/swiftproxy/../../pkg/swiftring,../../swiftstorage,../../controllers,../../api/v1beta1 --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./tests/...
135+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GINKGO) --trace --cover --coverpkg=../../internal/...,../../api/v1beta1/... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./test/...
136136

137137
.PHONY: gotest
138138
gotest: test
@@ -141,7 +141,7 @@ gotest: test
141141

142142
.PHONY: build
143143
build: generate fmt vet ## Build manager binary.
144-
go build -o bin/manager main.go
144+
go build -o bin/manager cmd/main.go
145145

146146
.PHONY: run
147147
run: export METRICS_PORT?=8080
@@ -150,7 +150,7 @@ run: export PPROF_PORT?=8082
150150
run: export ENABLE_WEBHOOKS?=false
151151
run: manifests generate fmt vet ## Run a controller from your host.
152152
/bin/bash hack/clean_local_webhook.sh
153-
go run ./main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
153+
go run ./cmd/main.go -metrics-bind-address ":$(METRICS_PORT)" -health-probe-bind-address ":$(HEALTH_PORT)" -pprof-bind-address ":$(PPROF_PORT)"
154154

155155
.PHONY: docker-build
156156
docker-build: test ## Build docker image with the manager.
@@ -196,7 +196,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
196196
ENVTEST ?= $(LOCALBIN)/setup-envtest
197197

198198
## Tool Versions
199-
KUSTOMIZE_VERSION ?= v3.8.7
199+
KUSTOMIZE_VERSION ?= v5.6.0
200200
CONTROLLER_TOOLS_VERSION ?= v0.18.0
201201

202202
SETUP_ENVTEST_VERSION ?= release-0.22

PROJECT

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
15
domain: openstack.org
26
layout:
3-
- go.kubebuilder.io/v3
7+
- go.kubebuilder.io/v4
48
plugins:
59
manifests.sdk.operatorframework.io/v2: {}
610
scorecard.sdk.operatorframework.io/v2: {}

api/go.mod

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ module github.com/openstack-k8s-operators/swift-operator/api
33
go 1.24.4
44

55
require (
6-
github.com/onsi/ginkgo/v2 v2.27.2
7-
github.com/onsi/gomega v1.38.2
86
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251101153632-7b8179a60945
97
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251103072528-9eb684fef4ef
10-
k8s.io/api v0.31.13
118
k8s.io/apimachinery v0.31.13
12-
k8s.io/client-go v0.31.13
139
sigs.k8s.io/controller-runtime v0.19.7
1410
)
1511

1612
require (
17-
github.com/Masterminds/semver/v3 v3.4.0 // indirect
1813
github.com/beorn7/perks v1.0.1 // indirect
1914
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2015
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -24,18 +19,15 @@ require (
2419
github.com/fsnotify/fsnotify v1.9.0 // indirect
2520
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2621
github.com/go-logr/logr v1.4.3 // indirect
27-
github.com/go-logr/zapr v1.3.0 // indirect
2822
github.com/go-openapi/jsonpointer v0.21.1 // indirect
2923
github.com/go-openapi/jsonreference v0.21.0 // indirect
3024
github.com/go-openapi/swag v0.23.1 // indirect
31-
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3225
github.com/gogo/protobuf v1.3.2 // indirect
3326
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3427
github.com/golang/protobuf v1.5.4 // indirect
3528
github.com/google/gnostic-models v0.7.0 // indirect
3629
github.com/google/go-cmp v0.7.0 // indirect
3730
github.com/google/gofuzz v1.2.0 // indirect
38-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
3931
github.com/google/uuid v1.6.0 // indirect
4032
github.com/imdario/mergo v0.3.16 // indirect
4133
github.com/josharian/intern v1.0.0 // indirect
@@ -49,27 +41,25 @@ require (
4941
github.com/prometheus/client_model v0.6.2 // indirect
5042
github.com/prometheus/common v0.65.0 // indirect
5143
github.com/prometheus/procfs v0.16.1 // indirect
44+
github.com/rogpeppe/go-internal v1.13.1 // indirect
5245
github.com/spf13/pflag v1.0.7 // indirect
5346
github.com/x448/float16 v0.8.4 // indirect
54-
go.uber.org/multierr v1.11.0 // indirect
55-
go.uber.org/zap v1.27.0 // indirect
5647
go.yaml.in/yaml/v2 v2.4.2 // indirect
5748
go.yaml.in/yaml/v3 v3.0.4 // indirect
5849
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
59-
golang.org/x/mod v0.27.0 // indirect
6050
golang.org/x/net v0.43.0 // indirect
6151
golang.org/x/oauth2 v0.30.0 // indirect
62-
golang.org/x/sync v0.16.0 // indirect
6352
golang.org/x/sys v0.35.0 // indirect
6453
golang.org/x/term v0.34.0 // indirect
6554
golang.org/x/text v0.28.0 // indirect
6655
golang.org/x/time v0.12.0 // indirect
67-
golang.org/x/tools v0.36.0 // indirect
6856
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
6957
google.golang.org/protobuf v1.36.7 // indirect
7058
gopkg.in/inf.v0 v0.9.1 // indirect
7159
gopkg.in/yaml.v3 v3.0.1 // indirect
60+
k8s.io/api v0.31.13 // indirect
7261
k8s.io/apiextensions-apiserver v0.33.2 // indirect
62+
k8s.io/client-go v0.31.13 // indirect
7363
k8s.io/klog/v2 v2.130.1 // indirect
7464
k8s.io/kube-openapi v0.0.0-20250902184714-7fc278399c7f // indirect
7565
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // indirect

api/go.sum

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
1818
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
1919
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
2020
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
21-
github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs=
22-
github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo=
23-
github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M=
24-
github.com/gkampitakis/go-diff v1.3.2/go.mod h1:LLgOrpqleQe26cte8s36HTWcTmMEur6OPYerdAAS9tk=
25-
github.com/gkampitakis/go-snaps v0.5.15 h1:amyJrvM1D33cPHwVrjo9jQxX8g/7E2wYdZ+01KS3zGE=
26-
github.com/gkampitakis/go-snaps v0.5.15/go.mod h1:HNpx/9GoKisdhw9AFOBT1N7DBs9DiHo/hGheFGBZ+mc=
2721
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
2822
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
2923
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
@@ -36,8 +30,6 @@ github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZ
3630
github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0=
3731
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
3832
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
39-
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
40-
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
4133
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
4234
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
4335
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
@@ -60,8 +52,6 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
6052
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
6153
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
6254
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
63-
github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE=
64-
github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung=
6555
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
6656
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
6757
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
@@ -76,10 +66,6 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
7666
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
7767
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
7868
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
79-
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
80-
github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg=
81-
github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE=
82-
github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A=
8369
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
8470
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
8571
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -117,14 +103,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
117103
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
118104
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
119105
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
120-
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
121-
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
122-
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
123-
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
124-
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
125-
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
126-
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
127-
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
128106
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
129107
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
130108
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

api/v1beta1/swift_webhook.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ package v1beta1
1919
import (
2020
"fmt"
2121

22-
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2322
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
23+
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2424
apierrors "k8s.io/apimachinery/pkg/api/errors"
2525
"k8s.io/apimachinery/pkg/runtime"
2626
"k8s.io/apimachinery/pkg/runtime/schema"
2727
"k8s.io/apimachinery/pkg/util/validation/field"
28-
ctrl "sigs.k8s.io/controller-runtime"
2928
logf "sigs.k8s.io/controller-runtime/pkg/log"
3029
"sigs.k8s.io/controller-runtime/pkg/webhook"
3130
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
@@ -37,7 +36,7 @@ type SwiftDefaults struct {
3736
ContainerContainerImageURL string
3837
ObjectContainerImageURL string
3938
ProxyContainerImageURL string
40-
ProxyAPITimeout int
39+
ProxyAPITimeout int
4140
}
4241

4342
var swiftDefaults SwiftDefaults
@@ -50,16 +49,6 @@ func SetupSwiftDefaults(defaults SwiftDefaults) {
5049
swiftlog.Info("Swift defaults initialized", "defaults", defaults)
5150
}
5251

53-
func (r *Swift) SetupWebhookWithManager(mgr ctrl.Manager) error {
54-
return ctrl.NewWebhookManagedBy(mgr).
55-
For(r).
56-
Complete()
57-
}
58-
59-
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
60-
61-
//+kubebuilder:webhook:path=/mutate-swift-openstack-org-v1beta1-swift,mutating=true,failurePolicy=fail,sideEffects=None,groups=swift.openstack.org,resources=swifts,verbs=create;update,versions=v1beta1,name=mswift.kb.io,admissionReviewVersions=v1
62-
6352
var _ webhook.Defaulter = &Swift{}
6453

6554
// Default implements webhook.Defaulter so a webhook will be registered for the type
@@ -102,19 +91,16 @@ func (spec *SwiftSpec) Default() {
10291
spec.SwiftProxy.ContainerImageProxy = swiftDefaults.ProxyContainerImageURL
10392
}
10493

105-
if spec.SwiftProxy.APITimeout == 0 {
106-
spec.SwiftProxy.APITimeout = swiftDefaults.ProxyAPITimeout
107-
}
94+
if spec.SwiftProxy.APITimeout == 0 {
95+
spec.SwiftProxy.APITimeout = swiftDefaults.ProxyAPITimeout
96+
}
10897
}
10998

11099
// Default - set defaults for this Swift core spec (this version is used by OpenStackControlplane webhooks)
111100
func (spec *SwiftSpecCore) Default() {
112101
// nothing here yet
113102
}
114103

115-
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
116-
//+kubebuilder:webhook:path=/validate-swift-openstack-org-v1beta1-swift,mutating=false,failurePolicy=fail,sideEffects=None,groups=swift.openstack.org,resources=swifts,verbs=create;update,versions=v1beta1,name=vswift.kb.io,admissionReviewVersions=v1
117-
118104
var _ webhook.Validator = &Swift{}
119105

120106
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type

0 commit comments

Comments
 (0)