File tree 1 file changed +58
-0
lines changed
1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/variant
2
+ # vim:set ft=yaml
3
+
4
+ mixins:
5
+ # Exit on all errors
6
+ exit_on_errors: &exit_on_errors
7
+ set -e
8
+
9
+ # Default runner
10
+ runner: &runner
11
+ command: "bash"
12
+ args: ["-ex", "-c"]
13
+
14
+ tasks:
15
+ tiller:
16
+ # Write out kubecfg
17
+ description: "Commands that operate on the helm tiller"
18
+ tasks:
19
+ install:
20
+ description: "Install the helm tiller"
21
+ parameters:
22
+ - name: namespace
23
+ description: "Namespace to install tiller"
24
+ default: "kube-system"
25
+ type: string
26
+ required: false
27
+ - name: rbac-enabled
28
+ description: "Enable RBAC"
29
+ default: true
30
+ type: boolean
31
+ required: false
32
+ script:
33
+ - *exit_on_errors
34
+ - |
35
+ if [[ {{ get "rbac_enabled" }} == "true" ]]; then
36
+ echo "Enabled Tiller with RBAC"
37
+ kubectl get -n {{ get "namespace" }} serviceaccount tiller > /dev/null 2>&1 || \
38
+ kubectl -n {{ get "namespace" }} create serviceaccount tiller;
39
+ kubectl get -n {{ get "namespace" }} clusterrolebinding tiller > /dev/null 2>&1 || \
40
+ kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount={{ get "namespace" }}:tiller;
41
+ helm init --tiller-namespace={{ get "namespace" }} --history-max 200 --service-account tiller --upgrade --wait;
42
+ else
43
+ echo "Enabled Tiller without RBAC"
44
+ helm init --tiller-namespace={{ get "namespace" }} --history-max 200 --upgrade --wait;
45
+ fi
46
+ uninstall:
47
+ description: "Uninstall the helm tiller"
48
+ - name: namespace
49
+ description: "tiller's namespace"
50
+ default: "kube-system"
51
+ type: string
52
+ required: false
53
+ script:
54
+ - *exit_on_errors
55
+ - |
56
+ kubectl -n {{ get "namespace" }} delete deployment tiller-deploy
57
+ kubectl delete clusterrolebinding tiller --ignore-not-found
58
+ kubectl -n {{ get "namespace" }} delete serviceaccount tiller --ignore-not-found
You can’t perform that action at this time.
0 commit comments