-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (51 loc) · 2.26 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
.DEFAULT_GOAL := help
LOCAL_PROJECT_NAME = local
REGISTRY_PORT = 37893
.PHONY: help
help: ## View help information
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: asdf-bootstrap
asdf-bootstrap: ## Install all tools through asdf-vm
asdf plugin-add flux2 || asdf install flux2
asdf plugin-add k3d || asdf install k3d
asdf plugin-add kubectl || asdf install kubectl
.PHONY: k8s-bootstrap
k8s-bootstrap: ## Create a Kubernetes cluster for local development
k3d cluster create $(LOCAL_PROJECT_NAME) -a 1 -p "8000:80@loadbalancer" --k3s-arg "--no-deploy=metrics-server@server:*" || echo "Cluster already exists"
sleep 3 && kubectl config use-context k3d-$(LOCAL_PROJECT_NAME)
.PHONY: flux-bootstrap
flux-bootstrap: ## Install flux and bootstrap local overlay
flux install
flux create source git cluster-management \
--url=https://github.com/dannylongeuay/cluster-management \
--branch=main
flux create kustomization bootstrap \
--source=GitRepository/cluster-management \
--path="./bootstrap/overlays/local" \
--prune=true \
--interval=30s
.PHONY: bootstrap
bootstrap: asdf-bootstrap k8s-bootstrap flux-bootstrap ## Perform all bootstrapping required for local development
.PHONY: create
create: bootstrap ## Create local development environment
@echo "Created k3d cluster and bootstrapped GitOps tools"
.PHONY: clean
clean: ## Destroy local development environment
k3d cluster delete $(LOCAL_PROJECT_NAME) || echo "No cluster found"
.PHONY: flux-bootstrap-ndsq
flux-bootstrap-ndsq: ## Install flux and bootstrap ndsquared-prod-sfo3 overlay
flux install
flux create source git cluster-management \
--url=https://github.com/dannylongeuay/cluster-management \
--branch=main
flux create kustomization bootstrap \
--source=GitRepository/cluster-management \
--path="./bootstrap/overlays/ndsquared-prod-sfo3" \
--prune=true \
--interval=30s
.PHONY: create-gitlab-secret
create-gitlab-secret: ## Create a gitlab secret to be used with the external secrets store
cp gitlab-secret.example.yaml gitlab-secret.yaml
.PHONY: apply-gitlab-secret
apply-gitlab-secret: ## Apply a gitlab secret to be used with the external secrets store
kubectl apply -f gitlab-secret.yaml