Skip to content

Commit e4bcb06

Browse files
authored
Merge pull request #231 from kubernetes-sigs/fix/manifests-image-registry
🌱 use registry.k8s.io image in release manifests
2 parents c5624e5 + 83566d6 commit e4bcb06

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

Makefile

+19-9
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
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
1716
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+
1824
# PULL_BASE_REF is set by prow and contains the git ref for a build, e.g. branch name or tag
1925
RELEASE_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
103109
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) .
105111

106112
.PHONY: docker-build-all
107113
docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))
@@ -117,13 +123,13 @@ docker-push-%:
117123

118124
.PHONY: docker-push
119125
docker-push: ## Push docker image with the manager.
120-
docker push $(IMG)-$(ARCH):$(TAG)
126+
docker push $(STAGING_IMG)-$(ARCH):$(TAG)
121127

122128
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")
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:
156161
clean-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
160170
release-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
168178
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)
170180

171181
.PHONY: release-staging-images
172182
release-staging-images: docker-build-all docker-push-all staging-images-release-alias-tag

config/default/manager_image_patch.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ spec:
77
template:
88
spec:
99
containers:
10-
- image: ghcr.io/telekom/cluster-api-ipam-provider-in-cluster:main
10+
- name: manager
11+
image: gcr.io/k8s-staging-capi-ipam-ic/cluster-api-ipam-in-cluster-controller:dev
1112
imagePullPolicy: Always
12-
name: manager

0 commit comments

Comments
 (0)