[AAI] 14.0.3 Oslo release with Java 11
[oom.git] / kubernetes / aai / components / aai-sparky-be / templates / deployment.yaml
index 3b14113..3c0b4b9 100644 (file)
 
 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: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
+  selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   strategy:
     type: {{ .Values.updateStrategy.type }}
     {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }}
@@ -36,23 +31,14 @@ spec:
       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
       maxSurge: {{ .Values.updateStrategy.maxSurge }}
     {{- end }}
-  selector:
-    matchLabels:
-      app: {{ include "common.name" . }}
   template:
-    metadata:
-      annotations:
-        sidecar.istio.io/rewriteAppHTTPProbers: "false"
-      labels:
-        app: {{ include "common.name" . }}
-        release: {{ include "common.release" . }}
-      name: {{ include "common.name" . }}
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       initContainers:
       - command:
         - /app/ready.py
         args:
-        - --container-name
+        - --service-name
         - aai
         env:
         - name: NAMESPACE
@@ -63,6 +49,13 @@ spec:
         image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
+        resources:
+          limits:
+            cpu: "100m"
+            memory: "500Mi"
+          requests:
+            cpu: "3m"
+            memory: "20Mi"
       containers:
       - name: {{ include "common.name" . }}
         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
@@ -75,9 +68,6 @@ spec:
           echo "*** actual launch of AAI Sparky BE"
           /opt/app/sparky/bin/start.sh
         volumeMounts:
-        - mountPath: /etc/localtime
-          name: localtime
-          readOnly: true
         - mountPath: {{ .Values.log.path }}
           name: logs
         - mountPath:  /opt/app/sparky/config/application.properties
@@ -108,20 +98,42 @@ spec:
           name: config
           subPath: logback.xml
         ports:
-        - containerPort: {{ .Values.service.internalPort }}
-        - containerPort: {{ .Values.service.internalPlainPort }}
-        # disable liveness probe when breakpoints set in debugger
-        # so K8s doesn't restart unresponsive container
-        {{- if eq .Values.liveness.enabled true }}
+          {{- if .Values.debug.enabled }}
+          - containerPort: {{ .Values.debug.port }}
+            name: {{ .Values.debug.portName }}
+          {{- end }}
+          {{- if .Values.profiling.enabled }}
+          - containerPort: {{ .Values.profiling.port }}
+            name: {{ .Values.profiling.portName }}
+          {{- end }}
+          {{ include "common.containerPorts" . | nindent 10  }}
+        env:
+        {{- if .Values.config.env }}
+        {{- range $key,$value := .Values.config.env }}
+        - name: {{ $key | upper | quote}}
+          value: {{ $value | quote}}
+        {{- end }}
+        {{- end }}
+        {{- if .Values.profiling.enabled }}
+        - name: JVM_ARGS
+          value: '{{ join " " .Values.profiling.args }}'
+        {{- end }}
+        {{- if .Values.debug.enabled }}
+        - name: JVM_ARGS
+          value: {{ .Values.debug.args | quote }}
+        {{- end }}
+        # disable liveness probe when
+        # debugging.enabled=true or profiling.enabled=true
+        {{- if and .Values.liveness.enabled (not (or .Values.debug.enabled .Values.profiling.enabled)) }}
         livenessProbe:
           tcpSocket:
-            port: {{ .Values.service.internalPlainPort }}
+            port: {{ .Values.service.internalPort }}
           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
           periodSeconds: {{ .Values.liveness.periodSeconds }}
         {{ end -}}
         readinessProbe:
           tcpSocket:
-            port: {{ .Values.service.internalPlainPort }}
+            port: {{ .Values.service.internalPort }}
           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
           periodSeconds: {{ .Values.readiness.periodSeconds }}
         resources: {{ include "common.resources" . | nindent 10 }}
@@ -138,9 +150,6 @@ spec:
       {{ include "common.log.sidecar" . | nindent 6 }}
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
-      - name: localtime
-        hostPath:
-          path: /etc/localtime
       - name: config
         configMap:
           name: {{ include "common.fullname" . }}
@@ -150,5 +159,4 @@ spec:
       - name: modeldir
         emptyDir: {}
       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
+      {{- include "common.imagePullSecrets" . | nindent 6 }}