Skip to content

Commit 72c75ca

Browse files
author
Jim Ryan
authored
add image pull secret name variable to makefile (#359)
* add image pull secret name to makefile * add kustomize command to the deploy makefile target * add image_pull_secret_name to docs * move image pull secrets patch further up in makefile
1 parent 81338d9 commit 72c75ca

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ KRP_IMAGE_BASE ?= quay.io/brancz/kube-rbac-proxy
6060
# kube-rbac-proxy image tag
6161
KRP_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
6470
all: docker-build
6571

@@ -125,6 +131,7 @@ uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube
125131
deploy: 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
241249
catalog-push: ## Push a catalog image.
242250
$(MAKE) docker-push IMG=$(CATALOG_IMG)
251+

docs/manual-installation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ You can use the operator (including the kube-rbac-proxy) images from your own pr
5858
```shell
5959
make deploy IMG=<my-private-registry>/nginx-ingress-operator:2.3.1 KRP_IMAGE_BASE=<my-private-registry>/kube-rbac-proxy
6060
```
61-
**Note: If you need to use a different `kube-rbac-proxy` version than the default, use the `KRP_IMAGE_TAG` variable**
61+
**Note: If you need to use a different `kube-rbac-proxy` version than the default, use the `KRP_IMAGE_TAG` variable**
62+
**Note: To use an image pull secret, you can specify the IMAGE_PULL_SECRET_NAME variable, eg IMAGE_PULL_SECRET_NAME=regcred**

0 commit comments

Comments
 (0)