-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (73 loc) · 3.25 KB
/
Makefile
File metadata and controls
91 lines (73 loc) · 3.25 KB
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
85
86
87
88
89
90
91
.PHONY: help helm-repo install uninstall status apply-monitoring apply-mock delete-mock port-forward-grafana port-forward-prometheus lint cli-build cli-run
# Defaults (override via env): RELEASE=kps NAMESPACE=monitoring
RELEASE ?= kps
NAMESPACE ?= monitoring
VALUES ?= values/kube-prometheus-stack.yaml
CHART ?= prometheus-community/kube-prometheus-stack
CHART_VERSION ?=
help:
@echo "Targets:"
@echo " helm-repo Add/update Helm repos"
@echo " install Install/upgrade kube-prometheus-stack"
@echo " uninstall Uninstall kube-prometheus-stack"
@echo " status Show monitoring namespace pods"
@echo " apply-monitoring Apply ServiceMonitor and Grafana dashboards"
@echo " apply-mock Deploy mock pine-gate (for dev)"
@echo " delete-mock Remove mock pine-gate"
@echo " port-forward-grafana Port-forward Grafana to :3000"
@echo " port-forward-prometheus Port-forward Prometheus to :9090"
@echo " chart-deps Build Helm chart dependencies for chashma"
@echo " chart-install Install chashma umbrella chart"
@echo " chart-package Package chashma chart to ./dist"
@echo " cli-build Build chashma CLI binary"
@echo " cli-run Run chashma CLI from source (go run)"
@echo " cli-version Print CLI version (build-time)"
@echo " release-dry-run Run goreleaser in snapshot mode"
helm-repo:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts || true
helm repo update
install: helm-repo
kubectl get ns $(NAMESPACE) >/dev/null 2>&1 || kubectl create ns $(NAMESPACE)
@if [ -n "$(CHART_VERSION)" ]; then \
helm upgrade --install $(RELEASE) $(CHART) \
--namespace $(NAMESPACE) --create-namespace \
--version $(CHART_VERSION) \
--values $(VALUES); \
else \
helm upgrade --install $(RELEASE) $(CHART) \
--namespace $(NAMESPACE) --create-namespace \
--values $(VALUES); \
fi
uninstall:
helm uninstall $(RELEASE) -n $(NAMESPACE) || true
status:
kubectl -n $(NAMESPACE) get pods -o wide
apply-monitoring:
kubectl apply -f manifests/monitoring/
apply-mock:
kubectl apply -f manifests/monitoring/mock-pine-gate.yaml
delete-mock:
kubectl delete -f manifests/monitoring/mock-pine-gate.yaml || true
port-forward-grafana:
kubectl -n $(NAMESPACE) port-forward svc/$(RELEASE)-grafana 3000:80
port-forward-prometheus:
kubectl -n $(NAMESPACE) port-forward svc/$(RELEASE)-kube-prometheus-stack-prometheus 9090:9090
chart-deps:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts || true
helm repo add nvidia-dcgm https://nvidia.github.io/dcgm-exporter/helm-charts || true
helm repo update
helm dependency update charts/chashma
chart-install: chart-deps
helm upgrade --install chashma charts/chashma -n $(NAMESPACE) --create-namespace
chart-package:
mkdir -p dist
helm dependency update charts/chashma
helm package charts/chashma -d dist
cli-build:
go build -o bin/chashma ./cmd/chashma
cli-run:
go run ./cmd/chashma --help
cli-version:
go run -ldflags "-X github.com/amanycoes/chashma/internal/cmd.Version=dev-local" ./cmd/chashma version
release-dry-run:
goreleaser release --snapshot --skip-publish --clean