Skip to content

Commit ef35961

Browse files
authored
chore: update operator-sdk version to 1.32 (#742)
* update operator-sdk version to 1.32 Signed-off-by: Anand Kumar Singh <anandrkskd@gmail.com> * fix: usign controller-gen 1.14.0 Signed-off-by: Anand Kumar Singh <anandrkskd@gmail.com> * fix: test, CRD filepath Signed-off-by: Anand Kumar Singh <anandrkskd@gmail.com> --------- Signed-off-by: Anand Kumar Singh <anandrkskd@gmail.com>
1 parent 6cf2a8e commit ef35961

File tree

10 files changed

+71
-10
lines changed

10 files changed

+71
-10
lines changed

Makefile

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,23 @@ IMAGE_TAG_BASE ?= $(IMAGE)
4040
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
4141
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:$(VERSION)
4242

43+
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
44+
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
45+
46+
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
47+
# You can enable this value if you would like to use SHA Based Digests
48+
# To enable set flag to true
49+
USE_IMAGE_DIGESTS ?= false
50+
ifeq ($(USE_IMAGE_DIGESTS), true)
51+
BUNDLE_GEN_FLAGS += --use-image-digests
52+
endif
53+
4354
# Image URL to use all building/pushing image targets
4455
IMG ?= $(IMAGE):$(VERSION)
4556

4657
# Set the Operator SDK version to use.
4758
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
48-
OPERATOR_SDK_VERSION ?= v1.22.2
59+
OPERATOR_SDK_VERSION ?= v1.32.0
4960

5061

5162
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
@@ -61,6 +72,7 @@ endif
6172
SHELL = /usr/bin/env bash -o pipefail
6273
.SHELLFLAGS = -ec
6374

75+
.PHONY: all
6476
all: build
6577

6678
##@ General
@@ -76,42 +88,57 @@ all: build
7688
# More info on the awk command:
7789
# http://linuxcommand.org/lc3_adv_awk.php
7890

91+
.PHONY: help
7992
help: ## Display this help.
8093
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
8194

8295
##@ Development
8396

97+
.PHONY: manifests
8498
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
8599
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook crd paths="./..." output:crd:artifacts:config=config/crd/bases
86100

101+
.PHONY: generate
87102
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
88103
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
89104

105+
.PHONY: fmt
90106
fmt: ## Run go fmt against code.
91107
go fmt ./...
92108

109+
.PHONY: vet
93110
vet: ## Run go vet against code.
94111
go vet ./...
95112

113+
.PHONY: test-all
96114
test-all: manifests generate fmt vet ## Run all tests.
97115
go test -timeout 1h ./... -coverprofile cover.out
98116

117+
.PHONY: test-e2e
99118
test-e2e: manifests generate fmt vet ## Run e2e tests.
100119
go test -p 1 -timeout 1h ./test/e2e -coverprofile cover.out -ginkgo.v
101120
go test -p 1 -timeout 1h ./test/nondefaulte2e -coverprofile cover.out -ginkgo.v
102121

122+
.PHONY: test-metrics
103123
test-metrics:
104124
go test -timeout 30m ./test/e2e -ginkgo.focus="Argo CD metrics controller" -coverprofile cover.out -ginkgo.v
105125

126+
127+
.PHONY: test-route
106128
test-route:
107129
go test -timeout 30m ./test/e2e -ginkgo.focus="Argo CD ConsoleLink controller" -coverprofile cover.out -ginkgo.v
108130

131+
132+
.PHONY: test-gitopsservice
109133
test-gitopsservice:
110134
go test -p 1 -timeout 1h ./test/e2e -ginkgo.focus="GitOpsServiceController" -coverprofile cover.out -ginkgo.v
111135

136+
137+
.PHONY: test-gitopsservice-nondefault
112138
test-gitopsservice-nondefault:
113139
go test -p 1 -timeout 30m ./test/nondefaulte2e -ginkgo.focus="GitOpsServiceNoDefaultInstall" -coverprofile cover.out -ginkgo.v
114140

141+
.PHONY: test
115142
test: manifests generate fmt vet ## Run unit tests.
116143
go test `go list ./... | grep -v test` -coverprofile cover.out
117144

@@ -142,15 +169,19 @@ e2e-non-olm-tests-all:
142169

143170
##@ Build
144171

172+
.PHONY: build
145173
build: generate fmt vet ## Build manager binary.
146174
go build -o bin/manager main.go
147175

176+
.PHONY: run
148177
run: manifests generate fmt vet ## Run a controller from your host.
149178
REDIS_CONFIG_PATH="build/redis" go run ./main.go
150179

180+
.PHONY: docker-build
151181
docker-build: test ## Build docker image with the manager.
152182
docker build -t ${IMG} .
153183

184+
.PHONY: docker-push
154185
docker-push: ## Push docker image with the manager.
155186
docker push ${IMG}
156187

@@ -178,31 +209,40 @@ OPERATOR_SDK = $(shell which operator-sdk)
178209
endif
179210
endif
180211

212+
ifndef ignore-not-found
213+
ignore-not-found = false
214+
endif
181215

182216
##@ Deployment
183217

218+
.PHONY: install
184219
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
185220
## TODO: Remove sed usage after all v1alpha1 references are updated to v1beta1 in codebase.
186221
## For local testing, conversion webhook defined in crd makes call to webhook for each v1alpha1 reference
187222
## causing failures as we don't set up the webhook for local testing.
188223
$(KUSTOMIZE) build config/crd | sed '/conversion:/,/- v1beta1/d' |kubectl apply --server-side=true -f -
189224

225+
.PHONY: uninstall
190226
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
191227
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=true -f -
192228

229+
.PHONY: deploy
193230
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
194231
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
195232
$(KUSTOMIZE) build config/default | kubectl apply --server-side=true -f -
196233

234+
.PHONY: undeploy
197235
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
198236
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=true -f -
199237

200238

201239
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
240+
.PHONY: controller-gen
202241
controller-gen: ## Download controller-gen locally if necessary.
203242
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0)
204243

