/
installer-local.yaml
278 lines (271 loc) · 7.8 KB
/
installer-local.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
---
apiVersion: v1
kind: Namespace
metadata:
name: kyma-installer
labels:
istio-injection: disabled
kyma-project.io/installation: ""
---
apiVersion: v1
kind: LimitRange
metadata:
name: kyma-default
namespace: kyma-installer
labels:
kyma-project.io/installation: ""
spec:
limits:
- max:
memory: 1024Mi # Maximum memory that a container can request
default:
# If a container does not specify memory limit, this default value will be applied.
# If a container tries to allocate more memory, container will be OOM killed.
memory: 96Mi
defaultRequest:
# If a container does not specify memory request, this default value will be applied.
# The scheduler considers this value when scheduling a container to a node.
# If a node has not enough memory, such pod will not be created.
memory: 32Mi
type: Container
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: installations.installer.kyma-project.io
labels:
kyma-project.io/installation: ""
spec:
group: installer.kyma-project.io
version: v1alpha1
scope: Namespaced
names:
kind: Installation
singular: installation
plural: installations
shortNames: ['installation']
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: releases.release.kyma-project.io
labels:
kyma-project.io/installation: ""
spec:
group: release.kyma-project.io
version: v1alpha1
scope: Namespaced
names:
kind: Release
singular: release
plural: releases
shortNames: ['release']
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: helm-certs-job-sa
namespace: kyma-installer
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: helm-certs-rolebinding
namespace: kube-system
subjects:
- kind: ServiceAccount
name: helm-certs-job-sa
namespace: kyma-installer
roleRef:
kind: Role
name: helm-certs-getter
apiGroup: rbac.authorization.k8s.io
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: helm-certs-rolebinding
namespace: kyma-installer
subjects:
- kind: ServiceAccount
name: helm-certs-job-sa
namespace: kyma-installer
roleRef:
kind: Role
name: helm-certs-setter
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: helm-certs-getter
namespace: kube-system
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: helm-certs-setter
namespace: kyma-installer
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "create", "patch"]
---
apiVersion: batch/v1
kind: Job
metadata:
name: helm-certs-job
namespace: kyma-installer
labels:
kyma-project.io/installation: ""
spec:
template:
metadata:
name: helm-certs-job
namespace: kyma-installer
annotations:
sidecar.istio.io/inject: “false”
spec:
serviceAccountName: helm-certs-job-sa
restartPolicy: OnFailure
containers:
- name: certhelper
image: eu.gcr.io/kyma-project/test-infra/alpine-kubectl:v20190325-ff66a3a
command:
- bash
- -c
- |
WORKING_DIR="/tmp/certs"
mkdir -p "${WORKING_DIR}"
cat <<EOF > "${WORKING_DIR}/openssl.cnf"
[ req ]
#default_bits = 2048
#default_md = sha256
#default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_min = 2
countryName_max = 2
stateOrProvinceName = State or Province Name (full name)
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
organizationalUnitName = Organizational Unit Name (eg, section)
commonName = Common Name (eg, fully qualified host name)
commonName_max = 64
emailAddress = Email Address
emailAddress_max = 64
[ req_attributes ]
challengePassword = A challenge password
challengePassword_min = 4
challengePassword_max = 20
[ v3_ca ]
basicConstraints = critical,CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
EOF
echo "---> Get Tiller CA"
if [[ $(kubectl get -n kube-system secret tiller-secret) ]] ; then
kubectl get -n kube-system secret tiller-secret -o jsonpath="{.data['ca\.crt']}" | base64 --decode > "${WORKING_DIR}/ca.crt"
kubectl get -n kube-system secret tiller-secret -o jsonpath="{.data['ca\.key']}" | base64 --decode > "${WORKING_DIR}/ca.key"
else
echo "Secret: tiller-secret does not exists!"
exit 1
fi
echo "---> Generate Helm key"
openssl genrsa -out "${WORKING_DIR}/helm.key.pem" 4096
openssl req -key "${WORKING_DIR}/helm.key.pem" -new -sha256 -out "${WORKING_DIR}/helm.csr.pem" -subj "/C=PL/ST=Gliwice/L=Gliwice/O=Helm Client/CN=helm-client"
openssl x509 -req -CA "${WORKING_DIR}/ca.crt" -CAkey "${WORKING_DIR}/ca.key" -CAcreateserial -in "${WORKING_DIR}/helm.csr.pem" -out "${WORKING_DIR}/helm.cert.pem" -days 365
echo "---> Create secrets in k8s"
COMBO_YAML=$(cat << EOF
---
apiVersion: v1
data:
global.helm.ca.crt: "$(base64 "${WORKING_DIR}/ca.crt" | tr -d '\n')"
global.helm.tls.crt: "$(base64 ${WORKING_DIR}/helm.cert.pem | tr -d '\n')"
global.helm.tls.key: "$(base64 ${WORKING_DIR}/helm.key.pem | tr -d '\n')"
kind: Secret
metadata:
creationTimestamp: null
labels:
installer: overrides
kyma-project.io/installation: ""
name: helm-secret
namespace: kyma-installer
type: Opaque
EOF
)
echo "${COMBO_YAML}" | kubectl create -f -
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kyma-installer
namespace: kyma-installer
labels:
kyma-project.io/installation: ""
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kyma-installer
namespace: kyma-installer
labels:
kyma-project.io/installation: ""
spec:
template:
metadata:
labels:
name: kyma-installer
spec:
serviceAccountName: kyma-installer
containers:
- name: kyma-installer-container
image: eu.gcr.io/kyma-project/kyma-installer:0.9.1
args:
- -tillerTLSInsecureSkipVerify=true
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /etc/certs
name: helm-certs
readOnly: true
volumes:
- name: helm-certs
secret:
secretName: helm-secret
items:
- key: global.helm.tls.crt
path: tls.crt
- key: global.helm.tls.key
path: tls.key
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: kyma-installer-reader
labels:
kyma-project.io/installation: ""
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: kyma-installer
labels:
kyma-project.io/installation: ""
subjects:
- kind: ServiceAccount
name: kyma-installer
namespace: kyma-installer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kyma-installer-reader