Skip to content

Commit 6352fbd

Browse files
committed
Rescafold with operator-sdk-1.41.1
1 parent 476792c commit 6352fbd

365 files changed

Lines changed: 3725 additions & 786 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.

.dockerignore

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
1-
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2-
# Ignore build and test binaries.
3-
bin/
4-
testbin/
1+
ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.24
2+
ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest
3+
# Build the manager binary
4+
FROM $GOLANG_BUILDER AS builder
5+
6+
#Arguments required by OSBS build system
7+
ARG CACHITO_ENV_FILE=/remote-source/cachito.env
8+
9+
ARG REMOTE_SOURCE=.
10+
ARG REMOTE_SOURCE_DIR=/remote-source
11+
ARG REMOTE_SOURCE_SUBDIR=
12+
ARG DEST_ROOT=/dest-root
13+
14+
ARG GO_BUILD_EXTRA_ARGS="-tags strictfipsruntime"
15+
ARG GO_BUILD_EXTRA_ENV_ARGS="CGO_ENABLED=1 GO111MODULE=on"
16+
17+
COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
18+
WORKDIR $REMOTE_SOURCE_DIR/$REMOTE_SOURCE_SUBDIR
19+
20+
USER root
21+
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/
22+
23+
# cache deps before building and copying source so that we don't need to re-download as much
24+
# and so that source changes don't invalidate our downloaded layer
25+
RUN if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
26+
27+
# Build manager
28+
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}/operator cmd/operator/main.go
30+
31+
RUN cp -r config/services ${DEST_ROOT}/services
32+
RUN cp -r bindata ${DEST_ROOT}/bindata
33+
34+
# Use distroless as minimal base image to package the manager binary
35+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
36+
FROM $OPERATOR_BASE_IMAGE
37+
38+
ARG DEST_ROOT=/dest-root
39+
# NONROOT default id https://github.com/GoogleContainerTools/distroless/blob/main/base/base.bzl#L8=
40+
ARG USER_ID=65532
41+
42+
ARG IMAGE_COMPONENT="openstack-operator-container"
43+
ARG IMAGE_NAME="openstack-operator"
44+
ARG IMAGE_VERSION="1.0.0"
45+
ARG IMAGE_SUMMARY="Openstack Operator"
46+
ARG IMAGE_DESC="This image includes the openstack-operator"
47+
ARG IMAGE_TAGS="cn-openstack openstack"
48+
49+
### DO NOT EDIT LINES BELOW
50+
# Auto generated using CI tools from
51+
# https://github.com/openstack-k8s-operators/openstack-k8s-operators-ci
52+
53+
# Labels required by upstream and osbs build system
54+
LABEL com.redhat.component="${IMAGE_COMPONENT}" \
55+
name="${IMAGE_NAME}" \
56+
version="${IMAGE_VERSION}" \
57+
summary="${IMAGE_SUMMARY}" \
58+
io.k8s.name="${IMAGE_NAME}" \
59+
io.k8s.description="${IMAGE_DESC}" \
60+
io.openshift.tags="${IMAGE_TAGS}"
61+
### DO NOT EDIT LINES ABOVE
62+
63+
ENV USER_UID=$USER_ID \
64+
OPERATOR_SERVICES=/usr/share/openstack-operator/services/
65+
66+
WORKDIR /
67+
68+
# Install operator binary to WORKDIR
69+
COPY --from=builder ${DEST_ROOT}/manager .
70+
COPY --from=builder ${DEST_ROOT}/operator .
71+
72+
# Install services
73+
COPY --from=builder ${DEST_ROOT}/services ${OPERATOR_SERVICES}
74+
COPY --from=builder ${DEST_ROOT}/bindata /bindata
75+
76+
USER $USER_ID
77+
78+
ENV PATH="/:${PATH}"
79+
80+
ENTRYPOINT ["/manager"]

Gemfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

Makefile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ help: ## Display this help.
139139
manifests: 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
147147
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -171,22 +171,22 @@ fmt: ## Run go fmt against code.
171171
.PHONY: vet
172172
vet: gowork ## Run go vet against code.
173173
go vet ./...
174-
go vet ./apis/...
174+
go vet ./api/...
175175

176176
BRANCH ?= main
177177
.PHONY: force-bump
178178
force-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
187187
tidy: ## 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

191191
GOLANGCI_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
213213
test-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
222222
build: 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
231231
run: 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
237237
run-operator: export METRICS_PORT?=8080
@@ -306,7 +306,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
306306
ENVTEST ?= $(LOCALBIN)/setup-envtest
307307
CRD_MARKDOWN ?= $(LOCALBIN)/crd-to-markdown
308308
GINKGO ?= $(LOCALBIN)/ginkgo
309-
GINKGO_TESTS ?= ./tests/... ./apis/client/... ./apis/core/... ./apis/dataplane/... ./pkg/...
309+
GINKGO_TESTS ?= ./tests/... ./api/client/... ./api/core/... ./api/dataplane/... ./internal/...
310310

311311
KUTTL ?= $(LOCALBIN)/kubectl-kuttl
312312

