-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
62 lines (47 loc) · 2.79 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
.DEFAULT_GOAL := argocd.install
SEALEDSECRETSVERSION=$(shell yq ". | select(.kind == \"Application\") | .spec.source.targetRevision" cluster-essentials/sealed-secrets.yaml)
ARGOCDVERSION=$(shell yq ". | select(.kind == \"Application\") | .spec.source.targetRevision" argocd-base/argocd.yaml)
.PHONY: checkPrerequisites.kubectl
checkPrerequisites.kubectl:
@command -v kubectl >/dev/null || (echo "ERROR: cannot find tool 'kubectl'"; false)
.PHONY: checkPrerequisites.helm
checkPrerequisites.helm: checkPrerequisites.kubectl
@command -v helm >/dev/null || (echo "ERROR: cannot find tool 'helm'"; false)
.PHONY: checkPrerequisites.yq
checkPrerequisites.yq:
@command -v yq >/dev/null || (echo "ERROR: cannot find tool 'yq'"; false)
.PHONY: checkPrerequisites.kubeseal
checkPrerequisites.kubeseal: checkPrerequisites.kubectl
@command -v kubeseal >/dev/null || (echo "ERROR: cannot find tool 'kubeseal'"; false)
.PHONY: checkPrerequisites.all
checkPrerequisites.all: checkPrerequisites.kubectl checkPrerequisites.helm checkPrerequisites.yq checkPrerequisites.kubeseal
.PHONY: sealed-secrets.install
sealed-secrets.install: checkPrerequisites.helm checkPrerequisites.yq
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
helm install sealed-secrets --namespace sealed-secrets --create-namespace --set-string fullnameOverride=sealed-secrets-controller --version $(SEALEDSECRETSVERSION) sealed-secrets/sealed-secrets
.PHONY: sealed-secrets.seal.sshRepoKey
sealed-secrets.seal.sshDeployKey: checkPrerequisites.kubeseal
./create-and-seal-deploy-key.sh
.PHONY: sealed-secrets.uninstall
sealed-secrets.uninstall: checkPrerequisites.helm
helm uninstall sealed-secrets --namespace sealed-secrets
.PHONY: argocd.install
argocd.install: checkPrerequisites.helm checkPrerequisites.yq
helm repo add argo https://argoproj.github.io/argo-helm
yq -r ". | select(.kind == \"Application\") | .spec.source.helm.values" argocd-base/argocd.yaml > .argocd.values.yaml
helm install argocd --namespace argocd --create-namespace --version $(ARGOCDVERSION) -f .argocd.values.yaml argo/argo-cd
kubectl create -f argocd-base/argocd-base.yaml
kubectl create -f repository.sealed.json
rm .argocd.values.yaml
.PHONY: argocd.password
argocd.password: checkPrerequisites.kubectl
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
.PHONY: argocd.port-forward
argocd.port-forward: checkPrerequisites.kubectl
kubectl port-forward svc/argocd-server -n argocd 8080:80
.PHONY: argocd.uninstall
argocd.uninstall: checkPrerequisites.helm
helm uninstall argocd-base --namespace argocd
helm uninstall argocd --namespace argocd
kubectl delete ns argocd
kubectl delete CustomResourceDefinition applications.argoproj.io applicationsets.argoproj.io appprojects.argoproj.io