blob: e0ea0ec5340a2eef3e4fbfc59b76c8816018945e [file] [log] [blame]
Milan Verespejc9ea08f2019-02-06 12:29:00 +01001From 10656e7f8089e3c3a718a947fd10b1a728eeb8c6 Mon Sep 17 00:00:00 2001
2From: Milan Verespej <m.verespej@partner.samsung.com>
3Date: Wed, 6 Feb 2019 10:24:09 +0100
4Subject: [PATCH] Casablanca 3.0.0 offline patch
5
6---
7 .../templates/deployment.yaml | 12 ++-
8 .../common/common/templates/_cacert.tpl | 80 +++++++++++++++++++
9 .../dgbuilder/templates/deployment.yaml | 10 ++-
10 .../templates/deployment.yaml | 7 ++
11 kubernetes/onap/templates/configmap.yaml | 33 ++++++++
12 .../charts/brmsgw/templates/deployment.yaml | 5 ++
13 .../charts/drools/templates/statefulset.yaml | 8 ++
14 .../charts/pdp/templates/statefulset.yaml | 5 ++
15 .../policy-common/templates/_keystore.tpl | 61 ++++++++++++++
16 .../templates/deployment.yaml | 12 ++-
17 .../sdnc-portal/templates/deployment.yaml | 9 ++-
18 11 files changed, 234 insertions(+), 8 deletions(-)
19 create mode 100644 kubernetes/common/common/templates/_cacert.tpl
20 create mode 100644 kubernetes/onap/templates/configmap.yaml
21 create mode 100644 kubernetes/policy/charts/policy-common/templates/_keystore.tpl
22
23diff --git a/kubernetes/appc/charts/appc-ansible-server/templates/deployment.yaml b/kubernetes/appc/charts/appc-ansible-server/templates/deployment.yaml
24index a7daa051..b7cdd9e6 100644
25--- a/kubernetes/appc/charts/appc-ansible-server/templates/deployment.yaml
26+++ b/kubernetes/appc/charts/appc-ansible-server/templates/deployment.yaml
27@@ -47,8 +47,16 @@ spec:
Michal Ptacek5a269d22019-01-28 13:03:16 +000028 name: {{ include "common.name" . }}-readiness
29 containers:
30 - name: {{ include "common.name" . }}
31- command: ["/bin/bash"]
Milan Verespejc9ea08f2019-02-06 12:29:00 +010032- args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"]
Michal Ptacek5a269d22019-01-28 13:03:16 +000033+ command:
Milan Verespejc9ea08f2019-02-06 12:29:00 +010034+ - /bin/bash
35+ - -c
36+ - >
37+ pip install -i http://nexus3.onap.org/repository/pypi-private/simple/
38+ --trusted-host nexus3.onap.org
39+ PyMySQL cherrypy requests;
40+ curl -s repo.infra-server/ubuntu/xenial/onap.list > /etc/apt/sources.list;
41+ apt-get update;
42+ cd /opt/onap/ccsdk && ./startAnsibleServer.sh
Michal Ptacek5a269d22019-01-28 13:03:16 +000043 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
44 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45 ports:
Milan Verespejc9ea08f2019-02-06 12:29:00 +010046diff --git a/kubernetes/common/common/templates/_cacert.tpl b/kubernetes/common/common/templates/_cacert.tpl
47new file mode 100644
48index 00000000..4fb80964
49--- /dev/null
50+++ b/kubernetes/common/common/templates/_cacert.tpl
Michal Ptacek997057f2019-02-01 08:37:05 +000051@@ -0,0 +1,80 @@
52+# COPYRIGHT NOTICE STARTS HERE
53+#
54+# Copyright 2018 © Samsung Electronics Co., Ltd.
55+#
56+# Licensed under the Apache License, Version 2.0 (the "License");
57+# you may not use this file except in compliance with the License.
58+# You may obtain a copy of the License at
59+#
60+# http://www.apache.org/licenses/LICENSE-2.0
61+#
62+# Unless required by applicable law or agreed to in writing, software
63+# distributed under the License is distributed on an "AS IS" BASIS,
64+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65+# See the License for the specific language governing permissions and
66+# limitations under the License.
67+#
68+# COPYRIGHT NOTICE ENDS HERE
69+
70+#This template adds volume for access to ca certificate.
71+#Template is ignored when cacert not set.
72+{{- define "common.cacert-volume" }}
73+{{- if .Values.global.cacert }}
74+- name: cacert
75+ configMap:
76+ name: {{ include "common.namespace" . }}-root-ca-cert
77+{{- end }}
78+{{- end }}
79+
80+#This template mounts the CA certificate in an ubuntu compatible way.
81+#It is mounted to /usr/local/share/ca-certificates/cacert.crt.
82+#Template is ignored if cacert not set.
83+{{- define "common.cacert-mount-ubuntu" }}
84+{{- if .Values.global.cacert }}
85+- mountPath: "/usr/local/share/ca-certificates/cacert.crt"
86+ name: cacert
87+ subPath: certificate
88+{{- end }}
89+{{- end }}
90+
91+#This template creates an empty volume used to store system certificates (includes java keystore).
92+{{- define "common.system-ca-store-volume" }}
93+{{- if .Values.global.cacert }}
94+- name: system-ca-store
95+ emptyDir:
96+{{- end }}
97+{{- end }}
98+
99+#This template mounts system ca store volume to /etc/ssl/certs (ubuntu specific).
100+#Template is ignored in case cacert is not given.
101+{{- define "common.system-ca-store-mount-ubuntu" }}
102+{{- if .Values.global.cacert }}
103+- mountPath: "/etc/ssl/certs"
104+ name: system-ca-store
105+{{- end }}
106+{{- end }}
107+
108+#This template is a template for an init container.
109+#This init container can be declared to update system's ca store for ubuntu containers.
110+#It runs as root using the same image as the main one.
111+#It expects /etc/ssl/certs to be mounted as a volume.
112+#It has to be shared with the main container.
113+#This template is ignored if cacert is not given as helm value.
114+{{- define "common.update-system-ca-store-ubuntu" }}
115+{{- if .Values.global.cacert }}
116+- command:
117+ - "/bin/bash"
118+ - "-c"
119+ - |
120+ mkdir -p /etc/ssl/certs/java
121+ update-ca-certificates
122+ name: update-system-ca-store
123+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
124+ image: {{ include "common.repository" . }}/{{ .Values.image }}
125+ securityContext:
126+ runAsUser: 0
127+ volumeMounts:
128+{{ include "common.cacert-mount-ubuntu" . | indent 2 }}
129+{{ include "common.system-ca-store-mount-ubuntu" . | indent 2 }}
130+{{- end }}
131+{{- end }}
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100132diff --git a/kubernetes/common/dgbuilder/templates/deployment.yaml b/kubernetes/common/dgbuilder/templates/deployment.yaml
133index 353c2314..2cb02d62 100644
134--- a/kubernetes/common/dgbuilder/templates/deployment.yaml
135+++ b/kubernetes/common/dgbuilder/templates/deployment.yaml
136@@ -49,8 +49,14 @@ spec:
137 - name: {{ include "common.name" . }}
138 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
139 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
140- command: ["/bin/bash"]
141- args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && ./start.sh sdnc1.0 && wait"]
142+ command:
143+ - /bin/bash
144+ - -c
145+ - >
146+ HOSTS_FILE_RECORD >> /etc/hosts;
147+ NPM_REGISTRY_RECORD;
148+ cd /opt/onap/ccsdk/dgbuilder/;
149+ ./start.sh sdnc1.0 && wait
150 ports:
151 - containerPort: {{ .Values.service.internalPort }}
152 readinessProbe:
153diff --git a/kubernetes/dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml b/kubernetes/dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
154index 79bd8962..8e807a9b 100644
155--- a/kubernetes/dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
156+++ b/kubernetes/dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
157@@ -70,6 +70,8 @@ spec:
158 - mountPath: /etc/localtime
159 name: localtime
160 readOnly: true
161+ - mountPath: /etc/pki/ca-trust/source/anchors
162+ name: root-ca
163 securityContext:
164 privileged: True
165 lifecycle:
166@@ -82,6 +84,8 @@ spec:
167 set -ex
168 mkdir -p /var/run/secrets/kubernetes.io/
169 ln -s /secret /var/run/secrets/kubernetes.io/serviceaccount
170+ echo -e '\nREQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt"' >> /etc/sysconfig/cloudify-restservice
171+ update-ca-trust extract
172 volumes:
173 - name: {{ include "common.fullname" . }}-config
174 configMap:
175@@ -95,5 +99,8 @@ spec:
176 - name: localtime
177 hostPath:
178 path: /etc/localtime
179+ - name: root-ca
180+ hostPath:
181+ path: /etc/pki/ca-trust/source/anchors
182 imagePullSecrets:
183 - name: "{{ include "common.namespace" . }}-docker-registry-key"
184diff --git a/kubernetes/onap/templates/configmap.yaml b/kubernetes/onap/templates/configmap.yaml
185new file mode 100644
186index 00000000..b1804a36
187--- /dev/null
188+++ b/kubernetes/onap/templates/configmap.yaml
Michal Ptacek997057f2019-02-01 08:37:05 +0000189@@ -0,0 +1,33 @@
190+# COPYRIGHT NOTICE STARTS HERE
191+#
192+# Copyright 2018 © Samsung Electronics Co., Ltd.
193+#
194+# Licensed under the Apache License, Version 2.0 (the "License");
195+# you may not use this file except in compliance with the License.
196+# You may obtain a copy of the License at
197+#
198+# http://www.apache.org/licenses/LICENSE-2.0
199+#
200+# Unless required by applicable law or agreed to in writing, software
201+# distributed under the License is distributed on an "AS IS" BASIS,
202+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203+# See the License for the specific language governing permissions and
204+# limitations under the License.
205+#
206+# COPYRIGHT NOTICE ENDS HERE
207+
208+{{ if .Values.global.cacert -}}
209+apiVersion: v1
210+kind: ConfigMap
211+metadata:
212+ name: {{ include "common.namespace" . }}-root-ca-cert
213+ namespace: {{ include "common.namespace" . }}
214+ labels:
215+ app: {{ include "common.name" . }}
216+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
217+ release: {{ .Release.Name }}
218+ heritage: {{ .Release.Service }}
219+data:
220+ certificate: |
221+{{ .Values.global.cacert | indent 4 }}
222+{{- end }}
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100223diff --git a/kubernetes/policy/charts/brmsgw/templates/deployment.yaml b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
224index 7535d541..bbd63c13 100644
225--- a/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
226+++ b/kubernetes/policy/charts/brmsgw/templates/deployment.yaml
227@@ -46,6 +46,7 @@ spec:
228 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
229 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
230 name: {{ include "common.name" . }}-readiness
231+{{ include "common.update-system-ca-store-ubuntu" . | indent 6 }}
232 containers:
233 - command:
234 - /bin/bash
235@@ -69,6 +70,8 @@ spec:
236 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
237 periodSeconds: {{ .Values.readiness.periodSeconds }}
238 volumeMounts:
239+{{ include "common.cacert-mount-ubuntu" . | indent 8 }}
240+{{ include "common.system-ca-store-mount-ubuntu" . | indent 8 }}
241 - mountPath: /etc/localtime
242 name: localtime
243 readOnly: true
244@@ -95,6 +98,8 @@ spec:
245 {{ toYaml .Values.affinity | indent 10 }}
246 {{- end }}
247 volumes:
248+{{ include "common.cacert-volume" . | indent 8 }}
249+{{ include "common.system-ca-store-volume" . | indent 8 }}
250 - name: localtime
251 hostPath:
252 path: /etc/localtime
253diff --git a/kubernetes/policy/charts/drools/templates/statefulset.yaml b/kubernetes/policy/charts/drools/templates/statefulset.yaml
254index 6564e798..53c8b600 100644
255--- a/kubernetes/policy/charts/drools/templates/statefulset.yaml
256+++ b/kubernetes/policy/charts/drools/templates/statefulset.yaml
257@@ -52,6 +52,8 @@ spec:
258 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
259 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
260 name: {{ include "common.name" . }}-readiness
261+{{ include "common.update-system-ca-store-ubuntu" . | indent 6 }}
262+{{ include "policy.update-policy-keystore" . | indent 6 }}
263 containers:
264 - name: {{ include "common.name" . }}
265 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
266@@ -79,6 +81,9 @@ spec:
267 - name: REPLICAS
268 value: "{{ .Values.replicaCount }}"
269 volumeMounts:
270+{{ include "common.cacert-mount-ubuntu" . | indent 10 }}
271+{{ include "common.system-ca-store-mount-ubuntu" . | indent 10 }}
272+{{ include "policy.keystore-mount" . | indent 10 }}
273 - mountPath: /etc/localtime
274 name: localtime
275 readOnly: true
276@@ -137,6 +142,9 @@ spec:
277 {{ toYaml .Values.affinity | indent 10 }}
278 {{- end }}
279 volumes:
280+{{ include "common.cacert-volume" . | indent 8 }}
281+{{ include "common.system-ca-store-volume" . | indent 8 }}
282+{{ include "policy.keystore-storage-volume" . | indent 8 }}
283 - name: localtime
284 hostPath:
285 path: /etc/localtime
286diff --git a/kubernetes/policy/charts/pdp/templates/statefulset.yaml b/kubernetes/policy/charts/pdp/templates/statefulset.yaml
287index a3a8f6a9..4ae0ead5 100644
288--- a/kubernetes/policy/charts/pdp/templates/statefulset.yaml
289+++ b/kubernetes/policy/charts/pdp/templates/statefulset.yaml
290@@ -50,6 +50,7 @@ spec:
291 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
292 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
293 name: {{ include "common.name" . }}-readiness
294+{{ include "common.update-system-ca-store-ubuntu" . | indent 6 }}
295 containers:
296 - command:
297 - /bin/bash
298@@ -75,6 +76,8 @@ spec:
299 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
300 periodSeconds: {{ .Values.readiness.periodSeconds }}
301 volumeMounts:
302+{{ include "common.cacert-mount-ubuntu" . | indent 8 }}
303+{{ include "common.system-ca-store-mount-ubuntu" . | indent 8 }}
304 - mountPath: /etc/localtime
305 name: localtime
306 readOnly: true
307@@ -114,6 +117,8 @@ spec:
308 - mountPath: /usr/share/filebeat/data
309 name: policy-data-filebeat
310 volumes:
311+{{ include "common.cacert-volume" . | indent 6 }}
312+{{ include "common.system-ca-store-volume" . | indent 6 }}
313 - name: localtime
314 hostPath:
315 path: /etc/localtime
316diff --git a/kubernetes/policy/charts/policy-common/templates/_keystore.tpl b/kubernetes/policy/charts/policy-common/templates/_keystore.tpl
317new file mode 100644
318index 00000000..81ba09bc
319--- /dev/null
320+++ b/kubernetes/policy/charts/policy-common/templates/_keystore.tpl
Michal Ptacek997057f2019-02-01 08:37:05 +0000321@@ -0,0 +1,61 @@
322+# COPYRIGHT NOTICE STARTS HERE
323+#
324+# Copyright 2018 © Samsung Electronics Co., Ltd.
325+#
326+# Licensed under the Apache License, Version 2.0 (the "License");
327+# you may not use this file except in compliance with the License.
328+# You may obtain a copy of the License at
329+#
330+# http://www.apache.org/licenses/LICENSE-2.0
331+#
332+# Unless required by applicable law or agreed to in writing, software
333+# distributed under the License is distributed on an "AS IS" BASIS,
334+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
335+# See the License for the specific language governing permissions and
336+# limitations under the License.
337+#
338+# COPYRIGHT NOTICE ENDS HERE
339+
340+#This template creates a volume for storing policy-keystore with imported ca.
341+#It is ignored if cacert was not given.
342+{{- define "policy.keystore-storage-volume" }}
343+{{- if .Values.global.cacert }}
344+- name: keystore-storage
345+ emptyDir:
346+{{- end }}
347+{{- end }}
348+
349+#This template mounts policy-keystore in appropriate place for policy components to take it.
350+#It is ignored if cacert is not given.
351+{{- define "policy.keystore-mount" }}
352+{{- if .Values.global.cacert }}
353+- mountPath: "/tmp/policy-install/config/policy-keystore"
354+ name: keystore-storage
355+ subPath: policy-keystore
356+{{- end }}
357+{{- end }}
358+
359+#This will extract a policy keystore and then import
360+#the root cacert of offline nexus into it.
361+#This template expects a volume named keystore-storage where policy-keystore will be put.
362+#It also expects volume named cacert where the file "certificate" will contain the cert to import.
363+#Template is ignored if ca certificate not given.
364+{{- define "policy.update-policy-keystore" }}
365+{{- if .Values.global.cacert }}
366+- command:
367+ - "/bin/bash"
368+ - "-c"
369+ - |
370+ set -e
371+ tar -xzf base-*.tar.gz etc/ssl/policy-keystore
372+ cp etc/ssl/policy-keystore keystore-storage/
373+ keytool -import -keystore keystore-storage/policy-keystore -storepass "Pol1cy_0nap" -noprompt -file /usr/local/share/ca-certificates/cacert.crt
374+ name: update-policy-keystore
375+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
376+ image: {{ include "common.repository" . }}/{{ .Values.image }}
377+ volumeMounts:
378+ - mountPath: "/tmp/policy-install/keystore-storage"
379+ name: keystore-storage
380+{{ include "common.cacert-mount-ubuntu" . | indent 2 }}
381+{{- end }}
382+{{- end }}
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100383diff --git a/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml
384index 1f14dd31..18b579dd 100644
385--- a/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml
386+++ b/kubernetes/sdnc/charts/sdnc-ansible-server/templates/deployment.yaml
387@@ -47,8 +47,16 @@ spec:
Milan Verespejc2a14cf2019-02-04 11:01:19 +0100388 name: {{ include "common.name" . }}-readiness
389 containers:
390 - name: {{ include "common.name" . }}
391- command: ["/bin/bash"]
392- args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"]
393+ command:
394+ - /bin/bash
395+ - -c
396+ - >
397+ pip install -i http://nexus3.onap.org/repository/pypi-private/simple/
398+ --trusted-host nexus3.onap.org
399+ PyMySQL cherrypy requests;
400+ curl -s repo.infra-server/ubuntu/xenial/onap.list > /etc/apt/sources.list;
401+ apt-get update;
402+ cd /opt/onap/ccsdk && ./startAnsibleServer.sh
403 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
404 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
405 ports:
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100406diff --git a/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml b/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml
407index 35dffee5..18dd7cd4 100644
408--- a/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml
409+++ b/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml
410@@ -49,8 +49,13 @@ spec:
Milan Verespejc2a14cf2019-02-04 11:01:19 +0100411 name: {{ include "common.name" . }}-readiness
412 containers:
413 - name: {{ include "common.name" . }}
414- command: ["/bin/bash"]
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100415- args: ["-c", "cd /opt/onap/sdnc/admportal/shell && ./start_portal.sh"]
Milan Verespejc2a14cf2019-02-04 11:01:19 +0100416+ command:
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100417+ - /bin/bash
418+ - -c
419+ - >
420+ HOSTS_FILE_RECORD >> /etc/hosts;
421+ NPM_REGISTRY_RECORD;
422+ cd /opt/onap/sdnc/admportal/shell && ./start_portal.sh
Milan Verespejc2a14cf2019-02-04 11:01:19 +0100423 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
424 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
425 ports:
Milan Verespejc9ea08f2019-02-06 12:29:00 +0100426--
4272.20.1
428