-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
26 lines (19 loc) · 1007 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
NAMESPACE := fortigate-exporter
FORTIGATE_EXPORTER_SECRET = $(shell printf "$(URL):\n token: $(FORTIGATE_API_TOKEN)" | base64)
include fortigate.env
all: prep deployment servicemonitor
prep:
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
deployment:
printf '%s' "$$(cat secret.yml | sed 's|{{FORTIGATE_EXPORTER_SECRET}}|$(FORTIGATE_EXPORTER_SECRET)|g')" | kubectl -n $(NAMESPACE) apply -f -
kubectl -n $(NAMESPACE) apply -f deployment.yml
kubectl -n $(NAMESPACE) apply -f service.yml
servicemonitor:
printf '%s' "$$(cat serviceMonitor.yml | sed 's|{{URL}}|$(URL)|g')" | kubectl apply -f -
delete:
@echo
kubectl -n $(NAMESPACE) delete secret fortigate-credentials --ignore-not-found=true
kubectl -n $(NAMESPACE) delete -f deployment.yml --ignore-not-found=true
kubectl -n $(NAMESPACE) delete -f service.yml --ignore-not-found=true
kubectl -n $(NAMESPACE) delete servicemonitor fortigate-exporter --ignore-not-found=true
kubectl delete ns $(NAMESPACE)