@@ -60,6 +60,12 @@ KRP_IMAGE_BASE ?= quay.io/brancz/kube-rbac-proxy
60
60
# kube-rbac-proxy image tag
61
61
KRP_IMAGE_TAG ?= v0.18.0
62
62
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
+
63
69
.PHONY : all
64
70
all : docker-build
65
71
@@ -125,6 +131,7 @@ uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube
125
131
deploy : kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
126
132
cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
127
133
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
128
135
$(KUSTOMIZE ) build config/default | kubectl apply -f -
129
136
130
137
.PHONY : undeploy
@@ -188,6 +195,7 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v
188
195
cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
189
196
cd config/manifests/bases && $(KUSTOMIZE ) edit set annotation containerImage:$(IMG )
190
197
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
191
199
$(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
192
200
@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
193
201
@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.
240
248
.PHONY : catalog-push
241
249
catalog-push : # # Push a catalog image.
242
250
$(MAKE ) docker-push IMG=$(CATALOG_IMG )
251
+
0 commit comments