1313# limitations under the License.
1414
1515# Image URL to use all building/pushing image targets
16- IMG ?= gcr.io/k8s-staging-capi-ipam-ic/cluster-api-ipam-in-cluster-controller
1716TAG ?= dev
17+
18+ PROD_REGISTRY ?= registry.k8s.io/capi-ipam-ic
19+ STAGING_REGISTRY ?= gcr.io/k8s-staging-capi-ipam-ic
20+
21+ IMAGE_NAME ?= cluster-api-ipam-in-cluster-controller
22+ STAGING_IMG ?= $(STAGING_REGISTRY ) /$(IMAGE_NAME )
23+
1824# PULL_BASE_REF is set by prow and contains the git ref for a build, e.g. branch name or tag
1925RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF )
2026
@@ -101,7 +107,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
101107
102108.PHONY : docker-build
103109docker-build : licenses-report # # Build docker image with the manager.
104- ARCH=$(ARCH ) docker build --build-arg ARCH=$(ARCH ) -t $(IMG ) -$(ARCH ) :$(TAG ) .
110+ ARCH=$(ARCH ) docker build --build-arg ARCH=$(ARCH ) -t $(STAGING_IMG ) -$(ARCH ) :$(TAG ) .
105111
106112.PHONY : docker-build-all
107113docker-build-all : $(addprefix docker-build-,$(ALL_ARCH ) )
@@ -117,13 +123,13 @@ docker-push-%:
117123
118124.PHONY : docker-push
119125docker-push : # # Push docker image with the manager.
120- docker push $(IMG ) -$(ARCH ) :$(TAG )
126+ docker push $(STAGING_IMG ) -$(ARCH ) :$(TAG )
121127
122128docker-push-manifest :
123- docker manifest create --amend $(IMG ) :$(TAG ) $(shell echo $(ALL_ARCH ) | sed -e "s~[^ ]* ~$(IMG ) \-&:$(TAG ) ~g")
129+ docker manifest create --amend $(STAGING_IMG ) :$(TAG ) $(shell echo $(ALL_ARCH ) | sed -e "s~[^ ]* ~$(STAGING_IMG ) \-&:$(TAG ) ~g")
124130 @for arch in $(ALL_ARCH ) ; do docker manifest annotate --arch $$ {arch} ${IMG} :${TAG} ${IMG} -$$ {arch}:${TAG} ; done
125- docker manifest push --purge $(IMG ) :$(TAG )
126- $(MAKE ) set-manifest-image MANIFEST_IMG=$(IMG ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" ./config/default/manager_image_patch.yaml"
131+ docker manifest push --purge $(STAGING_IMG ) :$(TAG )
132+ $(MAKE ) set-manifest-image MANIFEST_IMG=$(STAGING_IMG ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" ./config/default/manager_image_patch.yaml"
127133 $(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" ./config/default/manager_pull_policy.yaml"
128134
129135
@@ -141,8 +147,7 @@ release: clean-release
141147 @if [ -z " ${RELEASE_TAG} " ]; then echo " RELEASE_TAG is not set" ; exit 1; fi
142148 @if ! [ -z " $$ (git status --porcelain)" ]; then echo " Your local git repository contains uncommitted changes, use git clean before proceeding." ; exit 1; fi
143149 git checkout " ${RELEASE_TAG} "
144- $(MAKE ) set-manifest-image MANIFEST_IMG=$(IMG ) MANIFEST_TAG=$(RELEASE_TAG )
145- $(MAKE ) set-manifest-pull-policy PULL_POLICY=IfNotPresent
150+ $(MAKE ) manifest-modification REGISTRY=$(PROD_REGISTRY )
146151 $(MAKE ) release-manifests
147152 $(MAKE ) release-metadata
148153 $(MAKE ) licenses-report
@@ -156,6 +161,11 @@ clean-release:
156161clean-release-git : # # Restores the git files usually modified during a release
157162 git restore ./* manager_image_patch.yaml
158163
164+ .PHONY : manifest-modification
165+ manifest-modification :
166+ $(MAKE ) set-manifest-image MANIFEST_IMG=$(REGISTRY ) /$(IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG )
167+ $(MAKE ) set-manifest-pull-policy PULL_POLICY=IfNotPresent
168+
159169.PHONY : release-manifests
160170release-manifests : kustomize $(RELEASE_DIR )
161171 $(KUSTOMIZE ) build config/default > $(RELEASE_DIR ) /ipam-components.yaml
@@ -166,7 +176,7 @@ release-metadata:
166176
167177.PHONY : staging-images-release-alias-tag
168178staging-images-release-alias-tag : # # Add the release alias tag to the last build tag
169- gcloud container images add-tag $(IMG ) :$(TAG ) $(IMG ) :$(RELEASE_ALIAS_TAG )
179+ gcloud container images add-tag $(STAGING_IMG ) :$(TAG ) $(STAGING_IMG ) :$(RELEASE_ALIAS_TAG )
170180
171181.PHONY : release-staging-images
172182release-staging-images : docker-build-all docker-push-all staging-images-release-alias-tag
0 commit comments