-
Notifications
You must be signed in to change notification settings - Fork 97
/
Makefile
84 lines (68 loc) · 2.28 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PHONY: test
test:
@echo "\n🛠️ Running unit tests..."
go test ./...
.PHONY: build
build:
@echo "\n🔧 Building Go binaries..."
GOOS=darwin GOARCH=amd64 go build -o bin/admission-webhook-darwin-amd64 .
GOOS=linux GOARCH=amd64 go build -o bin/admission-webhook-linux-amd64 .
.PHONY: docker-build
docker-build:
@echo "\n📦 Building simple-kubernetes-webhook Docker image..."
docker build -t simple-kubernetes-webhook:latest .
# From this point `kind` is required
.PHONY: cluster
cluster:
@echo "\n🔧 Creating Kubernetes cluster..."
kind create cluster --config dev/manifests/kind/kind.cluster.yaml
.PHONY: delete-cluster
delete-cluster:
@echo "\n♻️ Deleting Kubernetes cluster..."
kind delete cluster
.PHONY: push
push: docker-build
@echo "\n📦 Pushing admission-webhook image into Kind's Docker daemon..."
kind load docker-image simple-kubernetes-webhook:latest
.PHONY: deploy-config
deploy-config:
@echo "\n⚙️ Applying cluster config..."
kubectl apply -f dev/manifests/cluster-config/
.PHONY: delete-config
delete-config:
@echo "\n♻️ Deleting Kubernetes cluster config..."
kubectl delete -f dev/manifests/cluster-config/
.PHONY: deploy
deploy: push delete deploy-config
@echo "\n🚀 Deploying simple-kubernetes-webhook..."
kubectl apply -f dev/manifests/webhook/
.PHONY: delete
delete:
@echo "\n♻️ Deleting simple-kubernetes-webhook deployment if existing..."
kubectl delete -f dev/manifests/webhook/ || true
.PHONY: pod
pod:
@echo "\n🚀 Deploying test pod..."
kubectl apply -f dev/manifests/pods/lifespan-seven.pod.yaml
.PHONY: delete-pod
delete-pod:
@echo "\n♻️ Deleting test pod..."
kubectl delete -f dev/manifests/pods/lifespan-seven.pod.yaml
.PHONY: bad-pod
bad-pod:
@echo "\n🚀 Deploying \"bad\" pod..."
kubectl apply -f dev/manifests/pods/bad-name.pod.yaml
.PHONY: delete-bad-pod
delete-bad-pod:
@echo "\n🚀 Deleting \"bad\" pod..."
kubectl delete -f dev/manifests/pods/bad-name.pod.yaml
.PHONY: taint
taint:
@echo "\n🎨 Taining Kubernetes node.."
kubectl taint nodes kind-control-plane "acme.com/lifespan-remaining"=4:NoSchedule
.PHONY: logs
logs:
@echo "\n🔍 Streaming simple-kubernetes-webhook logs..."
kubectl logs -l app=simple-kubernetes-webhook -f
.PHONY: delete-all
delete-all: delete delete-config delete-pod delete-bad-pod