@@ -468,37 +468,37 @@ get-ci-tools:
468468
# Run go fmt against code
469469
gofmt: get-ci-tools
470470
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/gofmt.sh
471-
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/gofmt.sh ./apis
471+
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/gofmt.sh ./api
472472

473473
# Run go vet against code
474474
govet: get-ci-tools
475475
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/govet.sh
476-
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/govet.sh ./apis
476+
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/govet.sh ./api
477477

478478
# Run go test against code
479479
gotest: test
480480

481481
# Run golangci-lint test against code
482482
golangci: get-ci-tools
483483
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/golangci.sh
484-
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/golangci.sh ./apis
484+
GOWORK=off $(CI_TOOLS_REPO_DIR)/test-runner/golangci.sh ./api
485485

486486
# Run go lint against code
487487
golint: get-ci-tools
488488
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
489+
GOWORK=off PATH=$(GOBIN):$(PATH); $(CI_TOOLS_REPO_DIR)/test-runner/golint.sh ./api
490490

491491
.PHONY: gowork
492492
gowork: ## Generate go.work file to support our multi module repository
493493
test -f go.work || GOTOOLCHAIN=$(GOTOOLCHAIN_VERSION) go work init
494494
go work use .
495-
go work use ./apis
495+
go work use ./api
496496
go work sync
497497

498498
.PHONY: operator-lint
499499
operator-lint: gowork ## Runs operator-lint
500500
GOBIN=$(LOCALBIN) go install github.com/gibizer/operator-lint@v0.3.0
501-
go vet -vettool=$(LOCALBIN)/operator-lint ./... ./apis/...
501+
go vet -vettool=$(LOCALBIN)/operator-lint ./... ./api/...
502502

503503
# Used for webhook testing
504504
# The configure_local_webhook.sh script below will remove any OLM webhooks

PROJECT

Lines changed: 8 additions & 8 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: {}
@@ -19,7 +19,7 @@ resources:
1919
domain: openstack.org
2020
group: core
2121
kind: OpenStackControlPlane
22-
path: github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1
22+
path: github.com/openstack-k8s-operators/openstack-operator/api/core/v1beta1
2323
version: v1beta1
2424
webhooks:
2525
validation: true
@@ -31,7 +31,7 @@ resources:
3131
domain: openstack.org
3232
group: client
3333
kind: OpenStackClient
34-
path: github.com/openstack-k8s-operators/openstack-operator/apis/client/v1beta1
34+
path: github.com/openstack-k8s-operators/openstack-operator/api/client/v1beta1
3535
version: v1beta1
3636
- api:
3737
crdVersion: v1
@@ -40,7 +40,7 @@ resources:
4040
domain: openstack.org
4141
group: core
4242
kind: OpenStackVersion
43-
path: github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1
43+
path: github.com/openstack-k8s-operators/openstack-operator/api/core/v1beta1
4444
version: v1beta1
4545
webhooks:
4646
defaulting: true
@@ -53,7 +53,7 @@ resources:
5353
domain: openstack.org
5454
group: dataplane
5555
kind: OpenStackDataPlaneNodeSet
56-
path: github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1
56+
path: github.com/openstack-k8s-operators/openstack-operator/api/dataplane/v1beta1
5757
version: v1beta1
5858
webhooks:
5959
defaulting: true
@@ -66,7 +66,7 @@ resources:
6666
domain: openstack.org
6767
group: dataplane
6868
kind: OpenStackDataPlaneService
69-
path: github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1
69+
path: github.com/openstack-k8s-operators/openstack-operator/api/dataplane/v1beta1
7070
version: v1beta1
7171
- api:
7272
crdVersion: v1
@@ -75,7 +75,7 @@ resources:
7575
domain: openstack.org
7676
group: dataplane
7777
kind: OpenStackDataPlaneDeployment
78-
path: github.com/openstack-k8s-operators/openstack-operator/apis/dataplane/v1beta1
78+
path: github.com/openstack-k8s-operators/openstack-operator/api/dataplane/v1beta1
7979
version: v1beta1
8080
- api:
8181
crdVersion: v1
@@ -84,6 +84,6 @@ resources:
8484
domain: openstack.org
8585
group: operator
8686
kind: OpenStack
87-
path: github.com/openstack-k8s-operators/openstack-operator/apis/operator/v1beta1
87+
path: github.com/openstack-k8s-operators/openstack-operator/api/operator/v1beta1
8888
version: v1beta1
8989
version: "3"
File renamed without changes.

apis/bases/core.openstack.org_openstackcontrolplanes.yaml renamed to api/bases/core.openstack.org_openstackcontrolplanes.yaml

File renamed without changes.
File renamed without changes.

apis/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml renamed to api/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml

File renamed without changes.

apis/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml renamed to api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

File renamed without changes.

apis/bases/dataplane.openstack.org_openstackdataplaneservices.yaml renamed to api/bases/dataplane.openstack.org_openstackdataplaneservices.yaml

File renamed without changes.

0 commit comments

Comments
 (0)