2
2
.PHONY : release
3
3
4
4
# If CONFIG is `kind`, various defaults will be optimized for deploying locally to Kind
5
- CONFIG ?= "default"
5
+ CONFIG ?= default
6
+
7
+ # Set the Kind name (by default, it's "kind"). If you set this explicitly,
8
+ # CONFIG is automatically set to "kind" as well, overriding any existing
9
+ # setting.
10
+ ifeq ($(CONFIG ) ,kind)
11
+ KIND ?= "kind"
12
+ else
13
+ KIND ?= ""
14
+ endif
15
+ ifneq ($(KIND ) ,"")
16
+ CONFIG = kind
17
+ endif
6
18
7
19
# The GCP project ID useful to have when performing operations that require one
8
20
# (e.g. release). If you don't have gcloud, all other operations in this
@@ -157,14 +169,21 @@ manifests: controller-gen
157
169
cd manifests && \
158
170
touch kustomization.yaml && \
159
171
${KUSTOMIZE} edit add resource ../config/crd
160
- ${KUSTOMIZE} build manifests/ -o manifests/hnc-crds.yaml
161
- @echo " Building full manifest"
162
- rm manifests/kustomization.yaml
163
- cd manifests && \
164
- touch kustomization.yaml && \
165
- ${KUSTOMIZE} edit add resource ../config/default && \
166
- ${KUSTOMIZE} edit set image controller=${HNC_IMG}
167
- ${KUSTOMIZE} build manifests/ -o manifests/${HNC_IMG_NAME} .yaml
172
+ ${KUSTOMIZE} build manifests/ -o manifests/crds.yaml
173
+ @cd manifests && \
174
+ for variant in default-cc default-cm nowebhooks-cc ha-webhooks-cc ; do \
175
+ echo " Building $$ {variant} manifest" ; \
176
+ rm kustomization.yaml; \
177
+ touch kustomization.yaml && \
178
+ ${KUSTOMIZE} edit add resource ../config/variants/$$ {variant} && \
179
+ ${KUSTOMIZE} edit set image controller=${HNC_IMG} ; \
180
+ ${KUSTOMIZE} build . -o ./$$ {variant}.yaml; \
181
+ done
182
+ @echo " Creating alias and summary manifests"
183
+ @cp manifests/default-cc.yaml manifests/default.yaml
184
+ @cat manifests/nowebhooks-cc.yaml > manifests/ha.yaml
185
+ @echo " ---" >> manifests/ha.yaml
186
+ @cat manifests/ha-webhooks-cc.yaml >> manifests/ha.yaml
168
187
169
188
# Run go fmt against code
170
189
fmt :
@@ -200,14 +219,25 @@ controller-gen:
200
219
#
201
220
# We only delete the deployment if it exists before applying the manifest, because
202
221
# a) deleting the CRDs will cause all the existing CRs to be wiped away;
203
- # b) if not deleting the deployment, a new image won't be pulled unless the tag changes.
222
+ # b) if we don't delete the deployment, a new image won't be pulled unless the
223
+ # tag changes, which it frequently won't since we use the "latest" tag during
224
+ # development.
204
225
deploy : docker-push kubectl manifests
205
- -kubectl -n hnc-system delete deployment hnc-controller-manager
206
- kubectl apply -f manifests/${HNC_IMG_NAME} .yaml
226
+ -kubectl -n hnc-system delete deployment --all
227
+ kubectl apply -f manifests/default .yaml
207
228
208
229
deploy-watch :
209
230
kubectl logs -n hnc-system --follow deployment/hnc-controller-manager manager
210
231
232
+ deploy-ha : docker-push kubectl manifests
233
+ -kubectl -n hnc-system delete deployment --all
234
+ kubectl apply -f manifests/ha.yaml
235
+
236
+ ha-deploy-watch-ha :
237
+ kubectl logs -n hnc-system --follow deployment/hnc-controller-manager-ha manager
238
+
239
+ # No need to delete the HA configuration here - everything "extra" that it
240
+ # installs is in hnc-system, which gets deleted by the default manifest.
211
241
undeploy : manifests
212
242
@echo " ********************************************************************************"
213
243
@echo " ********************************************************************************"
@@ -220,15 +250,16 @@ undeploy: manifests
220
250
@echo " ********************************************************************************"
221
251
@sleep 5
222
252
@echo " Deleting all CRDs to ensure all finalizers are removed"
223
- -kubectl delete -f manifests/hnc- crds.yaml
253
+ -kubectl delete -f manifests/crds.yaml
224
254
@echo " Deleting the rest of HNC"
225
- -kubectl delete -f manifests/hnc-manager.yaml
255
+ -kubectl delete -f manifests/default.yaml
256
+ @echo Please ignore any \' not found\' errors, these are expected.
226
257
227
258
# Push the docker image
228
259
docker-push : docker-build
229
260
@echo " Pushing ${HNC_IMG} "
230
261
ifeq ($(CONFIG ) ,kind)
231
- kind load docker-image ${HNC_IMG}
262
+ kind load docker-image ${HNC_IMG} --name ${KIND}
232
263
else
233
264
docker push ${HNC_IMG}
234
265
endif
@@ -260,7 +291,7 @@ docker-push-multi: buildx-setup generate fmt vet
260
291
kind-reboot :
261
292
@echo " Warning: the 'kind' command must be in your path for this to work"
262
293
-kind delete cluster
263
- kind create cluster
294
+ kind create cluster --name ${KIND}
264
295
265
296
# Creates a local kind cluster, destroying the old one if necessary. It's not
266
297
# *necessary* to call this wih CONFIG=kind but it's not a bad idea either so
@@ -375,7 +406,7 @@ endif
375
406
@echo "Starting build."
376
407
@echo "*********************************************"
377
408
@echo "*********************************************"
378
- gcloud builds submit --config cloudbuild.yaml --no-source --substitutions=${HNC_GCB_SUBS} --timeout=30m
409
+ gcloud builds submit --config cloudbuild.yaml --no-source --substitutions=${HNC_GCB_SUBS} --timeout=60m
379
410
@echo "*********************************************"
380
411
@echo "*********************************************"
381
412
@echo "Pushing ${HNC_IMG} to ${HNC_RELEASE_IMG}"
0 commit comments