github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/argo-cd/templates/redis/deployment.yaml (about)

     1  {{- $redisHa := index .Values "redis-ha" -}}
     2  {{- if and .Values.redis.enabled (not $redisHa.enabled) -}}
     3  apiVersion: apps/v1
     4  kind: Deployment
     5  metadata:
     6    {{- with (mergeOverwrite (deepCopy .Values.global.deploymentAnnotations) .Values.redis.deploymentAnnotations) }}
     7    annotations:
     8      {{- range $key, $value := . }}
     9      {{ $key }}: {{ $value | quote }}
    10      {{- end }}
    11    {{- end }}
    12    name: {{ include "argo-cd.redis.fullname" . }}
    13    namespace: {{ .Release.Namespace | quote }}
    14    labels:
    15      {{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
    16  spec:
    17    replicas: 1
    18    revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
    19    selector:
    20      matchLabels:
    21        app.kubernetes.io/name: {{ include "argo-cd.name" . }}-{{ .Values.redis.name }}
    22    template:
    23      metadata:
    24        labels:
    25          {{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 8 }}
    26          {{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.redis.podLabels) }}
    27            {{- toYaml . | nindent 8 }}
    28          {{- end }}
    29        {{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.redis.podAnnotations) }}
    30        annotations:
    31          {{- range $key, $value := . }}
    32          {{ $key }}: {{ $value | quote }}
    33          {{- end }}
    34        {{- end }}
    35      spec:
    36        {{- with .Values.redis.imagePullSecrets | default .Values.global.imagePullSecrets }}
    37        imagePullSecrets:
    38          {{- toYaml . | nindent 8 }}
    39        {{- end }}
    40        {{- with .Values.global.hostAliases }}
    41        hostAliases:
    42          {{- toYaml . | nindent 8 }}
    43        {{- end }}
    44        {{- with .Values.redis.securityContext }}
    45        securityContext:
    46          {{- toYaml . | nindent 8 }}
    47        {{- end }}
    48        {{- with .Values.redis.priorityClassName | default .Values.global.priorityClassName }}
    49        priorityClassName: {{ . }}
    50        {{- end }}
    51        serviceAccountName: {{ include "argo-cd.redisServiceAccountName" . }}
    52        containers:
    53        - name: {{ .Values.redis.name }}
    54          image: {{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}
    55          imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.redis.image.imagePullPolicy }}
    56          args:
    57          {{- with .Values.redis.extraArgs }}
    58            {{- toYaml . | nindent 8 }}
    59          {{- end }}
    60          - --save
    61          - ""
    62          - --appendonly
    63          - "no"
    64          {{- with (concat .Values.global.env .Values.redis.env) }}
    65          env:
    66            {{- toYaml . | nindent 8 }}
    67          {{- end }}
    68          {{- with .Values.redis.envFrom }}
    69          envFrom:
    70            {{- toYaml . | nindent 8 }}
    71          {{- end }}
    72          ports:
    73          - name: redis
    74            containerPort: {{ .Values.redis.containerPorts.redis }}
    75            protocol: TCP
    76          resources:
    77            {{- toYaml .Values.redis.resources | nindent 10 }}
    78          {{- with .Values.redis.containerSecurityContext }}
    79          securityContext:
    80            {{- toYaml . | nindent 10 }}
    81          {{- end }}
    82          {{- with .Values.redis.volumeMounts }}
    83          volumeMounts:
    84            {{- toYaml . | nindent 10 }}
    85          {{- end }}
    86        {{- if .Values.redis.exporter.enabled }}
    87        - name: metrics
    88          image: {{ .Values.redis.exporter.image.repository }}:{{ .Values.redis.exporter.image.tag }}
    89          imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.redis.exporter.image.imagePullPolicy }}
    90          env:
    91          - name: REDIS_ADDR
    92            value: {{ printf "redis://localhost:%v" .Values.redis.containerPorts.redis }}
    93          - name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
    94            value: {{ printf "0.0.0.0:%v" .Values.redis.containerPorts.metrics }}
    95          {{- with (concat .Values.global.env .Values.redis.exporter.env) }}
    96            {{- toYaml . | nindent 8 }}
    97          {{- end }}
    98          ports:
    99          - name: metrics
   100            containerPort: {{ .Values.redis.containerPorts.metrics }}
   101            protocol: TCP
   102          resources:
   103            {{- toYaml .Values.redis.exporter.resources | nindent 10 }}
   104          {{- with .Values.redis.exporter.containerSecurityContext }}
   105          securityContext:
   106            {{- toYaml . | nindent 10 }}
   107          {{- end }}
   108        {{- end }}
   109        {{- with .Values.redis.extraContainers }}
   110          {{- tpl (toYaml .) $ | nindent 6 }}
   111        {{- end }}
   112        {{- with .Values.redis.initContainers }}
   113        initContainers:
   114          {{- tpl (toYaml .) $ | nindent 6 }}
   115        {{- end }}
   116        {{- with .Values.redis.nodeSelector | default .Values.global.nodeSelector }}
   117        nodeSelector:
   118          {{- toYaml . | nindent 8 }}
   119        {{- end }}
   120        {{- with .Values.redis.tolerations | default .Values.global.tolerations }}
   121        tolerations:
   122          {{- toYaml . | nindent 8 }}
   123        {{- end }}
   124        {{- with include "argo-cd.affinity" (dict "context" . "component" .Values.redis) }}
   125        affinity:
   126          {{-  trim . | nindent 8 }}
   127        {{- end }}
   128        {{- with .Values.redis.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
   129        topologySpreadConstraints:
   130          {{- range $constraint := . }}
   131        - {{ toYaml $constraint | nindent 8 | trim }}
   132          {{- if not $constraint.labelSelector }}
   133          labelSelector:
   134            matchLabels:
   135              app.kubernetes.io/name: {{ include "argo-cd.name" $ }}-{{ $.Values.redis.name }}
   136          {{- end }}
   137          {{- end }}
   138        {{- end }}
   139        {{- with .Values.redis.volumes }}
   140        volumes:
   141          {{- toYaml . | nindent 8}}
   142        {{- end }}
   143        {{- with .Values.redis.dnsConfig }}
   144        dnsConfig:
   145          {{- toYaml . | nindent 8 }}
   146        {{- end }}
   147        dnsPolicy: {{ .Values.redis.dnsPolicy }}
   148  {{- end }}