5050
5151# Set the Operator SDK version to use. By default, what is installed on the system is used.
5252# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
53- OPERATOR_SDK_VERSION ?= v1.31.0
53+ OPERATOR_SDK_VERSION ?= v1.41.1
5454
5555# Image URL to use all building/pushing image targets
5656DEFAULT_IMG ?= quay.io/openstack-k8s-operators/openstack-operator:latest
@@ -139,9 +139,9 @@ help: ## Display this help.
139139manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
140140 mkdir -p config/operator/rbac && \
141141 $(CONTROLLER_GEN ) crd$(CRDDESC_OVERRIDE ) output:crd:artifacts:config=config/crd/bases webhook paths=" ./..." && \
142- $(CONTROLLER_GEN ) rbac:roleName=manager-role paths=" {./apis /client/...,./apis /core/...,./apis /dataplane/...,./controllers/ client/...,./controllers/ core/...,./controllers/ dataplane/...,./pkg /...}" output:dir=config/rbac && \
143- $(CONTROLLER_GEN ) rbac:roleName=operator-role paths=" ./controllers/ operator/..." paths=" ./apis /operator/..." output:dir=config/operator/rbac && \
144- rm -f apis /bases/* && cp -a config/crd/bases apis /
142+ $(CONTROLLER_GEN ) rbac:roleName=manager-role paths=" {./api /client/...,./api /core/...,./api /dataplane/...,./internal/controller/ client/...,./internal/controller/ core/...,./internal/controller/ dataplane/...,./internal /...}" output:dir=config/rbac && \
143+ $(CONTROLLER_GEN ) rbac:roleName=operator-role paths=" ./internal/controller/ operator/..." paths=" ./api /operator/..." output:dir=config/operator/rbac && \
144+ rm -f api /bases/* && cp -a config/crd/bases api /
145145
146146.PHONY : generate
147147generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -171,22 +171,22 @@ fmt: ## Run go fmt against code.
171171.PHONY : vet
172172vet : gowork # # Run go vet against code.
173173 go vet ./...
174- go vet ./apis /...
174+ go vet ./api /...
175175
176176BRANCH ?= main
177177.PHONY : force-bump
178178force-bump : # # Force bump after tagging
179179 for dep in $$ (cat go.mod | grep openstack-k8s-operators | grep -vE -- ' indirect|openstack-operator|^replace' | awk ' {print $$1}' ); do \
180180 go get $$ dep@$(BRANCH ) ; \
181181 done
182- for dep in $$ (cat apis /go.mod | grep openstack-k8s-operators | grep -vE -- ' indirect|openstack-operator|^replace' | awk ' {print $$1}' ); do \
183- cd ./apis && go get $$ dep@$(BRANCH ) && cd .. ; \
182+ for dep in $$ (cat api /go.mod | grep openstack-k8s-operators | grep -vE -- ' indirect|openstack-operator|^replace' | awk ' {print $$1}' ); do \
183+ cd ./api && go get $$ dep@$(BRANCH ) && cd .. ; \
184184 done
185185
186186.PHONY : tidy
187187tidy : # # Run go mod tidy on every mod file in the repo
188188 go mod tidy
189- cd ./apis && go mod tidy
189+ cd ./api && go mod tidy
190190
191191GOLANGCI_LINT_VERSION ?= v2.4.0
192192.PHONY : golangci-lint
@@ -207,7 +207,7 @@ ginkgo-run: ## Run ginkgo.
207207 source hack/export_related_images.sh && \
208208 KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) -v debug --bin-dir $( LOCALBIN) use $( ENVTEST_K8S_VERSION) -p path) " \
209209 OPERATOR_TEMPLATES=" $( PWD) /templates" \
210- $(GINKGO ) --trace --cover --coverpkg=./pkg /...,./controllers/...,./apis /... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS ) $(GINKGO_TESTS )
210+ $(GINKGO ) --trace --cover --coverpkg=./internal /...,./api /... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS ) $(GINKGO_TESTS )
211211
212212.PHONY : test-all
213213test-all : test golint golangci golangci-lint # # Run all tests.
@@ -220,7 +220,7 @@ cover: test ## Run tests and display functional test coverage
220220
221221.PHONY : build
222222build : generate fmt vet # # Build manager binary.
223- go build -o bin/manager main.go
223+ go build -o bin/manager cmd/ main.go
224224 go build -o bin/operator cmd/operator/main.go
225225
226226.PHONY : run
@@ -231,7 +231,7 @@ run: export ENABLE_WEBHOOKS?=false
231231run : manifests generate fmt vet # # Run a controller from your host.
232232 /bin/bash hack/clean_local_webhook.sh
233233 source hack/export_related_images.sh && \
234- go run ./main.go -metrics-bind-address " :$( METRICS_PORT) " -health-probe-bind-address " :$( HEALTH_PORT) " -pprof-bind-address " :$( PPROF_PORT) "
234+ go run ./cmd/ main.go -metrics-bind-address " :$( METRICS_PORT) " -health-probe-bind-address " :$( HEALTH_PORT) " -pprof-bind-address " :$( PPROF_PORT) "
235235
236236.PHONY : run-operator
237237run-operator : export METRICS_PORT?=8080
@@ -270,6 +270,12 @@ docker-buildx: ## Build and push docker image for the manager for cross-platfor
270270 - docker buildx rm project-v3-builder
271271 rm Dockerfile.cross
272272
273+ .PHONY : build-installer
274+ build-installer : manifests generate kustomize # # Generate a consolidated YAML with CRDs and deployment.
275+ mkdir -p dist
276+ cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
277+ $(KUSTOMIZE ) build config/default > dist/install.yaml
278+
273279# #@ Deployment
274280
275281ifndef ignore-not-found
@@ -306,12 +312,12 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
306312ENVTEST ?= $(LOCALBIN ) /setup-envtest
307313CRD_MARKDOWN ?= $(LOCALBIN ) /crd-to-markdown
308314GINKGO ?= $(LOCALBIN ) /ginkgo
309- GINKGO_TESTS ?= ./tests /... ./apis /client/... ./apis /core/... ./apis /dataplane/... ./pkg /...
315+ GINKGO_TESTS ?= ./test /... ./api /client/... ./api /core/... ./api /dataplane/... ./internal /...
310316
311317KUTTL ?= $(LOCALBIN ) /kubectl-kuttl
312318
313319# # Tool Versions
314- KUSTOMIZE_VERSION ?= v5.5 .0 # (dprince: bumped to aquire new features like --load-restrictor)
320+ KUSTOMIZE_VERSION ?= v5.6 .0 # (dprince: bumped to aquire new features like --load-restrictor)
315321CONTROLLER_TOOLS_VERSION ?= v0.18.0
316322CRD_MARKDOWN_VERSION ?= v0.0.3
317323KUTTL_VERSION ?= 0.17.0
@@ -351,7 +357,7 @@ $(GINKGO): $(LOCALBIN)
351357
352358.PHONY : kuttl-test
353359kuttl-test : # # Run kuttl tests
354- $(LOCALBIN ) /kubectl-kuttl test --config kuttl-test.yaml tests /kuttl/tests $(KUTTL_ARGS )
360+ $(LOCALBIN ) /kubectl-kuttl test --config kuttl-test.yaml test /kuttl/tests $(KUTTL_ARGS )
355361
356362.PHONY : kuttl
357363kuttl : $(KUTTL ) # # Download kubectl-kuttl locally if necessary.
@@ -380,8 +386,8 @@ endif
380386bundle : manifests kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
381387 $(OPERATOR_SDK ) generate kustomize manifests -q
382388 cd config/operator/deployment/ && $(KUSTOMIZE ) edit set image controller=$(IMG ) && \
383- $(KUSTOMIZE ) edit add patch --kind Deployment --name openstack-operator-controller-operator --namespace system --patch " [{\" op\" : \" replace\" , \" path\" : \" /spec/template/spec/containers/1 /env/0\" , \" value\" : {\" name\" : \" OPENSTACK_RELEASE_VERSION\" , \" value\" : \" $( OPENSTACK_RELEASE_VERSION) \" }}]" && \
384- $(KUSTOMIZE ) edit add patch --kind Deployment --name openstack-operator-controller-operator --namespace system --patch " [{\" op\" : \" replace\" , \" path\" : \" /spec/template/spec/containers/1 /env/1\" , \" value\" : {\" name\" : \" OPERATOR_IMAGE_URL\" , \" value\" : \" $( IMG) \" }}]"
389+ $(KUSTOMIZE ) edit add patch --kind Deployment --name openstack-operator-controller-operator --namespace system --patch " [{\" op\" : \" replace\" , \" path\" : \" /spec/template/spec/containers/0 /env/0\" , \" value\" : {\" name\" : \" OPENSTACK_RELEASE_VERSION\" , \" value\" : \" $( OPENSTACK_RELEASE_VERSION) \" }}]" && \
390+ $(KUSTOMIZE ) edit add patch --kind Deployment --name openstack-operator-controller-operator --namespace system --patch " [{\" op\" : \" replace\" , \" path\" : \" /spec/template/spec/containers/0 /env/1\" , \" value\" : {\" name\" : \" OPERATOR_IMAGE_URL\" , \" value\" : \" $( IMG) \" }}]"
385391 $(KUSTOMIZE ) build config/operator --load-restrictor=' LoadRestrictionsNone' | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
386392 $(OPERATOR_SDK ) bundle validate ./bundle
387393
@@ -468,37 +474,37 @@ get-ci-tools:
468474# Run go fmt against code
469475gofmt : get-ci-tools
470476 GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh
471- GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh ./apis
477+ GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh ./api
472478
473479# Run go vet against code
474480govet : get-ci-tools
475481 GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh
476- GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh ./apis
482+ GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh ./api
477483
478484# Run go test against code
479485gotest : test
480486
481487# Run golangci-lint test against code
482488golangci : get-ci-tools
483489 GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh
484- GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh ./apis
490+ GOWORK=off $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh ./api
485491
486492# Run go lint against code
487493golint : get-ci-tools
488494 GOWORK=off PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh
489- GOWORK=off PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh ./apis
495+ GOWORK=off PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh ./api
490496
491497.PHONY : gowork
492498gowork : # # Generate go.work file to support our multi module repository
493499 test -f go.work || GOTOOLCHAIN=$(GOTOOLCHAIN_VERSION ) go work init
494500 go work use .
495- go work use ./apis
501+ go work use ./api
496502 go work sync
497503
498504.PHONY : operator-lint
499505operator-lint : gowork # # Runs operator-lint
500506 GOBIN=
$(LOCALBIN ) go install github.com/gibizer/
[email protected] 501- go vet -vettool=$(LOCALBIN ) /operator-lint ./... ./apis /...
507+ go vet -vettool=$(LOCALBIN ) /operator-lint ./... ./api /...
502508
503509# Used for webhook testing
504510# The configure_local_webhook.sh script below will remove any OLM webhooks
0 commit comments