-
Notifications
You must be signed in to change notification settings - Fork 8
/
make.mk
70 lines (47 loc) · 2.36 KB
/
make.mk
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
L2DIR ?= $(PWD)
L2_NAMESPACE = monitoring
L2_DOMAIN = $(HOST)
layer2-install: helm-repo-update monitoring-ns-create prometheus-install grafana-install metrics-install
layer2-remove: prometheus-remove grafana-remove metrics-remove monitoring-ns-remove
layer2-install.%:
$(eval host := $(@:layer2-install.%=%))
$(MAKE) HOST=$(host) layer2-install || true
layer2-install-all:
$(foreach host, $(ALL_HOSTS), $(MAKE) layer2-install.$(host))
layer2-remove.%:
$(eval host := $(@:layer2-remove.%=%))
$(MAKE) HOST=$(host) layer2-remove || true
layer2-remove-all:
$(foreach host, $(ALL_HOSTS), $(MAKE) layer2-remove.$(host))
.PHONY: .PHONY helm-repo-update layer2-install layer2-remove layer2-install.% layer2-install-all layer2-remove.% layer2-remove-all layer2-check.% layer2-check
helm-repo-update:
helm repo add stable https://kubernetes-charts.storage.googleapis.com
helm repo update
monitoring-ns-create:
$(KCTL) create namespace $(L2_NAMESPACE) || true
monitoring-ns-remove:
$(KCTL) delete namespace $(L2_NAMESPACE) || true
metrics-install:
$(KC) helm upgrade --install --namespace $(L2_NAMESPACE) metrics-server stable/metrics-server
metrics-remove:
$(KC) helm delete metrics-server
.PHONY: .PHONY metrics-install metrics-remove
prometheus-install:
$(KC) helm upgrade --install --namespace $(L2_NAMESPACE) prometeus stable/prometheus -f $(L2DIR)/prometheus/values.yml \
--set "server.ingress.hosts={metrics.$(L2_DOMAIN)}"
prometheus-remove:
$(KC) helm delete prometheus
.PHONY: .PHONY prometheus-install prometheus-remove
grafana-install:
$(KC) helm upgrade --install --namespace $(L2_NAMESPACE) grafana stable/grafana -f $(L2DIR)/grafana/values.yml \
--set "ingress.hosts={status.$(L2_DOMAIN)}"
grafana-remove:
$(KC) helm delete grafana
.PHONY: .PHONY grafana-install grafana-remove
logdna-install:
$(KC) kubectl create --namespace $(L2_NAMESPACE) secret generic logdna-agent-key --from-literal=logdna-agent-key=$(shell cat $(DATADIR)/db/config/csps/secrets/logdna.key)
$(KC) kubectl apply --namespace $(L2_NAMESPACE) -f https://raw.githubusercontent.com/logdna/logdna-agent/master/logdna-agent-ds.yaml
logdna-remove:
$(KC) kubectl delete --namespace $(L2_NAMESPACE) secret logdna-agent-key
$(KC) kubectl delete --namespace $(L2_NAMESPACE) -f https://raw.githubusercontent.com/logdna/logdna-agent/master/logdna-agent-ds.yaml
.PHONY: logdna-install logdna-remove