205244
KUSTOMIZE = $(shell pwd)/bin/kustomize
245+
.PHONY: kustomize
206246
kustomize: ## Download kustomize locally if necessary.
207247
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.2)
208248

@@ -226,7 +266,7 @@ endef
226266
bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
227267
$(OPERATOR_SDK) generate kustomize manifests -q
228268
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
229-
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
269+
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
230270
$(OPERATOR_SDK) bundle validate ./bundle
231271

232272
.PHONY: bundle-build
@@ -246,7 +286,7 @@ ifeq (,$(shell which opm 2>/dev/null))
246286
set -e ;\
247287
mkdir -p $(dir $(OPM)) ;\
248288
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
249-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\
289+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
250290
chmod +x $(OPM) ;\
251291
}
252292
else

bundle.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=gitops-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=latest,gitops-1.8
99
LABEL operators.operatorframework.io.bundle.channel.default.v1=latest
10-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.2
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
1111
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1212
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1313

bundle/manifests/gitops-operator.clusterserviceversion.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ metadata:
164164
capabilities: Deep Insights
165165
console.openshift.io/plugins: '["gitops-plugin"]'
166166
containerImage: quay.io/redhat-developer/gitops-operator
167+
createdAt: "2024-07-15T07:28:44Z"
167168
description: Enables teams to adopt GitOps principles for managing cluster configurations
168169
and application delivery across hybrid multi-cluster Kubernetes environments.
169170
features.operators.openshift.io/disconnected: "true"
@@ -176,7 +177,7 @@ metadata:
176177
operatorframework.io/cluster-monitoring: "true"
177178
operatorframework.io/suggested-namespace: openshift-gitops-operator
178179
operators.openshift.io/infrastructure-features: '["disconnected"]'
179-
operators.operatorframework.io/builder: operator-sdk-v1.22.2
180+
operators.operatorframework.io/builder: operator-sdk-v1.32.0
180181
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
181182
repository: https://github.com/redhat-developer/gitops-operator
182183
support: Red Hat
@@ -971,6 +972,8 @@ spec:
971972
strategy: {}
972973
template:
973974
metadata:
975+
annotations:
976+
kubectl.kubernetes.io/default-container: manager
974977
labels:
975978
control-plane: gitops-operator
976979
spec:
@@ -1007,7 +1010,13 @@ spec:
10071010
port: 8081
10081011
initialDelaySeconds: 5
10091012
periodSeconds: 10
1010-
resources: {}
1013+
resources:
1014+
limits:
1015+
cpu: 500m
1016+
memory: 768Mi
1017+
requests:
1018+
cpu: 10m
1019+
memory: 256Mi
10111020
securityContext:
10121021
allowPrivilegeEscalation: false
10131022
capabilities:
@@ -1028,6 +1037,7 @@ spec:
10281037
ports:
10291038
- containerPort: 8443
10301039
name: metrics
1040+
protocol: TCP
10311041
resources:
10321042
limits:
10331043
cpu: 500m

