13
13
# limitations under the License.
14
14
15
15
# Image URL to use all building/pushing image targets
16
- IMG ?= gcr.io/k8s-staging-capi-ipam-ic/cluster-api-ipam-in-cluster-controller
17
16
TAG ?= 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
+
18
24
# PULL_BASE_REF is set by prow and contains the git ref for a build, e.g. branch name or tag
19
25
RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF )
20
26
@@ -101,7 +107,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
101
107
102
108
.PHONY : docker-build
103
109
docker-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 ) .
105
111
106
112
.PHONY : docker-build-all
107
113
docker-build-all : $(addprefix docker-build-,$(ALL_ARCH ) )
@@ -117,13 +123,13 @@ docker-push-%:
117
123
118
124
.PHONY : docker-push
119
125
docker-push : # # Push docker image with the manager.
120
- docker push $(IMG ) -$(ARCH ) :$(TAG )
126
+ docker push $(STAGING_IMG ) -$(ARCH ) :$(TAG )
121
127
122
128
docker-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")
124
130
@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"
127
133
$(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" ./config/default/manager_pull_policy.yaml"
128
134
129
135
@@ -141,8 +147,7 @@ release: clean-release
141
147
@if [ -z " ${RELEASE_TAG} " ]; then echo " RELEASE_TAG is not set" ; exit 1; fi
142
148
@if ! [ -z " $$ (git status --porcelain)" ]; then echo " Your local git repository contains uncommitted changes, use git clean before proceeding." ; exit 1; fi
143
149
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 )
146
151
$(MAKE ) release-manifests
147
152
$(MAKE ) release-metadata
148
153
$(MAKE ) licenses-report
@@ -156,6 +161,11 @@ clean-release:
156
161
clean-release-git : # # Restores the git files usually modified during a release
157
162
git restore ./* manager_image_patch.yaml
158
163
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
+
159
169
.PHONY : release-manifests
160
170
release-manifests : kustomize $(RELEASE_DIR )
161
171
$(KUSTOMIZE ) build config/default > $(RELEASE_DIR ) /ipam-components.yaml
@@ -166,7 +176,7 @@ release-metadata:
166
176
167
177
.PHONY : staging-images-release-alias-tag
168
178
staging-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 )
170
180
171
181
.PHONY : release-staging-images
172
182
release-staging-images : docker-build-all docker-push-all staging-images-release-alias-tag
0 commit comments