[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / oof / charts / oof-has / charts / oof-has-api / templates / deployment.yaml
index 56cdf5c..ce3148f 100755 (executable)
@@ -1,4 +1,5 @@
 # Copyright © 2017 Amdocs, Bell Canada
+# Copyright (C) 2020 Wipro Limited.
 # Modifications Copyright © 2018 AT&T,VMware
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: {{ include "common.fullname" . }}
@@ -24,6 +25,9 @@ metadata:
     release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}
   replicas: {{ .Values.replicaCount }}
   template:
     metadata:
@@ -34,7 +38,7 @@ spec:
       initContainers:
       - name: {{ include "common.name" . }}-readiness
         command:
-        - /root/ready.py
+        - /app/ready.py
         args:
         - --container-name
         - oof-has-controller
@@ -46,12 +50,12 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
 
       - name: {{ include "common.name" . }}-onboard-readiness
         command:
-        - /root/job_complete.py
+        - /app/ready.py
         args:
         - -j
         - "{{ include "common.release" . }}-oof-has-onboard"
@@ -61,7 +65,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
 
       - name: {{ include "common.name" . }}-has-sms-readiness
@@ -80,7 +84,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
 
       containers:
@@ -88,21 +92,21 @@ spec:
           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/bin/bash","-c"]
-          args: ["nginx && /usr/local/bin/uwsgi -s /run/conductor/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port=8080 --die-on-term --exit-on-reload --logto /var/log/conductor/conductor-uwsgi.log --pidfile /run/conductor/conductor-uwsgi.pid --enable-threads --workers 6 --master --vacuum --single-interpreter --socket-timeout 10 --max-worker-lifetime 300 --max-requests 100 --no-defer-accept --logfile-chown --logfile-chmod 664 --protocol=uwsgi --socket 0.0.0.0:8080"]
+          args: ["/usr/local/bin/uwsgi -s /run/conductor/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port={{ .Values.uwsgi.internalPort }} --die-on-term --exit-on-reload --logto /var/log/conductor/conductor-uwsgi.log --pidfile /run/conductor/conductor-uwsgi.pid --enable-threads --workers 6 --master --vacuum --single-interpreter --socket-timeout 10 --max-worker-lifetime 300 --max-requests 100 --no-defer-accept --logfile-chown --logfile-chmod 664 --protocol=uwsgi --socket 0.0.0.0:{{ .Values.uwsgi.internalPort }}"]
           ports:
-          - containerPort: {{ .Values.liveness.periodSeconds }}
+          - containerPort: {{ .Values.uwsgi.internalPort }}
           # disable liveness probe when breakpoints set in debugger
           # so K8s doesn't restart unresponsive container
           {{- if .Values.liveness.enabled }}
           livenessProbe:
             tcpSocket:
-              port: {{ .Values.service.internalPort }}
+              port: {{ .Values.uwsgi.internalPort }}
             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
             periodSeconds: {{ .Values.liveness.periodSeconds }}
           {{ end -}}
           readinessProbe:
             tcpSocket:
-              port: {{ .Values.service.internalPort }}
+              port: {{ .Values.uwsgi.internalPort }}
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
           env:
@@ -110,9 +114,6 @@ spec:
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
-          - mountPath: /etc/nginx/nginx.conf
-            name: {{ .Values.global.commonConfigPrefix  }}-config
-            subPath: nginx.conf
           - mountPath: /usr/local/etc/conductor/conductor.conf
             name: {{ .Values.global.commonConfigPrefix }}-config
             subPath: conductor.conf
@@ -122,10 +123,36 @@ spec:
           - mountPath: /usr/local/bin/AAF_RootCA.cer
             name: {{ .Values.global.commonConfigPrefix }}-config
             subPath: AAF_RootCA.cer
-          - mountPath: /etc/nginx/ssl/org.onap.oof.crt
+          resources:
+{{ include "common.resources" . | indent 12 }}
+        - name: {{ include "common.name" . }}-nginx
+          image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.nginx.image }}"
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          ports:
+          - containerPort: {{ .Values.service.internalPort }}
+          {{- if .Values.liveness.enabled }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.service.internalPort }}
+            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.liveness.periodSeconds }}
+          {{ end -}}
+          readinessProbe:
+            tcpSocket:
+              port: {{ .Values.service.internalPort }}
+            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.readiness.periodSeconds }}
+          volumeMounts:
+          - mountPath: /etc/localtime
+            name: localtime
+            readOnly: true
+          - mountPath: /opt/bitnami/nginx/conf/nginx.conf
+            name: {{ .Values.global.commonConfigPrefix  }}-config
+            subPath: nginx.conf
+          - mountPath: /opt/bitnami/nginx/ssl/org.onap.oof.crt
             name: {{ .Values.global.commonConfigPrefix }}-config
             subPath: org.onap.oof.crt
-          - mountPath: /etc/nginx/ssl/org.onap.oof.key
+          - mountPath: /opt/bitnami/nginx/ssl/org.onap.oof.key
             name: {{ .Values.global.commonConfigPrefix }}-config
             subPath: org.onap.oof.key
           resources: