blob: e2d58b06331a67266a558de4a0ef6784b16b662f [file] [log] [blame]
Zhe Huang38dc8572019-12-08 00:01:26 -05001{{/*
2 Copyright (c) 2019 AT&T Intellectual Property.
3 Copyright (c) 2019 Nokia.
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16*/}}
17{{- if .Values.common }}
18{{- if .Values.common.tillers }}
19{{- $topCtx := . }}
20{{- range keys .Values.common.tillers }}
21{{- $key := . }}
22{{- with index $topCtx.Values.common.tillers . }}
23{{- $nameSpace := .nameSpace }}
24{{- $deployNameSpace := .deployNameSpace }}
25{{- $img := .image.tiller }}
26{{- $secretName := default "tiller-secret" .secret.tillerSecretName }}
27{{- $imgPullPolicy := .imagePullPolicy }}
28{{- $ctx := dict "ctx" $topCtx "key" $key }}
29---
30apiVersion: v1
31kind: ServiceAccount
32metadata:
33 name: {{ include "common.serviceaccountname.tiller" $ctx }}
34 namespace: {{ $deployNameSpace }}
35---
36apiVersion: rbac.authorization.k8s.io/v1beta1
37kind: Role
38metadata:
39 name: {{ include "common.tillerName" $ctx }}-tiller-base
40 namespace: {{ $nameSpace }}
41rules:
42- apiGroups: [""]
43 resources: ["secrets"]
44 resourceNames: [ {{ $secretName }} ]
45 verbs: ["get"]
46- apiGroups: [""]
47 resources: ["pods/portforward"]
48 verbs: ["create"]
49- apiGroups: [""]
50 resources: ["namespaces"]
51 verbs: ["get"]
52- apiGroups: [""]
53 resources: ["pods", "configmaps", "deployments", "services"]
54 verbs: ["get", "list", "create", "delete"]
55---
56apiVersion: rbac.authorization.k8s.io/v1beta1
57kind: RoleBinding
58metadata:
59 name: {{ include "common.serviceaccountname.tiller" $ctx }}-{{ $nameSpace }}-tiller-base
60 namespace: {{ $nameSpace }}
61roleRef:
62 apiGroup: rbac.authorization.k8s.io
63 kind: Role
64 name: {{ include "common.tillerName" $ctx }}-tiller-base
65subjects:
66 - kind: ServiceAccount
67 name: {{ include "common.serviceaccountname.tiller" $ctx }}
68 namespace: {{ $deployNameSpace }}
69---
70apiVersion: rbac.authorization.k8s.io/v1beta1
71kind: Role
72metadata:
73 name: {{ include "common.tillerName" $ctx }}-tiller-operation
74 namespace: {{ $deployNameSpace }}
75rules:
76- apiGroups: [""]
77 resources: ["configmaps"]
78 verbs: ["get", "list", "create", "delete", "update"]
79---
80apiVersion: rbac.authorization.k8s.io/v1beta1
81kind: RoleBinding
82metadata:
83 name: {{ include "common.serviceaccountname.tiller" $ctx }}-{{ $nameSpace }}-tiller-operation
84 namespace: {{ $deployNameSpace }}
85roleRef:
86 apiGroup: rbac.authorization.k8s.io
87 kind: Role
88 name: {{ include "common.tillerName" $ctx }}-tiller-operation
89subjects:
90 - kind: ServiceAccount
91 name: {{ include "common.serviceaccountname.tiller" $ctx }}
92 namespace: {{ $deployNameSpace }}
93{{- if .serviceAccount.role }}
94---
95apiVersion: rbac.authorization.k8s.io/v1beta1
96kind: Role
97metadata:
98 name: {{ include "common.tillerName" $ctx }}-tiller-deployer
99 namespace: {{ $nameSpace }}
100rules:
101{{ toYaml .serviceAccount.role }}
102---
103apiVersion: rbac.authorization.k8s.io/v1beta1
104kind: RoleBinding
105metadata:
106 name: {{ include "common.serviceaccountname.tiller" $ctx }}-{{ $nameSpace }}-tiller-deployer
107 namespace: {{ $nameSpace }}
108roleRef:
109 apiGroup: rbac.authorization.k8s.io
110 kind: Role
111 name: {{ include "common.tillerName" $ctx }}-tiller-deployer
112subjects:
113 - kind: ServiceAccount
114 name: {{ include "common.serviceaccountname.tiller" $ctx }}
115 namespace: {{ $deployNameSpace }}
116{{- end }}
117---
118apiVersion: apps/v1
119kind: Deployment
120metadata:
121 labels:
122 app: helm
123 name: tiller
124 name: {{ include "common.deploymentname.tiller" $ctx }}
125 namespace: {{ $deployNameSpace }}
126spec:
127 replicas: 1
128 selector:
129 matchLabels:
130 app: helm
131 name: tiller
132 template:
133 metadata:
134 labels:
135 app: helm
136 name: tiller
137 spec:
138 automountServiceAccountToken: true
139 {{- $newctx := dict "ctx" $topCtx "defaultregistry" $img.registry }}
140 imagePullSecrets:
141 - name: {{ include "common.dockerregistry.credential" $newctx }}
142 containers:
143 - env:
144 - name: TILLER_NAMESPACE
145 value: {{ $deployNameSpace }}
146 - name: TILLER_HISTORY_MAX
147 value: "0"
148 - name: TILLER_TLS_VERIFY
149 value: "1"
150 - name: TILLER_TLS_ENABLE
151 value: "1"
152 - name: TILLER_TLS_CERTS
153 value: /etc/certs
154 image: {{ include "common.dockerregistry.url" $newctx }}/{{- $img.name -}}:{{- $img.tag }}
155 {{- $newctx := dict "ctx" $topCtx "defaultpullpolicy" $imgPullPolicy }}
156 imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $newctx }}
157 livenessProbe:
158 httpGet:
159 path: /liveness
160 port: 44135
161 initialDelaySeconds: 1
162 timeoutSeconds: 1
163 name: tiller
164 ports:
165 - containerPort: 44134
166 name: tiller
167 - containerPort: 44135
168 name: http
169 readinessProbe:
170 httpGet:
171 path: /readiness
172 port: 44135
173 initialDelaySeconds: 1
174 timeoutSeconds: 1
175 volumeMounts:
176 - mountPath: /etc/certs
177 name: tiller-certs
178 readOnly: true
179 serviceAccountName: {{ include "common.serviceaccountname.tiller" $ctx }}
180 volumes:
181 - name: tiller-certs
182 secret:
183 secretName: {{ $secretName }}
184---
185apiVersion: v1
186kind: Service
187metadata:
188 creationTimestamp: null
189 labels:
190 app: helm
191 name: tiller
192 name: {{ include "common.servicename.tiller" $ctx }}
193 namespace: {{ $deployNameSpace }}
194spec:
195 ports:
196 - name: tiller
197 port: {{ default 44134 .port }}
198 targetPort: tiller
199 selector:
200 app: helm
201 name: tiller
202 type: ClusterIP
203{{- end }}
204{{- end }}
205{{- end }}
206{{- end }}