@@ -60,6 +60,12 @@ KRP_IMAGE_BASE ?= quay.io/brancz/kube-rbac-proxy
6060# kube-rbac-proxy image tag
6161KRP_IMAGE_TAG ?= v0.18.0
6262
63+ # image pull secret name: eg regcred
64+ IMAGE_PULL_SECRET_NAME ?=
65+
66+ image_pull_secrets_patch = $(shell printf '[{"op":"add","path":"/spec/template/spec/imagePullSecrets","value":[{"name":"% s"}]}]' '$(strip $(IMAGE_PULL_SECRET_NAME ) ) ' )
67+
68+
6369.PHONY : all
6470all : docker-build
6571
@@ -125,6 +131,7 @@ uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube
125131deploy : kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
126132 cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
127133 cd config/default && $(KUSTOMIZE ) edit set image kube-rbac-proxy=$(KRP_IMAGE_BASE ) :$(KRP_IMAGE_TAG )
134+ if [ -n " $( IMAGE_PULL_SECRET_NAME) " ]; then cd config/default && $( KUSTOMIZE) edit add patch --kind Deployment --group apps --version v1 --name controller-manager --patch ' ${image_pull_secrets_patch}' ; fi
128135 $(KUSTOMIZE ) build config/default | kubectl apply -f -
129136
130137.PHONY : undeploy
@@ -188,6 +195,7 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v
188195 cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
189196 cd config/manifests/bases && $(KUSTOMIZE ) edit set annotation containerImage:$(IMG )
190197 cd config/default && $(KUSTOMIZE ) edit set image kube-rbac-proxy=$(KRP_IMAGE_BASE ) :$(KRP_IMAGE_TAG )
198+ if [ -n " $( IMAGE_PULL_SECRET_NAME) " ]; then cd config/default && $( KUSTOMIZE) edit add patch --kind Deployment --group apps --version v1 --name controller-manager --patch ' ${image_pull_secrets_patch}' ; fi
191199 $(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
192200 @printf " %s\n" ' ' ' LABEL com.redhat.openshift.versions="v4.12"' ' LABEL com.redhat.delivery.operator.bundle=true' ' LABEL com.redhat.delivery.backport=true' >> bundle.Dockerfile
193201 @printf " %s\n" ' ' ' # OpenShift annotations.' ' com.redhat.openshift.versions: v4.12' >> bundle/metadata/annotations.yaml
@@ -240,3 +248,4 @@ catalog-build: opm ## Build a catalog image.
240248.PHONY : catalog-push
241249catalog-push : # # Push a catalog image.
242250 $(MAKE ) docker-push IMG=$(CATALOG_IMG )
251+
0 commit comments