@@ -58,6 +58,9 @@ CRD_ROOT ?= $(MANIFEST_ROOT)/crd/bases
5858WEBHOOK_ROOT ?= $(MANIFEST_ROOT ) /webhook
5959RBAC_ROOT ?= $(MANIFEST_ROOT ) /rbac
6060
61+ # Allow overriding the imagePullPolicy
62+ PULL_POLICY ?= Always
63+
6164# # --------------------------------------
6265# # Help
6366# # --------------------------------------
@@ -79,7 +82,8 @@ test-integration: ## Run integration tests
7982
8083.PHONY : test-e2e
8184test-e2e : # # Run e2e tests
82- go test -v -tags=e2e ./test/e2e/...
85+ PULL_POLICY=IfNotPresent $(MAKE ) docker-build
86+ go test -v -tags=e2e -timeout=1h ./test/e2e/... -args --managerImage $(CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
8387
8488# # --------------------------------------
8589# # Binaries
@@ -111,6 +115,8 @@ $(MOCKGEN): $(TOOLS_DIR)/go.mod # Build mockgen from tools folder.
111115$(CONVERSION_GEN ) : $(TOOLS_DIR ) /go.mod
112116 cd $(TOOLS_DIR ) ; go build -tags=tools -o $(BIN_DIR ) /conversion-gen k8s.io/code-generator/cmd/conversion-gen
113117
118+ $(RELEASE_NOTES ) : $(TOOLS_DIR ) /go.mod
119+ cd $(TOOLS_DIR ) && go build -tags tools -o $(BIN_DIR ) /release-notes sigs.k8s.io/cluster-api/hack/tools/release
114120
115121# # --------------------------------------
116122# # Linting
@@ -174,6 +180,7 @@ generate-examples: clean-examples ## Generate examples configurations to run a c
174180docker-build : # # Build the docker image for controller-manager
175181 docker build --pull --build-arg ARCH=$(ARCH ) . -t $(CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
176182 MANIFEST_IMG=$(CONTROLLER_IMG ) -$(ARCH ) MANIFEST_TAG=$(TAG ) $(MAKE ) set-manifest-image
183+ $(MAKE ) set-manifest-pull-policy
177184
178185.PHONY : docker-push
179186docker-push : # # Push the docker image
@@ -203,12 +210,18 @@ docker-push-manifest: ## Push the fat manifest docker image.
203210 @for arch in $(ALL_ARCH ) ; do docker manifest annotate --arch $$ {arch} ${CONTROLLER_IMG} :${TAG} ${CONTROLLER_IMG} -$$ {arch}:${TAG} ; done
204211 docker manifest push --purge ${CONTROLLER_IMG} :${TAG}
205212 MANIFEST_IMG=$(CONTROLLER_IMG ) MANIFEST_TAG=$(TAG ) $(MAKE ) set-manifest-image
213+ $(MAKE ) set-manifest-pull-policy
206214
207215.PHONY : set-manifest-image
208216set-manifest-image :
209217 $(info Updating kustomize image patch file for manager resource)
210218 sed -i' ' -e ' s@image: .*@image: ' " ${MANIFEST_IMG} :$( MANIFEST_TAG) " ' @' ./config/default/manager_image_patch.yaml
211219
220+ .PHONY : set-manifest-pull-policy
221+ set-manifest-pull-policy :
222+ $(info Updating kustomize pull policy file for manager resource)
223+ sed -i' ' -e ' s@imagePullPolicy: .*@imagePullPolicy: ' " $( PULL_POLICY) " ' @' ./config/default/manager_pull_policy.yaml
224+
212225# # --------------------------------------
213226# # Release
214227# # --------------------------------------
@@ -228,6 +241,7 @@ release: clean-release ## Builds and push container images using the latest git
228241 # Set the manifest image to the production bucket.
229242 MANIFEST_IMG=$(PROD_REGISTRY ) /$(IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG ) \
230243 $(MAKE ) set-manifest-image
244+ PULL_POLICY=IfNotPresent $(MAKE ) set-manifest-pull-policy
231245 $(MAKE ) release-manifests
232246
233247.PHONY : release-manifests
@@ -249,29 +263,45 @@ release-binary: $(RELEASE_DIR)
249263
250264.PHONY : release-staging
251265release-staging : # # Builds and push container images to the staging bucket.
252- REGISTRY=$(STAGING_REGISTRY ) $(MAKE ) docker-build-all docker-push-all release-tag-latest
266+ REGISTRY=$(STAGING_REGISTRY ) $(MAKE ) docker-build-all docker-push-all release-alias-tag
267+
268+ RELEASE_ALIAS_TAG =$(shell if [ "$(PULL_BASE_REF ) " = "master" ]; then echo "latest"; else echo "$(PULL_BASE_REF ) "; fi)
253269
270+ .PHONY : release-alias-tag
271+ release-alias-tag : # Adds the tag to the last build tag.
272+ gcloud container images add-tag $(CONTROLLER_IMG ) :$(TAG ) $(CONTROLLER_IMG ) :$(RELEASE_ALIAS_TAG )
254273
255- .PHONY : release-tag-latest
256- release-tag-latest : # # Adds the latest tag to the last build tag.
257- # # TODO(vincepri): Only do this when we're on master.
258- gcloud container images add-tag $(CONTROLLER_IMG ) :$(TAG ) $(CONTROLLER_IMG ) :latest
274+ .PHONY : release-notes
275+ release-notes : $(RELEASE_NOTES )
276+ $(RELEASE_NOTES )
259277
260278# # --------------------------------------
261279# # Development
262280# # --------------------------------------
263281
282+ # TODO: Uncomment this once we've enabled image building: https://github.com/kubernetes-sigs/image-builder/pull/49
283+ # Addons (CNI) currently fail to deploy, likely due to a timeout with API server availability.
284+ # Without a pre-built image, capz takes longer for the control plane to come up.
285+ # In the meantime, we'll use a `postKubeadmCommands` in controlplane-0 (examples/controlplane/controlplane.yaml).
286+ # Please also remove that command once we confirm the create-cluster target works again.
264287.PHONY : create-cluster
265- create-cluster : $(CLUSTERCTL ) # # Create a development Kubernetes cluster on Azure using examples
266- $(CLUSTERCTL ) \
288+ # create-cluster: $(CLUSTERCTL) ## Create a development Kubernetes cluster on Azure using examples
289+ # $(CLUSTERCTL) \
267290 create cluster -v 4 \
268291 --bootstrap-flags="name=clusterapi" \
269292 --bootstrap-type kind \
270293 -m ./examples/_out/controlplane.yaml \
271294 -c ./examples/_out/cluster.yaml \
272295 -p ./examples/_out/provider-components.yaml \
273296 -a ./examples/addons.yaml
274-
297+ create-cluster : $(CLUSTERCTL ) # # Create a development Kubernetes cluster on Azure using examples
298+ $(CLUSTERCTL ) \
299+ create cluster -v 4 \
300+ --bootstrap-flags=" name=clusterapi" \
301+ --bootstrap-type kind \
302+ -m ./examples/_out/controlplane.yaml \
303+ -c ./examples/_out/cluster.yaml \
304+ -p ./examples/_out/provider-components.yaml
275305
276306.PHONY : create-cluster-management
277307create-cluster-management : $(CLUSTERCTL ) # # Create a development Kubernetes cluster on Azure in a KIND management cluster.
0 commit comments