Skip to content

Commit df0fce3

Browse files
committed
Upgrade to operator-sdk 1.41.1
Rescaffold the barbican-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 - Add missing APIs to PROJECT - 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-21925 Depends-On: openstack-k8s-operators/openstack-operator#1683
1 parent d5429ec commit df0fce3

File tree

131 files changed

+1403
-934
lines changed

Some content is hidden

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

131 files changed

+1403
-934
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-barbican-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: barbican
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: barbican
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: barbican
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/barbican-operator:latest
@@ -125,13 +125,13 @@ PROC_CMD = --procs ${PROCS}
125125
test: manifests generate fmt vet envtest ginkgo ## Run tests.
126126
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" \
127127
OPERATOR_TEMPLATES="$(shell pwd)/templates" \
128-
$(GINKGO) --trace --cover --coverpkg=../../pkg/barbican,../../controllers,../../api/v1beta1 --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./tests/...
128+
$(GINKGO) --trace --cover --coverpkg=../../internal/barbican,../../internal/controller,../../api/v1beta1 --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./test/...
129129

130130
##@ Build
131131

132132
.PHONY: build
133133
build: manifests 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 ENABLE_WEBHOOKS?=false
141141
run: export OPERATOR_TEMPLATES=./templates/
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: 14 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: {}
@@ -38,4 +42,13 @@ resources:
3842
kind: BarbicanWorker
3943
path: github.com/openstack-k8s-operators/barbican-operator/api/v1beta1
4044
version: v1beta1
45+
- api:
46+
crdVersion: v1
47+
namespaced: true
48+
controller: true
49+
domain: openstack.org
50+
group: barbican
51+
kind: BarbicanKeystoneListener
52+
path: github.com/openstack-k8s-operators/barbican-operator/api/v1beta1
53+
version: v1beta1
4154
version: "3"

api/bases/barbican.openstack.org_barbicanapis.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ spec:
9898
type: boolean
9999
enabledSecretStores:
100100
items:
101-
description: This SecretStore type is used by the EnabledSecretStores
101+
description: SecretStore type is used by the EnabledSecretStores
102102
variable inside the specification.
103103
enum:
104104
- simple_crypto
@@ -110,8 +110,8 @@ spec:
110110
x-kubernetes-list-type: set
111111
globalDefaultSecretStore:
112112
default: simple_crypto
113-
description: This SecretStore type is used by the EnabledSecretStores
114-
variable inside the specification.
113+
description: SecretStore type is used by the EnabledSecretStores variable
114+
inside the specification.
115115
enum:
116116
- simple_crypto
117117
- pkcs11

api/bases/barbican.openstack.org_barbicankeystonelisteners.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ spec:
9090
type: object
9191
enabledSecretStores:
9292
items:
93-
description: This SecretStore type is used by the EnabledSecretStores
93+
description: SecretStore type is used by the EnabledSecretStores
9494
variable inside the specification.
9595
enum:
9696
- simple_crypto
@@ -102,8 +102,8 @@ spec:
102102
x-kubernetes-list-type: set
103103
globalDefaultSecretStore:
104104
default: simple_crypto
105-
description: This SecretStore type is used by the EnabledSecretStores
106-
variable inside the specification.
105+
description: SecretStore type is used by the EnabledSecretStores variable
106+
inside the specification.
107107
enum:
108108
- simple_crypto
109109
- pkcs11

api/bases/barbican.openstack.org_barbicans.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ spec:
670670
type: object
671671
enabledSecretStores:
672672
items:
673-
description: This SecretStore type is used by the EnabledSecretStores
673+
description: SecretStore type is used by the EnabledSecretStores
674674
variable inside the specification.
675675
enum:
676676
- simple_crypto
@@ -682,8 +682,8 @@ spec:
682682
x-kubernetes-list-type: set
683683
globalDefaultSecretStore:
684684
default: simple_crypto
685-
description: This SecretStore type is used by the EnabledSecretStores
686-
variable inside the specification.
685+
description: SecretStore type is used by the EnabledSecretStores variable
686+
inside the specification.
687687
enum:
688688
- simple_crypto
689689
- pkcs11

0 commit comments

Comments
 (0)