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
+ RELEASE_MANIFEST := ./release-manifests/operator-controller.yaml
96
+ E2E_MANIFEST := ./release-manifests/operator-controller-e2e.yaml
97
+ TILT_MANIFEST := ./release-manifests/operator-controller-tilt.yaml
98
+ CATALOGS_MANIFEST := ./release-manifests/default-catalogs.yaml
91
99
92
100
# Disable -j flag for make
93
101
.NOTPARALLEL :
@@ -139,15 +147,15 @@ tidy:
139
147
go mod tidy
140
148
141
149
.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
150
+ KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
151
+ KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
152
+ KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
153
+ KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
154
+ KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
147
155
CRD_WORKING_DIR := crd_work_dir
148
156
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
149
157
# So we have to generate them together and then move them into place
150
- manifests : $(CONTROLLER_GEN ) # EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
158
+ manifests : $(CONTROLLER_GEN ) $( KUSTOMIZE ) # EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
151
159
mkdir $(CRD_WORKING_DIR )
152
160
$(CONTROLLER_GEN ) --load-build-tags=$(GO_BUILD_TAGS ) crd paths=" ./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR )
153
161
mv $(CRD_WORKING_DIR ) /olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR )
@@ -157,6 +165,11 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
157
165
$(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
166
# Generate the remaining catalogd manifests
159
167
$(CONTROLLER_GEN ) --load-build-tags=$(GO_BUILD_TAGS ) rbac:roleName=manager-role paths=" ./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR )
168
+ $(KUSTOMIZE ) build $(KUSTOMIZE_RELEASE_OVERLAY ) | envsubst ' $$VERSION' > $(RELEASE_MANIFEST )
169
+ $(KUSTOMIZE ) build $(KUSTOMIZE_E2E_OVERLAY ) | envsubst ' $$VERSION' > $(E2E_MANIFEST )
170
+ $(KUSTOMIZE ) build $(KUSTOMIZE_TILT_OVERLAY ) | envsubst ' $$VERSION' > $(TILT_MANIFEST )
171
+ $(KUSTOMIZE ) build $(KUSTOMIZE_CATALOGS_OVERLAY ) > $(CATALOGS_MANIFEST )
172
+
160
173
161
174
.PHONY : generate
162
175
generate : $(CONTROLLER_GEN ) # EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -210,11 +223,11 @@ E2E_REGISTRY_NAME := docker-registry
210
223
E2E_REGISTRY_NAMESPACE := operator-controller-e2e
211
224
212
225
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
226
+ export INCLUSTER_REGISTRY_HOST := $(E2E_REGISTRY_NAME ) .$(E2E_REGISTRY_NAMESPACE ) .svc:5000
227
+ export LOCAL_REGISTRY_HOST := localhost:30000
215
228
export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1
216
229
export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2
217
- export CATALOG_IMG := $(LOCAL_REGISTRY_HOST ) /$(E2E_TEST_CATALOG_V1 )
230
+ export CATALOG_IMG := $(INCLUSTER_REGISTRY_HOST ) /$(E2E_TEST_CATALOG_V1 )
218
231
.PHONY : test-ext-dev-e2e
219
232
test-ext-dev-e2e : $(OPERATOR_SDK ) $(KUSTOMIZE ) $(KIND ) # HELP Run extension create, upgrade and delete tests.
220
233
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK ) $(CONTAINER_RUNTIME ) $(KUSTOMIZE ) $(KIND ) $(KIND_CLUSTER_NAME ) $(E2E_REGISTRY_NAMESPACE )
@@ -239,15 +252,9 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
239
252
$(UNIT_TEST_DIRS ) \
240
253
-test.gocoverdir=$(COVERAGE_UNIT_DIR )
241
254
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 )
255
+ .PHONY : push-test-images
256
+ push-test-images : # # Build the testdata catalog used for e2e tests and push it to the image registry
257
+ (cd ./testdata/push && go run ./ --images-path=../images --registry-address=localhost:30000)
251
258
252
259
# When running the e2e suite, you can set the ARTIFACT_PATH variable to the absolute path
253
260
# of the directory for the operator-controller e2e tests to store the artifacts, which
@@ -256,15 +263,15 @@ image-registry: ## Build the testdata catalog used for e2e tests and push it to
256
263
# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e
257
264
.PHONY : test-e2e
258
265
test-e2e : KIND_CLUSTER_NAME := operator-controller-e2e
259
- test-e2e : KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
266
+ test-e2e : export MANIFEST := $( E2E_MANIFEST )
260
267
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
268
+ test-e2e : run-internal push-test-images e2e e2e-coverage kind-clean # HELP Run e2e test suite on local kind cluster
262
269
263
270
.PHONY : extension-developer-e2e
264
271
extension-developer-e2e : KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e
265
- extension-developer-e2e : KUSTOMIZE_BUILD_DIR := config-new/overlays/community-e2e
272
+ extension-developer-e2e : export MANIFEST := $( E2E_MANIFEST )
266
273
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
274
+ extension-developer-e2e : run-internal push-test-images test-ext-dev-e2e kind-clean # EXHELP Run extension-developer e2e on local kind cluster
268
275
269
276
.PHONY : run-latest-release
270
277
run-latest-release :
@@ -282,7 +289,7 @@ post-upgrade-checks:
282
289
test-upgrade-e2e : KIND_CLUSTER_NAME := operator-controller-upgrade-e2e
283
290
test-upgrade-e2e : export TEST_CLUSTER_CATALOG_NAME := test-catalog
284
291
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
292
+ 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
293
287
294
.PHONY : e2e-coverage
288
295
e2e-coverage :
@@ -296,11 +303,9 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
296
303
$(CONTAINER_RUNTIME ) save $(CATD_IMG ) | $(KIND ) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME )
297
304
298
305
.PHONY : kind-deploy
299
- kind-deploy : export MANIFEST := ./operator-controller.yaml
300
- kind-deploy : export DEFAULT_CATALOG := ./config/catalogs/clustercatalogs/default-catalogs.yaml
306
+ kind-deploy : export DEFAULT_CATALOGS := $(CATALOGS_MANIFEST )
301
307
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
308
+ envsubst ' $$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
304
309
305
310
.PHONY : kind-cluster
306
311
kind-cluster : $(KIND ) # EXHELP Standup a kind cluster.
@@ -351,7 +356,11 @@ go-build-linux: export GOARCH=amd64
351
356
go-build-linux : $(BINARIES )
352
357
353
358
.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.
359
+ run : export MANIFEST := $(RELEASE_MANIFEST )
360
+ run : run-internal # HELP Build the operator-controller then deploy it into a new kind cluster.
361
+
362
+ .PHONY : run-internal
363
+ run-internal : docker-build kind-cluster kind-load kind-deploy wait
355
364
356
365
CATD_NAMESPACE := olmv1-system
357
366
wait :
@@ -380,10 +389,9 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
380
389
381
390
.PHONY : quickstart
382
391
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
392
+ quickstart : export DEFAULT_CATALOGS := "https://github.com/operator-framework/operator-controller/releases/download/$(VERSION ) /default-catalogs.yaml"
393
+ quickstart : manifests # EXHELP Generate the unified installation release manifests and scripts.
394
+ envsubst ' $$DEFAULT_CATALOGS,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
387
395
388
396
# #@ Docs
389
397
0 commit comments