-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (93 loc) · 4.18 KB
/
Copy pathMakefile
File metadata and controls
112 lines (93 loc) · 4.18 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
CLUSTER_NAME := cruisekube-cluster
.PHONY: help test deadcode serve-docs build-docs fetch-contributors
help:
@echo "Available targets:"
@echo " test - Run tests"
@echo " deadcode - Run the pinned deadcode analysis"
@echo " help - Show this help message"
test:
@echo "Running tests..."
@go test ./...
deadcode:
@echo "Running deadcode..."
@go run golang.org/x/tools/cmd/deadcode@v0.43.0 -test ./cmd/cruisekube
serve-docs: ## Serve docs
@command -v zensical >/dev/null 2>&1 || { \
echo "zensical not found - please install it (pip install zensical)"; exit 1; } ; \
zensical serve
build-docs: ## Build docs
@command -v zensical >/dev/null 2>&1 || { \
echo "zensical not found - please install it (pip install zensical)"; exit 1; } ; \
zensical build
fetch-contributors: ## Fetch contributors
python3 docs/scripts/fetch_contributors.py
kind-up: ## Update kind cluster
@kind create cluster --name $(CLUSTER_NAME) --config=test/kind-config.yaml
install-prom: ## Install prometheus
@helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
@helm repo update prometheus-community
@helm upgrade --install prometheus \
prometheus-community/kube-prometheus-stack \
--namespace monitoring \
--create-namespace \
--set prometheus.service.type=NodePort \
--set prometheus.service.nodePort=30090 \
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
--set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false \
--set prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues=false \
--set grafana.enabled=false \
--set alertmanager.enabled=false \
--set kubeStateMetrics.enabled=true \
--set nodeExporter.enabled=true \
--set prometheusOperator.enabled=true \
--wait --timeout=150s
kind-down: ## Delete kind cluster
@kind delete cluster --name $(CLUSTER_NAME)
build-images: ## Build images
@echo "Building images..."
@docker build -t cruisekube:latest .
@kind load docker-image cruisekube:latest --name $(CLUSTER_NAME)
ick: install-ck
install-ck: ## Update helm chart
@echo "Updating helm chart..."
@helm upgrade --install cruisekube \
./charts/cruisekube \
--namespace cruisekube-system \
--create-namespace \
--set cruisekubeController.image.repository=cruisekube \
--set cruisekubeController.image.tag=latest \
--set cruisekubeController.image.pullPolicy=IfNotPresent \
--set cruisekubeController.env.CRUISEKUBE_DEPENDENCIES_INCLUSTER_PROMETHEUSURL="http://kube-prometheus-stack-prometheus.monitoring.svc.cluster.local:9090" \
--set cruisekubeController.env.CRUISEKUBE_CONTROLLER_TASKS_CREATESTATS_ENABLED=true \
--set cruisekubeWebhook.image.repository=cruisekube \
--set cruisekubeWebhook.image.tag=latest \
--set cruisekubeWebhook.image.pullPolicy=IfNotPresent \
--set cruisekubeWebhook.webhook.statsURL.host="http://cruisekube.cruisekube-system.svc.cluster.local:8080" \
--set postgresql.enabled=true \
--set cruisekubeFrontend.enabled=false \
--wait --timeout=60s
uick: uninstall-ck
uninstall-ck: ## Delete cruisekube
@echo "Deleting cruisekube..."
@helm delete cruisekube -n cruisekube-system
uninstall-prom: ## Delete prometheus
@echo "Deleting prometheus..."
@helm delete prometheus -n monitoring
POSTGRES_CONTAINER := cruisekube-postgres
.PHONY: postgres-up postgres-down
postgres-up: ## Start local postgres in docker
@docker start $(POSTGRES_CONTAINER) 2>/dev/null || docker run -d --name $(POSTGRES_CONTAINER) \
-p 5432:5432 \
-e POSTGRES_USER=cruisekube \
-e POSTGRES_PASSWORD=cruisekube \
-e POSTGRES_DB=cruisekube \
postgres:16-alpine
postgres-down: ## Stop local postgres container
@docker stop $(POSTGRES_CONTAINER) 2>/dev/null || true
@docker rm $(POSTGRES_CONTAINER) 2>/dev/null || true
.PHONY: index-helm
index-helm: ## Index helm chart
helm dependency update ./charts/cruisekube
helm package charts/cruisekube -d docs/
helm repo index docs/ --url https://github.com/truefoundry/CruiseKube/releases/download/$(RELEASE-NAME)/ --merge ./docs/index.yaml
rm -rf docs/cruisekube-*.tgz