1
0
Fork 0

add prune job to makefile

This commit is contained in:
Massaki Archambault 2024-07-06 17:05:18 -04:00
parent 598dd7da2b
commit 712002c6d2
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ KUBECTLFLAGS =
KUBECTLDIFFFLAGS =
KUBECTLDIFFPRINTER = highlight --out-format xterm256 --syntax diff
KUBECTLAPPLYFLAGS = --server-side --force-conflicts
KUBECTLAPPLYPRUNEFLAGS = --server-side --force-conflicts --prune
KUBECTLAPPLYPRINTER = sed -E -e 's/(.+configured)/\o033[32m\1\o033[0m/g' -e 's/(.+pruned)/\o033[31m\1\o033[0m/g'
SRC := $(shell find kustomize/ -type f)
@ -25,6 +26,10 @@ diff: $(PRODOUT)
apply: $(PRODOUT)
$(KUBECTL) $(KUBECTLFLAGS) apply $(KUBECTLAPPLYFLAGS) -l app.kubernetes.io/managed-by=kustomize -f $(PRODOUT) | $(KUBECTLAPPLYPRINTER)
.PHONY: apply-prune
apply-prune: $(PRODOUT)
$(KUBECTL) $(KUBECTLFLAGS) apply $(KUBECTLAPPLYPRUNEFLAGS) -l app.kubernetes.io/managed-by=kustomize -f $(PRODOUT) | $(KUBECTLAPPLYPRINTER)
$(PRODOUT): $(SRC)
mkdir -p $(OUT)
$(KUSTOMIZE) build $(KUSTOMIZEFLAGS) $(PRODSRC) >$(PRODOUT) || (rm $(PRODOUT); exit 1)