Merge "[COMMON] Make our common charts compatible with helm 3.7+"
[oom.git] / kubernetes / dcaegen2-services / common / dcaegen2-services-common / templates / _deployment.tpl
index 8738b10..5ba7d29 100644 (file)
@@ -207,7 +207,7 @@ The sidecar is included if .Values.policies is set.  The
 Policy-sync sidecar polls PolicyEngine (PDP) periodically based
 on .Values.policies.duration and configuration retrieved is shared with
 DCAE Microservice container by common volume. Policy can be retrieved based on
 Policy-sync sidecar polls PolicyEngine (PDP) periodically based
 on .Values.policies.duration and configuration retrieved is shared with
 DCAE Microservice container by common volume. Policy can be retrieved based on
-list of policyID or filter. An optional policyRelease parameter can be specified 
+list of policyID or filter. An optional policyRelease parameter can be specified
 to override the default policy helm release (used for retreiving the secret containing
 pdp username and password)
 
 to override the default policy helm release (used for retreiving the secret containing
 pdp username and password)
 
@@ -229,10 +229,12 @@ policies:
 {{- $policy := default dict .Values.policies -}}
 {{- $policyRls := default $commonRelease $policy.policyRelease -}}
 {{- $drFeedConfig := default "" .Values.drFeedConfig -}}
 {{- $policy := default dict .Values.policies -}}
 {{- $policyRls := default $commonRelease $policy.policyRelease -}}
 {{- $drFeedConfig := default "" .Values.drFeedConfig -}}
-
+{{- $dcaeName := print (include "common.fullname" .) }}
+{{- $dcaeLabel := (dict "dcaeMicroserviceName" $dcaeName) -}}
+{{- $dot := . -}}
 apiVersion: apps/v1
 kind: Deployment
 apiVersion: apps/v1
 kind: Deployment
-metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
+metadata: {{- include "common.resourceMetadata" (dict "dot" $dot "labels" $dcaeLabel) | nindent 2 }}
 spec:
   replicas: 1
   selector: {{- include "common.selectors" . | nindent 4 }}
 spec:
   replicas: 1
   selector: {{- include "common.selectors" . | nindent 4 }}
@@ -272,6 +274,9 @@ spec:
         args:
         - --key-yaml
         - "{{ include "common.name" . }}|/app-config/application_config.yaml"
         args:
         - --key-yaml
         - "{{ include "common.name" . }}|/app-config/application_config.yaml"
+        env:
+        - name: CONSUL_HOST
+          value: {{ .Values.consulHost | default "consul-server-ui" }}.{{ include "common.namespace" . }}
         resources: {{ include "common.resources" . | nindent 2 }}
         volumeMounts:
           - mountPath: /app-config
         resources: {{ include "common.resources" . | nindent 2 }}
         volumeMounts:
           - mountPath: /app-config
@@ -432,6 +437,7 @@ spec:
         {{- end }}
       {{- end }}
       hostname: {{ include "common.name" . }}
         {{- end }}
       {{- end }}
       hostname: {{ include "common.name" . }}
+      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
       - configMap:
           defaultMode: 420
       volumes:
       - configMap:
           defaultMode: 420