forked from mehemken/k8s-admission-controllers-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (26 loc) · 806 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
###################################################
# Usage
# make <directory>:a|d
#
# a: kubectl apply -k <directory>
# d: kubectl delete -k <directory>
#
# Example:
# make gatekeeper:a
# make gatekeeper:d
#
# Note:
# When you create gatekeeper constraints you need to do it twice because it
# is a two step process. A template must exist before you can create a
# constraint. There's a race condition in that kustomization.
###################################################
.PHONY: %
%:
@if [ $(filter %:a,$(MAKECMDGOALS)) ]; then \
kubectl apply -k $(patsubst %:a,%,$(MAKECMDGOALS)); \
fi
@if [ $(filter %:d,$(MAKECMDGOALS)) ]; then \
kubectl delete -k $(patsubst %:d,%,$(MAKECMDGOALS)); \
fi
kind:
kind create cluster --name admctl --config kind-cluster.yaml