Skip to content

Commit 74e73f0

Browse files
authored
Add support for local/private container registries. (microsoft#118)
Add support for building and testing using local/private container registries.
1 parent f007076 commit 74e73f0

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,7 @@ test/e2e/junit.e2e_suite.*.xml
5555
test/e2e/logs/*
5656

5757
# generated template yamls
58-
templates/cluster-template*.yaml
58+
templates/cluster-template*.yaml
59+
60+
# Hack files
61+
/hack/config/manager_image_patch.yaml

Makefile

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ docker-login: ## Login docker to a private registry
212212
@if [ -z "${DOCKER_PASSWORD}" ]; then echo "DOCKER_PASSWORD is not set"; exit 1; fi
213213
docker login $(STAGING_REGISTRY) -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
214214

215-
.PHONY: docker-build
216-
docker-build: manager ## Build the docker image for controller-manager
215+
.PHONY: docker-build-img
216+
docker-build-img: manager
217217
#docker build --pull --build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
218218
docker build --pull --build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG):$(TAG)
219+
220+
.PHONY: docker-build
221+
docker-build: docker-build-img ## Build the docker image for controller-manager
219222
#MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image
220223
MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image
221224
$(MAKE) set-manifest-pull-policy
@@ -351,6 +354,28 @@ create-cluster:
351354
.PHONY: deployment
352355
deployment: dev-release create-cluster ## Build and deploy caph in a kind management cluster.
353356

357+
## --------------------------------------
358+
## Development: Local/private registry
359+
## --------------------------------------
360+
361+
# Create patch files to override container image registry.
362+
.PHONY: local-dev-set-manifest-image
363+
local-dev-set-manifest-image:
364+
cp ./hack/config/manager_image_patch_template.yaml ./hack/config/manager_image_patch.yaml
365+
sed -i'' -e 's@value:.*@value: '"${CONTROLLER_IMG}:$(TAG)"'@' ./hack/config/manager_image_patch.yaml
366+
367+
# Build config.
368+
.PHONY: local-dev-release-manifests
369+
local-dev-release-manifests: $(RELEASE_DIR)
370+
kustomize build ./hack/config > $(RELEASE_DIR)/infrastructure-components.yaml
371+
372+
.PHONY: local-dev-release
373+
local-dev-release:
374+
$(MAKE) docker-build-img
375+
$(MAKE) docker-push
376+
$(MAKE) local-dev-set-manifest-image
377+
$(MAKE) local-dev-release-manifests
378+
354379
## --------------------------------------
355380
## Kind
356381
## --------------------------------------

hack/config/kustomization.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bases:
2+
- ../../config
3+
4+
patchesJson6902:
5+
- target:
6+
group: apps
7+
version: v1
8+
kind: Deployment
9+
name: controller-manager
10+
path: manager_image_patch.yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- op: replace
2+
path: "/spec/template/spec/containers/0/image"
3+
value:

0 commit comments

Comments
 (0)