@@ -7,6 +7,22 @@ BUNDLE_IMG ?= quay.io/csiaddons/k8s-bundle
7
7
# set TAG to a release for consumption in the bundle
8
8
TAG ?= latest
9
9
10
+ # In case the *_IMG variables can contain a full qualified container-image
11
+ # resource (includes a ":"), the container-images should not use the TAG
12
+ # valued. The :TAG option will only be added if no predefined version is
13
+ # passed.
14
+ ifneq (findstring $(CONTROLLER_IMG ) , :)
15
+ CONTROLLER_IMG := $(CONTROLLER_IMG ) :$(TAG )
16
+ endif
17
+
18
+ ifneq (findstring $(SIDECAR_IMG ) , :)
19
+ SIDECAR_IMG := $(SIDECAR_IMG ) :$(TAG )
20
+ endif
21
+
22
+ ifneq (findstring $(BUNDLE_IMG ) , :)
23
+ BUNDLE_IMG := $(BUNDLE_IMG ) :$(TAG )
24
+ endif
25
+
10
26
# the PACKAGE_NAME is included in the bundle/CSV and is used in catalogsources
11
27
# for operators (like OperatorHub.io). Products that include the CSI-Addons
12
28
# bundle should use a different PACKAGE_NAME to prevent conflicts.
@@ -72,7 +88,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
72
88
73
89
.PHONY : bundle
74
90
bundle : kustomize operator-sdk
75
- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(CONTROLLER_IMG ) : $( TAG ) $(KUSTOMIZE_RBAC_PROXY )
91
+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(CONTROLLER_IMG ) $(KUSTOMIZE_RBAC_PROXY )
76
92
$(KUSTOMIZE ) build config/default | $(OPERATOR_SDK ) generate bundle --manifests --metadata --package=$(PACKAGE_NAME ) $(BUNDLE_VERSION )
77
93
mkdir -p ./bundle/tests/scorecard && $(KUSTOMIZE ) build config/scorecard --output=./bundle/tests/scorecard/config.yaml
78
94
@@ -114,27 +130,27 @@ run: manifests generate fmt vet ## Run a controller from your host.
114
130
115
131
.PHONY : docker-build
116
132
docker-build : test # # Build docker image with the manager.
117
- docker build -t ${CONTROLLER_IMG} : ${TAG} .
133
+ docker build -t ${CONTROLLER_IMG} .
118
134
119
135
.PHONY : docker-push
120
136
docker-push : # # Push docker image with the manager.
121
- docker push ${CONTROLLER_IMG} : ${TAG}
137
+ docker push ${CONTROLLER_IMG}
122
138
123
139
.PHONY : docker-build-sidecar
124
140
docker-build-sidecar :
125
- docker build -f ./build/Containerfile.sidecar -t ${SIDECAR_IMG} : ${TAG} .
141
+ docker build -f ./build/Containerfile.sidecar -t ${SIDECAR_IMG} .
126
142
127
143
.PHONY : docker-push-sidecar
128
144
docker-push-sidecar :
129
- docker push ${SIDECAR_IMG} : ${TAG}
145
+ docker push ${SIDECAR_IMG}
130
146
131
147
.PHONY : docker-build-bundle
132
148
docker-build-bundle : bundle
133
- docker build -f ./bundle.Dockerfile -t ${BUNDLE_IMG} : ${TAG} .
149
+ docker build -f ./bundle.Dockerfile -t ${BUNDLE_IMG} .
134
150
135
151
.PHONY : docker-push-bundle
136
152
docker-push-bundle :
137
- docker push ${BUNDLE_IMG} : ${TAG}
153
+ docker push ${BUNDLE_IMG}
138
154
139
155
# #@ Deployment
140
156
@@ -152,7 +168,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
152
168
153
169
.PHONY : deploy
154
170
deploy : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
155
- cd config/manager && $(KUSTOMIZE ) edit set image controller=${CONTROLLER_IMG} : ${TAG} $(KUSTOMIZE_RBAC_PROXY )
171
+ cd config/manager && $(KUSTOMIZE ) edit set image controller=${CONTROLLER_IMG} $(KUSTOMIZE_RBAC_PROXY )
156
172
$(KUSTOMIZE ) build config/default | kubectl apply -f -
157
173
158
174
.PHONY : undeploy
0 commit comments