Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.4 kB
1
Indexable
Never
{{- $nameInSecretManager := .Values.externalSecrets.nameInSecretManager }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "node-eks.fullname" . }}
  labels:
    {{- include "node-eks.labels" . | nindent 4 }}
    {{- with .Values.podLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "node-eks.selectorLabels" . | nindent 6 }}
      {{- with .Values.podLabels }}
      {{- toYaml . | nindent 6 }}
      {{- end }}
  template:
    metadata:
      annotations:
        {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "node-eks.selectorLabels" . | nindent 8 }}
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "node-eks.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
            {{- if .Values.environmentVars }}
            {{- with .Values.environmentVars }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
            {{- end}}
            {{- if .Values.application.nodeOpts }}
            - name: NODE_OPTIONS
              value: {{ .Values.application.nodeOpts }}
            {{- end }}
            {{- if .Values.externalSecrets.enabled}}
            {{- range $secretValue := .Values.externalSecrets.secretValues }}
            - name: {{ $secretValue.envVarName }}
              valueFrom:
                secretKeyRef:
                  name: {{ $nameInSecretManager}}
                  key: {{ $secretValue.keyInSecretManager }}
            {{- end }}
           {{- end }}
          ports:
            - name: http # The application port
              containerPort: {{ .Values.service.appPort }}
              protocol: TCP
            - name: mgmt # The management port
              containerPort: {{ .Values.service.mgmtPort }}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /health-check
              port: mgmt
            initialDelaySeconds: {{ .Values.service.probeInitialDelaySeconds }}
            periodSeconds: {{ .Values.service.probePeriodSeconds }}
          readinessProbe:
            httpGet:
              path: /health-check
              port: mgmt
            initialDelaySeconds: {{ .Values.service.probeInitialDelaySeconds }}
            periodSeconds: {{ .Values.service.probePeriodSeconds }}
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
Leave a Comment