Skip to content

Commit

Permalink
Merge pull request #174 from mintel/INFRA-32499-support-helm-chart-pa…
Browse files Browse the repository at this point in the history
…tches

INFRA-32499: Add pre-rendering Helm chart patching support to Tanka repos
  • Loading branch information
bcbrockway authored Dec 5, 2023
2 parents d5b1b47 + 4f17de4 commit 54a3390
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions modules/k8s/Makefile.tanka
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ endif

TK_APPLY_FLAGS ?= --apply-strategy=server --force

.PHONY: k8s/tanka/fmt k8s/tanka/fmt-test k8s/tanka/generate k8s/tanka/generate/% k8s/tanka/apply/% k8s/tanka/delete/% k8s/tanka/update-chart/% k8s/tanka/new-app/%
.PHONY: k8s/tanka/charts/vendor k8s/tanka/charts/patch k8s/tanka/fmt k8s/tanka/fmt-test k8s/tanka/generate k8s/tanka/generate/% k8s/tanka/apply/% k8s/tanka/delete/% k8s/tanka/update-chart/% k8s/tanka/new-app/%

## Vendor charts
k8s/tanka/vendor/charts:
k8s/tanka/charts/vendor:
ifneq ("$(wildcard ./chartfile.yaml)", "")
ifdef ALWAYS_VENDOR_CHARTS
@IFS=',' read -ra ADDR <<< "${ALWAYS_VENDOR_CHARTS}"; \
Expand All @@ -23,6 +23,16 @@ endif
@tk tool charts vendor
endif

## Check if there are any patch files in the charts/ directory and apply them to the relevant charts
k8s/tanka/charts/patch:
ifneq ("$(wildcard ./charts)", "")
ifneq ("$(wildcard ./charts/*.patch)", "")
@for f in charts/*.patch; do \
patch -d charts -p0 < $$f; \
done
endif
endif

## Update Helm Chart
k8s/tanka/update-chart/%:
@@${BUILD_HARNESS_EXTENSIONS_PATH}/modules/k8s/tanka/update-helm-chart.sh $*
Expand All @@ -36,11 +46,11 @@ k8s/tanka/fmt-test: satoshi/check-deps
tk fmt --test .

## Generate manifests using tanka
k8s/tanka/generate: satoshi/check-deps jsonnet/install k8s/tanka/vendor/charts
k8s/tanka/generate: satoshi/check-deps jsonnet/install k8s/tanka/charts/vendor k8s/tanka/charts/patch
@@${BUILD_HARNESS_EXTENSIONS_PATH}/modules/k8s/tanka/generate.sh $(GENERATE_ARGS)

## Generate manifests of specific app using tanka
k8s/tanka/generate/%: satoshi/check-deps jsonnet/install k8s/tanka/vendor/charts
k8s/tanka/generate/%: satoshi/check-deps jsonnet/install k8s/tanka/charts/vendor
@@${BUILD_HARNESS_EXTENSIONS_PATH}/modules/k8s/tanka/generate.sh --app $*

## Apply rendered manifests of an app to the local cluster
Expand Down

0 comments on commit 54a3390

Please sign in to comment.