2323$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!)
2424endif 
2525
26- #  For standard development and release flows, we use the config/overlays/cert-manager overlay.
27- KUSTOMIZE_OVERLAY  := config/overlays/cert-manager
28- 
2926#  bingo manages consistent tooling versions for things like kind, kustomize, etc.
3027include  ./../.bingo/Variables.mk
3128
@@ -38,14 +35,6 @@ ifeq ($(origin KIND_CLUSTER_NAME), undefined)
3835KIND_CLUSTER_NAME  := catalogd
3936endif 
4037
41- #  E2E configuration
42- TESTDATA_DIR  := testdata
43- 
44- CATALOGD_NAMESPACE  := olmv1-system
45- KIND_CLUSTER_IMAGE  := kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e
46- 
47- GINKGO  := go run github.com/onsi/ginkgo/v2/ginkgo
48- 
4938# #@ General
5039
5140#  The help target prints out all targets with their descriptions organized
@@ -74,42 +63,6 @@ generate: $(CONTROLLER_GEN) ## Generate code and manifests.
7463	$(CONTROLLER_GEN )  object:headerFile=" ../hack/boilerplate.go.txt" " ./..." 
7564	$(CONTROLLER_GEN )  rbac:roleName=manager-role crd webhook paths=" ./..." 
7665
77- FOCUS  := $(if  $(TEST ) ,-v -focus "$(TEST ) ") 
78- ifeq  ($(origin E2E_FLAGS ) , undefined)
79- E2E_FLAGS  :=
80- endif 
81- test-e2e : # # Run the e2e tests on existing cluster
82- 	$(GINKGO )  $(E2E_FLAGS )  -trace -vv $(FOCUS )  test/e2e
83- 
84- e2e : KIND_CLUSTER_NAME := catalogd-e2e
85- e2e : ISSUER_KIND := Issuer
86- e2e : ISSUER_NAME := selfsigned-issuer
87- e2e : KUSTOMIZE_OVERLAY := config/overlays/e2e
88- e2e : run image-registry test-e2e kind-cluster-cleanup # # Run e2e test suite on local kind cluster
89- 
90- image-registry : # # Setup in-cluster image registry
91- 	./test/tools/imageregistry/registry.sh $(ISSUER_KIND )  $(ISSUER_NAME ) 
92- 
93- # # image-registry target has to come after run-latest-release,
94- # # because the image-registry depends on the olm-ca issuer.
95- .PHONY : test-upgrade-e2e
96- test-upgrade-e2e : export TEST_CLUSTER_CATALOG_NAME := test-catalog
97- test-upgrade-e2e : export TEST_CLUSTER_CATALOG_IMAGE := docker-registry.catalogd-e2e.svc:5000/test-catalog:e2e
98- test-upgrade-e2e : ISSUER_KIND=ClusterIssuer
99- test-upgrade-e2e : ISSUER_NAME=olmv1-ca
100- test-upgrade-e2e : kind-cluster cert-manager build-container kind-load run-latest-release image-registry pre-upgrade-setup only-deploy-manifest wait post-upgrade-checks kind-cluster-cleanup # # Run upgrade e2e tests on a local kind cluster
101- 
102- pre-upgrade-setup :
103- 	./test/tools/imageregistry/pre-upgrade-setup.sh ${TEST_CLUSTER_CATALOG_IMAGE}  ${TEST_CLUSTER_CATALOG_NAME} 
104- 
105- .PHONY : run-latest-release
106- run-latest-release :
107- 	cd  ..;  curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/install.sh |  bash -s
108- 
109- .PHONY : post-upgrade-checks
110- post-upgrade-checks :
111- 	$(GINKGO )  $(E2E_FLAGS )  -trace -vv $(FOCUS )  test/upgrade
112- 
11366# #@ Build
11467
11568BINARIES =catalogd
@@ -157,63 +110,17 @@ $(LINUX_BINARIES): BUILDBIN = bin/linux
157110$(LINUX_BINARIES ) 
158111	GOOS=linux $(BUILDCMD ) 
159112
160- 
161- .PHONY : run
162- run : generate kind-cluster install # # Create a kind cluster and install a local build of catalogd
163- 
164113.PHONY : build-container
165114build-container : build-linux # # Build docker image for catalogd.
166115	$(CONTAINER_RUNTIME )  build -f Dockerfile -t $(IMAGE )  ./bin/linux
167116
168- # #@ Deploy
169- 
170- .PHONY : kind-cluster
171- kind-cluster : $(KIND )  kind-cluster-cleanup # # Standup a kind cluster
172- 	$(KIND )  create cluster --name $(KIND_CLUSTER_NAME )  --image $(KIND_CLUSTER_IMAGE ) 
173- 	$(KIND )  export  kubeconfig --name $(KIND_CLUSTER_NAME ) 
174- 
175- .PHONY : kind-cluster-cleanup
176- kind-cluster-cleanup : $(KIND )  # # Delete the kind cluster
177- 	$(KIND )  delete cluster --name $(KIND_CLUSTER_NAME ) 
178- 
179117.PHONY : kind-load
180- kind-load : check-cluster  $(KIND )  # # Load the built images onto the local cluster
118+ kind-load : $(KIND )  # # Load the built images onto the local cluster
181119	$(CONTAINER_RUNTIME )  save $(IMAGE )  |  $(KIND )  load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME ) 
182120
183- .PHONY : install
184- install : check-cluster build-container kind-load deploy wait # # Install local catalogd to an existing cluster
185- 
186- .PHONY : deploy
187- deploy : export MANIFEST="./catalogd.yaml"
188- deploy : export DEFAULT_CATALOGS="./config/base/default/clustercatalogs/default-catalogs.yaml"
189- deploy : $(KUSTOMIZE )  # # Deploy Catalogd to the K8s cluster specified in ~/.kube/config with cert-manager and default clustercatalogs
190- 	cd  config/base/manager &&  $(KUSTOMIZE )  edit set  image controller=$(IMAGE )  &&  cd  ../../..
191- 	$(KUSTOMIZE )  build $(KUSTOMIZE_OVERLAY )  |  sed " s/cert-git-version/cert-$( GIT_VERSION) " >  catalogd.yaml
192- 	envsubst ' $$CERT_MGR_VERSION,$$MANIFEST,$$DEFAULT_CATALOGS' <  scripts/install.tpl.sh |  bash -s
193- 
194- .PHONY : only-deploy-manifest
195- only-deploy-manifest : $(KUSTOMIZE )  # # Deploy just the Catalogd manifest--used in e2e testing where cert-manager is installed in a separate step
196- 	cd  config/base/manager &&  $(KUSTOMIZE )  edit set  image controller=$(IMAGE ) 
197- 	$(KUSTOMIZE )  build $(KUSTOMIZE_OVERLAY )  |  kubectl apply -f -
198- 
199- wait :
200- 	kubectl wait  --for=condition=Available --namespace=$(CATALOGD_NAMESPACE )  deployment/catalogd-controller-manager --timeout=60s
201- 	kubectl wait  --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE )  certificate/catalogd-service-cert #  Avoid upgrade test flakes when reissuing cert
202- 
203- 
204- .PHONY : cert-manager
205- cert-manager :
206- 	kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/${CERT_MGR_VERSION} /cert-manager.yaml
207- 	kubectl wait  --for=condition=Available --namespace=cert-manager deployment/cert-manager-webhook --timeout=60s
121+ # #@ Deploy
208122
209123#  The demo script requires to install asciinema with: brew install asciinema to run on mac os envs.
210124.PHONY : demo-update # HELP build demo
211125demo-update :
212126	hack/scripts/generate-asciidemo.sh
213- 
214- .PHONY : check-cluster
215- check-cluster :
216- 	@kubectl config current-context > /dev/null 2>&1  ||  ( \
217- 		echo  " Error: Could not get current Kubernetes context. Maybe use 'run' or 'e2e' targets first?" ;  \ 
218- 		exit  1;  \ 
219- 	)
0 commit comments