bundle/manifests/openshift-gitops-operator-metrics-service_v1_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ spec:
1111
ports:
1212
- name: metrics
1313
port: 8443
14+
protocol: TCP
1415
targetPort: metrics
1516
selector:
1617
control-plane: gitops-operator

bundle/metadata/annotations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ annotations:
66
operators.operatorframework.io.bundle.package.v1: gitops-operator
77
operators.operatorframework.io.bundle.channels.v1: latest,gitops-1.8
88
operators.operatorframework.io.bundle.channel.default.v1: latest
9-
operators.operatorframework.io.metrics.builder: operator-sdk-v1.22.2
9+
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
1010
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
1111
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
1212

config/default/manager_auth_proxy_patch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ spec:
2424
- --http2-disable
2525
ports:
2626
- containerPort: 8443
27+
protocol: TCP
2728
name: metrics
2829
resources:
2930
limits:

config/manager/manager.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ spec:
1919
replicas: 1
2020
template:
2121
metadata:
22+
annotations:
23+
kubectl.kubernetes.io/default-container: manager
2224
labels:
2325
control-plane: gitops-operator
2426
spec:
@@ -48,7 +50,13 @@ spec:
4850
port: 8081
4951
initialDelaySeconds: 5
5052
periodSeconds: 10
51-
resources: {}
53+
resources:
54+
limits:
55+
cpu: 500m
56+
memory: 768Mi
57+
requests:
58+
cpu: 10m
59+
memory: 256Mi
5260
securityContext:
5361
allowPrivilegeEscalation: false
5462
capabilities:

config/rbac/auth_proxy_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ spec:
1111
ports:
1212
- name: metrics
1313
port: 8443
14+
protocol: TCP
1415
targetPort: metrics
1516
selector:
1617
control-plane: gitops-operator

test/e2e/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var _ = BeforeSuite(func() {
9494
useActualCluster := true
9595
testEnv = &envtest.Environment{
9696
CRDDirectoryPaths: []string{
97-
filepath.Join("../..", "config", "crd", "bases"),
97+
filepath.Join("..", "..", "config", "crd", "bases"),
9898
},
9999
UseExistingCluster: &useActualCluster, // use an actual OpenShift cluster specified in kubeconfig
100100
ErrorIfCRDPathMissing: true,

test/nondefaulte2e/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var _ = BeforeSuite(func() {
7878
useActualCluster := true
7979
testEnv = &envtest.Environment{
8080
CRDDirectoryPaths: []string{
81-
filepath.Join("../..", "config", "crd", "bases"),
81+
filepath.Join("..", "..", "config", "crd", "bases"),
8282
},
8383
UseExistingCluster: &useActualCluster, // use an actual OpenShift cluster specified in kubeconfig
8484
ErrorIfCRDPathMissing: true,

0 commit comments

Comments
 (0)