87
87
$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!)
88
88
endif
89
89
90
- KUSTOMIZE_BUILD_DIR := config-new/overlays/community
90
+ KUSTOMIZE_RELEASE_OVERLAY := config/overlays/community
91
+ KUSTOMIZE_E2E_OVERLAY := config/overlays/community-e2e
92
+ KUSTOMIZE_TILT_OVERLAY := config/overlays/community-tilt
93
+ KUSTOMIZE_CATALOGS_OVERLAY := config/overlays/default-catalogs
94
+
95
+ export RELEASE_MANIFEST := operator-controller.yaml
96
+ export RELEASE_INSTALL := install.sh
97
+ export RELEASE_CATALOGS := default-catalogs.yaml
98
+
99
+ DEV_MANIFESTS_DIR := dev-manifests
100
+ DEV_MANIFEST := $(DEV_MANIFESTS_DIR ) /operator-controller-dev.yaml
101
+ E2E_MANIFEST := $(DEV_MANIFESTS_DIR ) /operator-controller-e2e.yaml
102
+ TILT_MANIFEST := $(DEV_MANIFESTS_DIR ) /operator-controller-tilt.yaml
103
+ CATALOGS_MANIFEST := $(DEV_MANIFESTS_DIR ) /default-catalogs.yaml
91
104
92
105
# Disable -j flag for make
93
106
.NOTPARALLEL :
@@ -139,15 +152,15 @@ tidy:
139
152
go mod tidy
140
153
141
154
.PHONY : manifests
142
- KUSTOMIZE_CATD_CRDS_DIR := config-new /base/catalogd/crd/bases
143
- KUSTOMIZE_CATD_RBAC_DIR := config-new /base/catalogd/rbac
144
- KUSTOMIZE_CATD_WEBHOOKS_DIR := config-new /base/catalogd/manager/webhook
145
- KUSTOMIZE_OPCON_CRDS_DIR := config-new /base/operator-controller/crd/bases
146
- KUSTOMIZE_OPCON_RBAC_DIR := config-new /base/operator-controller/rbac
155
+ KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
156
+ KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
157
+ KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
158
+ KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
159
+ KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
147
160
CRD_WORKING_DIR := crd_work_dir
148
161
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
149
162
# So we have to generate them together and then move them into place
150
- manifests : $(CONTROLLER_GEN ) # EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
163
+ manifests : $(CONTROLLER_GEN ) $( KUSTOMIZE ) # EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
151
164
mkdir $(CRD_WORKING_DIR )
152
165
$(CONTROLLER_GEN ) --load-build-tags=$(GO_BUILD_TAGS ) crd paths=" ./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR )
153
166
mv $(CRD_WORKING_DIR ) /olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR )
@@ -157,6 +170,12 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
157
170
$(CONTROLLER_GEN ) --load-build-tags=$(GO_BUILD_TAGS ) rbac:roleName=manager-role paths=" ./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR )
158
171
# Generate the remaining catalogd manifests
159
172
$(CONTROLLER_GEN ) --load-build-tags=$(GO_BUILD_TAGS ) rbac:roleName=manager-role paths=" ./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR )
173
+ mkdir -p $(DEV_MANIFESTS_DIR )
174
+ $(KUSTOMIZE ) build $(KUSTOMIZE_RELEASE_OVERLAY ) > $(DEV_MANIFEST )
175
+ $(KUSTOMIZE ) build $(KUSTOMIZE_E2E_OVERLAY ) > $(E2E_MANIFEST )
176
+ $(KUSTOMIZE ) build $(KUSTOMIZE_TILT_OVERLAY ) > $(TILT_MANIFEST )
177
+ $(KUSTOMIZE ) build $(KUSTOMIZE_CATALOGS_OVERLAY ) > $(CATALOGS_MANIFEST )
178
+
160
179
161
180
.PHONY : generate
162
181
generate : $(CONTROLLER_GEN ) # EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -210,11 +229,11 @@ E2E_REGISTRY_NAME := docker-registry
210
229
E2E_REGISTRY_NAMESPACE := operator-controller-e2e
211
230
212
231
export REG_PKG_NAME := registry-operator
213
- export LOCAL_REGISTRY_HOST := $(E2E_REGISTRY_NAME ) .$(E2E_REGISTRY_NAMESPACE ) .svc:5000
214
- export CLUSTER_REGISTRY_HOST := localhost:30000
232
+ export INCLUSTER_REGISTRY_HOST := $(E2E_REGISTRY_NAME ) .$(E2E_REGISTRY_NAMESPACE ) .svc:5000
233
+ export LOCAL_REGISTRY_HOST := localhost:30000
215
234
export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1
216
235
export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2
217
- export CATALOG_IMG := $(LOCAL_REGISTRY_HOST ) /$(E2E_TEST_CATALOG_V1 )
236
+ export CATALOG_IMG := $(INCLUSTER_REGISTRY_HOST ) /$(E2E_TEST_CATALOG_V1 )
218
237
.PHONY : test-ext-dev-e2e
219
238
test-ext-dev-e2e : $(OPERATOR_SDK ) $(KUSTOMIZE ) $(KIND ) # HELP Run extension create, upgrade and delete tests.
220
239
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK ) $(CONTAINER_RUNTIME ) $(KUSTOMIZE ) $(KIND ) $(KIND_CLUSTER_NAME ) $(E2E_REGISTRY_NAMESPACE )
@@ -239,15 +258,9 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
239
258
$(UNIT_TEST_DIRS ) \
240
259
-test.gocoverdir=$(COVERAGE_UNIT_DIR )
241
260
242
- .PHONY : image-registry
243
- E2E_REGISTRY_IMAGE =localhost/e2e-test-registry:devel
244
- image-registry : export GOOS=linux
245
- image-registry : export GOARCH=amd64
246
- image-registry : # # Build the testdata catalog used for e2e tests and push it to the image registry
247
- go build $(GO_BUILD_FLAGS ) $(GO_BUILD_EXTRA_FLAGS ) -tags ' $(GO_BUILD_TAGS)' -ldflags ' $(GO_BUILD_LDFLAGS)' -gcflags ' $(GO_BUILD_GCFLAGS)' -asmflags ' $(GO_BUILD_ASMFLAGS)' -o ./testdata/push/bin/push ./testdata/push/push.go
248
- $(CONTAINER_RUNTIME ) build -f ./testdata/Dockerfile -t $(E2E_REGISTRY_IMAGE ) ./testdata
249
- $(CONTAINER_RUNTIME ) save $(E2E_REGISTRY_IMAGE ) | $(KIND ) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME )
250
- ./testdata/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE ) $(E2E_REGISTRY_NAME ) $(E2E_REGISTRY_IMAGE )
261
+ .PHONY : push-test-images
262
+ push-test-images : # # Build the testdata catalog used for e2e tests and push it to the image registry
263
+ (cd ./testdata/push && go run ./ --images-path=../images --registry-address=localhost:30000)
251
264
252
265
# When running the e2e suite, you can set the ARTIFACT_PATH variable to the absolute path
253
266
# of the directory for the operator-controller e2e tests to store the artifacts, which
@@ -256,15 +269,15 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
256
269
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
257
270
.PHONY : test-e2e
258
271
test-e2e : KIND_CLUSTER_NAME := operator-controller-e2e
259
- test-e2e : KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
272
+ test-e2e : export MANIFEST := $( E2E_MANIFEST )
260
273
test-e2e : GO_BUILD_EXTRA_FLAGS := -cover
261
- test-e2e : run image-registry e2e e2e-coverage kind-clean # HELP Run e2e test suite on local kind cluster
274
+ test-e2e : run-internal push-test-images e2e e2e-coverage kind-clean # HELP Run e2e test suite on local kind cluster
262
275
263
276
.PHONY : extension-developer-e2e
264
277
extension-developer-e2e : KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e
265
- extension-developer-e2e : KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
278
+ extension-developer-e2e : export MANIFEST := $( E2E_MANIFEST )
266
279
extension-developer-e2e : export INSTALL_DEFAULT_CATALOGS := false
267
- extension-developer-e2e : run image-registry test-ext-dev-e2e kind-clean # EXHELP Run extension-developer e2e on local kind cluster
280
+ extension-developer-e2e : run-internal push-test-images test-ext-dev-e2e kind-clean # EXHELP Run extension-developer e2e on local kind cluster
268
281
269
282
.PHONY : run-latest-release
270
283
run-latest-release :
@@ -282,7 +295,7 @@ post-upgrade-checks:
282
295
test-upgrade-e2e : KIND_CLUSTER_NAME := operator-controller-upgrade-e2e
283
296
test-upgrade-e2e : export TEST_CLUSTER_CATALOG_NAME := test-catalog
284
297
test-upgrade-e2e : export TEST_CLUSTER_EXTENSION_NAME := test-package
285
- test-upgrade-e2e : kind-cluster run-latest-release image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean # HELP Run upgrade e2e tests on a local kind cluster
298
+ test-upgrade-e2e : kind-cluster run-latest-release push-test-images pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean # HELP Run upgrade e2e tests on a local kind cluster
286
299
287
300
.PHONY : e2e-coverage
288
301
e2e-coverage :
@@ -296,11 +309,9 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
296
309
$(CONTAINER_RUNTIME ) save $(CATD_IMG ) | $(KIND ) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME )
297
310
298
311
.PHONY : kind-deploy
299
- kind-deploy : export MANIFEST := ./operator-controller.yaml
300
- kind-deploy : export DEFAULT_CATALOG := ./config/catalogs/clustercatalogs/default-catalogs.yaml
301
312
kind-deploy : manifests $(KUSTOMIZE )
302
- $( KUSTOMIZE ) build $( KUSTOMIZE_BUILD_DIR ) | envsubst ' $$VERSION' > operator-controller .yaml
303
- envsubst ' $$DEFAULT_CATALOG ,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
313
+ envsubst ' $$VERSION' < $$ MANIFEST > ./tmp-manifest .yaml
314
+ export MANIFEST=./tmp-manifest.yaml && envsubst ' $$DEFAULT_CATALOGS ,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s && rm ./tmp-manifest.yaml
304
315
305
316
.PHONY : kind-cluster
306
317
kind-cluster : $(KIND ) # EXHELP Standup a kind cluster.
@@ -351,7 +362,11 @@ go-build-linux: export GOARCH=amd64
351
362
go-build-linux : $(BINARIES )
352
363
353
364
.PHONY : run
354
- run : docker-build kind-cluster kind-load kind-deploy wait # HELP Build the operator-controller then deploy it into a new kind cluster.
365
+ run : export MANIFEST := $(DEV_MANIFEST )
366
+ run : run-internal # HELP Build the operator-controller then deploy it into a new kind cluster.
367
+
368
+ .PHONY : run-internal
369
+ run-internal : docker-build kind-cluster kind-load kind-deploy wait
355
370
356
371
CATD_NAMESPACE := olmv1-system
357
372
wait :
@@ -380,10 +395,11 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
380
395
381
396
.PHONY : quickstart
382
397
quickstart : export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION ) /operator-controller.yaml
383
- quickstart : export DEFAULT_CATALOG := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION ) /default-catalogs.yaml"
384
- quickstart : $(KUSTOMIZE ) manifests # EXHELP Generate the unified installation release manifests and scripts.
385
- $(KUSTOMIZE ) build $(KUSTOMIZE_BUILD_DIR ) | envsubst ' $$VERSION' > operator-controller.yaml
386
- envsubst ' $$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
398
+ quickstart : export DEFAULT_CATALOGS := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION ) /default-catalogs.yaml"
399
+ quickstart : manifests # EXHELP Generate the unified installation release manifests and scripts.
400
+ envsubst ' $$VERSION' < $(DEV_MANIFEST ) > $(RELEASE_MANIFEST )
401
+ cp $(CATALOGS_MANIFEST ) > $(RELEASE_CATALOGS )
402
+ envsubst ' $$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > $(RELEASE_INSTALL )
387
403
388
404
# #@ Docs
389
405
0 commit comments