Merge "MetalLB install script for bare metal cluster"
[oom.git] / kubernetes / sdc / charts / sdc-be / templates / deployment.yaml
index 4869966..cff8e26 100644 (file)
@@ -1,20 +1,26 @@
-apiVersion: extensions/v1beta1
+# Copyright © 2017 Amdocs, AT&T, Bell Canada
+# Modifications Copyright © 2018 ZTE
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: apps/v1
 kind: Deployment
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
+  selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ .Values.replicaCount }}
   template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       initContainers:
       - name: {{ include "common.name" . }}-readiness
@@ -22,9 +28,7 @@ spec:
         - /root/ready.py
         args:
         - --container-name
-        - "sdc-es"
-        - --container-name
-        - "sdc-cs"
+        - "sdc-onboarding-be"
         env:
         - name: NAMESPACE
           valueFrom:
@@ -40,7 +44,7 @@ spec:
         - /root/job_complete.py
         args:
         - --job-name
-        - {{ .Release.Name }}-sdc-cs-config-cassandra
+        - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
         env:
         - name: NAMESPACE
           valueFrom:
@@ -49,37 +53,41 @@ spec:
               fieldPath: metadata.namespace
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
+          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-          - containerPort: {{ .Values.service.internalPort }}
-          - containerPort: {{ .Values.service.internalPort2 }}
-          # disable liveness probe when breakpoints set in debugger
-          # so K8s doesn't restart unresponsive container
-          {{- if eq .Values.liveness.enabled true }}
+          ports: {{ include "common.containerPorts" . | nindent 10  }}
+          {{ if eq .Values.liveness.enabled true }}
           livenessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
+            httpGet:
+              path: /sdc2/rest/healthCheck
+              port: {{ .Values.liveness.port }}
+              scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
             periodSeconds: {{ .Values.liveness.periodSeconds }}
-          {{ end -}}
+            timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
+          {{ end }}
           readinessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
+            exec:
+              command:
+              - "/var/lib/jetty/ready-probe.sh"
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
+            timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
+          resources: {{ include "common.resources" . | nindent 12 }}
           env:
           - name: ENVNAME
             value: {{ .Values.global.env.name }}
           - name: JAVA_OPTIONS
-            value: ""
+            value: {{ .Values.config.javaOptions }}
+          - name: cassandra_ssl_enabled
+            value: {{ .Values.config.cassandraSslEnabled | quote }}
           - name: HOST_IP
             valueFrom:
               fieldRef:
                 fieldPath: status.podIP
           volumeMounts:
           - name: {{ include "common.fullname" . }}-environments
-            mountPath: /root/chef-solo/environments/
+            mountPath: /var/lib/jetty/chef-solo/environments/
           - name: {{ include "common.fullname" . }}-localtime
             mountPath: /etc/localtime
             readOnly: true
@@ -87,21 +95,11 @@ spec:
             mountPath: /var/log/onap
           - name: {{ include "common.fullname" . }}-logback
             mountPath: /tmp/logback.xml
+            subPath: logback.xml
           lifecycle:
             postStart:
               exec:
                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
-          resources:
-{{ toYaml .Values.resources | indent 12 }}
-        {{- if .Values.nodeSelector }}
-        nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-        {{- end -}}
-        {{- if .Values.affinity }}
-        affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-        {{- end }}
-
         # side car containers
         - name: {{ include "common.name" . }}-filebeat-onap
           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
@@ -115,22 +113,22 @@ spec:
           - name: {{ include "common.fullname" . }}-data-filebeat
             mountPath: /usr/share/filebeat/data
       volumes:
-        - name: {{ include "common.fullname" . }}-localtime
-          hostPath:
-            path: /etc/localtime
-        - name: {{ include "common.fullname" . }}-filebeat-conf
-          configMap:
-           name: {{ .Release.Name }}-sdc-filebeat-configmap
-        - name: {{ include "common.fullname" . }}-data-filebeat
-          emptyDir: {}
-        - name: {{ include "common.fullname" . }}-logback
-          configMap:
-            name : {{ include "common.fullname" . }}-logging-configmap
-        - name: {{ include "common.fullname" . }}-environments
-          configMap:
-            name: {{ .Release.Name }}-sdc-environments-configmap
-            defaultMode: 0755
-        - name:  {{ include "common.fullname" . }}-logs
-          emptyDir: {}
+      - name: {{ include "common.fullname" . }}-localtime
+        hostPath:
+          path: /etc/localtime
+      - name: {{ include "common.fullname" . }}-filebeat-conf
+        configMap:
+          name: {{ include "common.release" . }}-sdc-filebeat-configmap
+      - name: {{ include "common.fullname" . }}-data-filebeat
+        emptyDir: {}
+      - name: {{ include "common.fullname" . }}-logback
+        configMap:
+          name : {{ include "common.fullname" . }}-logging-configmap
+      - name: {{ include "common.fullname" . }}-environments
+        configMap:
+          name: {{ include "common.release" . }}-sdc-environments-configmap
+          defaultMode: 0755
+      - name:  {{ include "common.fullname" . }}-logs
+        emptyDir: {}
       imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
\ No newline at end of file
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"