Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image substitutions in kustomization instead of doing a patch #617

Merged
merged 2 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ bases:
- ../manager
- ../server
- ../server-rbac

patchesStrategicMerge:
- manager_image.yaml
- server_image.yaml
12 changes: 0 additions & 12 deletions config/default/manager_image.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions config/default/server_image.yaml

This file was deleted.

21 changes: 7 additions & 14 deletions kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Generate
## --------------------------------------

PHONY: generate
.PHONY: generate
generate: generate-go generate-manifests # Generate code, manifests etc.

.PHONY: generate-go
Expand Down Expand Up @@ -40,25 +40,18 @@ generate-server-rbacs: bin/controller-gen
rbac:roleName=server-role
prettier --write ./config/server-rbac/

REGISTRY ?= quay.io/tinkerbell
TINK_SERVER_IMAGE_NAME ?= tink-server
TINK_CONTROLLER_IMAGE_NAME ?= tink-controller
TINK_SERVER_IMAGE_TAG ?= latest
TINK_CONTROLLER_IMAGE_TAG ?= latest

out/release/default/manager_image.yaml: config/default/manager_image.yaml out/release/default/kustomization.yaml
out/release/default/manager_image.yaml: TAG=$(REGISTRY)/$(TINK_CONTROLLER_IMAGE_NAME):$(TINK_CONTROLLER_IMAGE_TAG)
out/release/default/server_image.yaml: config/default/server_image.yaml out/release/default/kustomization.yaml
out/release/default/server_image.yaml: TAG=$(REGISTRY)/$(TINK_SERVER_IMAGE_NAME):$(TINK_SERVER_IMAGE_TAG)
out/release/default/manager_image.yaml out/release/default/server_image.yaml:
sed -e 's|image: .*|image: "$(TAG)"|' $^ >$@
TINK_SERVER_IMAGE ?= quay.io/tinkerbell/tink-server
TINK_CONTROLLER_IMAGE ?= quay.io/tinkerbell/tink-controller
TINK_SERVER_TAG ?= latest
TINK_CONTROLLER_TAG ?= latest

out/release/default/kustomization.yaml: config/default/kustomization.yaml
rm -rf out/
mkdir -p out/
cp -a config/ out/release/

out/release/tink.yaml: bin/kustomize generate-manifests out/release/default/manager_image.yaml out/release/default/manager_image.yaml
out/release/tink.yaml: bin/kustomize generate-manifests out/release/default/kustomization.yaml
(cd out/release/default && kustomize edit set image server=$(TINK_SERVER_IMAGE):$(TINK_CONTROLLER_TAG) controller=$(TINK_CONTROLLER_IMAGE):$(TINK_CONTROLLER_TAG))
kustomize build out/release/default -o $@
prettier --write $@

Expand Down