apiVersion: apps/v1 kind: Deployment metadata: name: "{{ include "gateway.fullname" . }}-apimgr" labels: {{- include "gateway.labels" . | nindent 4 }} app.kubernetes.io/component: apimgr spec: {{- if not .Values.apimgr.autoscaling.enabled }} replicas: {{ .Values.apimgr.replicaCount }} {{- end }} strategy: {{- if eq (default .Values.global.updateStrategy.type .Values.apimgr.updateStrategy.type) "RollingUpdate" }} rollingUpdate: maxSurge: {{ default .Values.global.updateStrategy.rollingUpdate.maxSurge .Values.apimgr.updateStrategy.rollingUpdate.maxSurge }} maxUnavailable: {{ default .Values.global.updateStrategy.rollingUpdate.maxUnavailable .Values.apimgr.updateStrategy.rollingUpdate.maxUnavailable }} {{- end }} type: {{ default .Values.global.updateStrategy.type .Values.apimgr.updateStrategy.type }} selector: matchLabels: {{- include "gateway.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: apimgr {{- with .Values.apimgr.podLabels }} {{- toYaml . | nindent 6 }} {{- end }} template: metadata: {{- with .Values.apimgr.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "gateway.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: apimgr {{- with .Values.apimgr.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "gateway.apimgr.serviceAccountName" . }} securityContext: {{- toYaml .Values.apimgr.podSecurityContext | nindent 8 }} initContainers: {{- if .Values.global.cassandra.enabled }} - name: init-cassandra image: {{ .Values.global.initContainers.image | quote }} {{- with (first .Values.global.cassandra.hosts) }} command: ["sh", "-c", "until nc -w 3 -v {{ .hostname }} 9042; do echo waiting for {{ .hostname }}; sleep 2; done;"] {{- end }} {{- with .Values.global.initContainers.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.global.initContainers.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} {{- if .Values.global.database.metrics.enabled }} - name: init-mysql image: {{ .Values.global.initContainers.image | quote }} command: ["sh", "-c", "until nc -w 3 -v {{ tpl .Values.global.database.host . }} {{ .Values.global.database.port | int }}; do echo waiting for mysql; sleep 2; done;"] {{- with .Values.global.initContainers.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.global.initContainers.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} - name: init-anm image: {{ .Values.global.initContainers.image | quote }} {{- if .Values.anm.hostname }} command: ["sh", "-c", "until nc -w 3 -v {{ .Values.anm.hostname }}; do echo waiting for anm; sleep 2; done;"] {{- else }} command: ["sh", "-c", "until nc -w 3 -v {{ include "gateway.fullname" . }}-anm 8090; do echo waiting for anm; sleep 2; done;"] {{- end }} {{- with .Values.global.initContainers.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.global.initContainers.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.apimgr.extraInitContainers }} {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.apimgr.securityContext | nindent 12 }} image: "{{ default .Values.global.defaultRegistry .Values.apimgr.image.registry }}/{{ .Values.apimgr.image.repository }}:{{ .Values.apimgr.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.global.imagePullPolicy }} ports: - containerPort: {{ .Values.apimgr.service.ports.ui.port }} protocol: {{ .Values.apimgr.service.ports.ui.protocol }} {{- with .Values.apimgr.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.apimgr.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.apimgr.resources | nindent 12 }} env: {{- with .Values.apimgr.extraEnvVars }} {{- toYaml . | nindent 12 }} {{- end }} {{- if .Values.apimgr.FIPS.enabled }} - name: EMT_FIPS_MODE value: {{ .Values.apimgr.FIPS.enabled | quote }} {{- end }} {{- if .Values.apimgr.jvmHeapSize }} - name: EMT_HEAP_SIZE_MB value: {{ .Values.apimgr.jvmHeapSize | quote }} {{- end }} {{- if .Values.apimgr.logs.trace.level }} - name: EMT_TRACE_LEVEL value: {{ .Values.apimgr.logs.trace.level | quote }} {{- end }} {{- if .Values.apimgr.logs.trace.disk }} - name: APIGW_LOG_TRACE_TO_FILE value: {{ .Values.apimgr.logs.trace.disk | quote }} {{- end }} - name: APIGW_LOG_TRACE_JSON_TO_STDOUT value: {{ default .Values.apimgr.logs.trace.stdoutJSON false | quote }} {{- if .Values.apimgr.logs.opentraffic.output | quote }} - name: APIGW_LOG_OPENTRAFFIC_OUTPUT value: {{ .Values.apimgr.logs.opentraffic.output | quote }} {{- end }} {{- if .Values.global.domainkeypassphrase }} - name: DOMAIN_KEY_PASSPHRASE valueFrom: secretKeyRef: name: {{ include "gateway.domainkeypassphrase.secretName" . }} key: passphrase {{- end }} {{- if .Values.global.database.metrics.enabled }} - name: METRICS_DB_URL value: {{ tpl .Values.global.database.metrics.url . | quote }} - name: METRICS_DB_USERNAME valueFrom: secretKeyRef: name: {{ include "gateway.metrics-db.secretName" . }} key: {{ with .Values.global.database.metrics.existingSecret.keyMapping }}{{- default "username" .username }}{{- else -}}"username"{{- end }} - name: METRICS_DB_PASS valueFrom: secretKeyRef: name: {{ include "gateway.metrics-db.secretName" . }} key: {{ with .Values.global.database.metrics.existingSecret.keyMapping }}{{- default "password" .password }}{{- else -}}"password"{{- end }} {{- end }} {{- if .Values.anm.hostname }} - name: EMT_ANM_HOSTS value: {{ .Values.anm.hostname | quote }} {{- else }} - name: EMT_ANM_HOSTS value: "{{ include "gateway.fullname" . }}-anm:8090" {{- end }} - name: GROUP_ID value: {{ .Values.apimgr.groupId }} {{- if .Values.global.domainId }} - name: DOMAIN_ID value: {{ .Values.global.domainId }} {{- end }} {{- if .Values.global.cassandra.enabled }} {{- range .Values.global.cassandra.hosts }} - name: {{ .variable }} value: {{ .hostname | quote }} {{- end }} - name: CASS_PORT value: {{ .Values.global.cassandra.port | quote }} - name: CASS_KEYSPACE value: {{ tpl .Values.global.cassandra.keyspace . | quote }} - name: CASS_TKEYSPACE value: {{ tpl .Values.global.cassandra.tkeyspace . | quote }} - name: CASS_PASSWORD valueFrom: secretKeyRef: name: {{ include "gateway.cassandra.secretName" . }} key: {{ with .Values.global.cassandra.existingSecret.keyMapping }}{{- default "password" .password }}{{- else -}}"password"{{- end }} - name: CASS_USERNAME valueFrom: secretKeyRef: name: {{ include "gateway.cassandra.secretName" . }} key: {{ with .Values.global.cassandra.existingSecret.keyMapping }}{{- default "username" .username }}{{- else -}}"username"{{- end }} {{- end }} {{- if .Values.apimgr.image.generalConditions }} - name: ACCEPT_GENERAL_CONDITIONS value: {{ .Values.apimgr.image.generalConditions.accept | quote }} {{- end }} {{- if .Values.apimgr.extraVolumeMounts }} volumeMounts: {{- if .Values.apimgr.license }} - name: license mountPath: "/opt/Axway/apigateway/conf/licenses/license.lic" subPath: "license.lic" {{- end }} {{- toYaml ( .Values.apimgr.extraVolumeMounts ) | nindent 12 }} {{- end }} {{- if .Values.apimgr.extraVolumes }} volumes: {{- if .Values.apimgr.license }} - name: license configMap: name: {{ .Release.Name }}-apimgr-license-config {{- end }} {{ toYaml ( .Values.apimgr.extraVolumes ) | indent 8 }} {{- end }} {{- with .Values.apimgr.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.apimgr.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.apimgr.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}