github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/velero/templates/upgrade-crds.yaml (about)

     1  {{- if .Values.upgradeCRDs }}
     2  {{/* 'securityContext' got renamed to 'podSecurityContext', merge both dicts into one for backward compatibility */}}
     3  {{- $podSecurityContext := merge (.Values.podSecurityContext | default dict) (.Values.securityContext | default dict) -}}
     4  apiVersion: batch/v1
     5  kind: Job
     6  metadata:
     7    name: {{ template "velero.fullname" . }}-upgrade-crds
     8    namespace: {{ .Release.Namespace }}
     9    annotations:
    10      "helm.sh/hook": post-install,post-upgrade,post-rollback
    11      "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
    12    labels:
    13      app.kubernetes.io/name: {{ include "velero.name" . }}
    14      app.kubernetes.io/instance: {{ .Release.Name }}
    15      app.kubernetes.io/managed-by: {{ .Release.Service }}
    16      helm.sh/chart: {{ include "velero.chart" . }}
    17  spec:
    18    backoffLimit: 3
    19    template:
    20      metadata:
    21        name: velero-upgrade-crds
    22        {{- with .Values.kubectl.labels }}
    23        labels:
    24          {{- toYaml . | nindent 8 }}
    25        {{- end }}
    26        {{- with .Values.kubectl.annotations }}
    27        annotations:
    28          {{- toYaml . | nindent 8 }}
    29        {{- end }}
    30      spec:
    31      {{- if .Values.image.imagePullSecrets }}
    32        imagePullSecrets:
    33        {{- range .Values.image.imagePullSecrets }}
    34          - name: {{ . }}
    35        {{- end }}
    36      {{- end }}
    37        serviceAccountName: {{ include "velero.serverServiceAccount" . }}
    38        initContainers:
    39          - name: kubectl
    40            {{- if .Values.kubectl.image.digest }}
    41            image: "{{ .Values.kubectl.image.repository }}@{{ .Values.kubectl.image.digest }}"
    42            {{- else if .Values.kubectl.image.tag }}
    43            image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
    44            {{- else }}
    45            image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
    46            {{- end }}
    47            imagePullPolicy: {{ .Values.image.pullPolicy }}
    48            command:
    49              - /bin/sh
    50            args:
    51              - -c
    52              - cp `which sh` /tmp && cp `which kubectl` /tmp
    53            {{- with .Values.kubectl.resources }}
    54            resources:
    55              {{- toYaml . | nindent 12 }}
    56            {{- end }}
    57            {{- with .Values.kubectl.containerSecurityContext }}
    58            securityContext:
    59              {{- toYaml . | nindent 12 }}
    60            {{- end }}
    61            volumeMounts:
    62              - mountPath: /tmp
    63                name: crds
    64        containers:
    65          - name: velero
    66            {{- if .Values.image.digest }}
    67            image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
    68            {{- else }}
    69            image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
    70            {{- end }}
    71            imagePullPolicy: {{ .Values.image.pullPolicy }}
    72            command:
    73              - /tmp/sh
    74            args:
    75              - -c
    76              - /velero install --crds-only --dry-run -o yaml | /tmp/kubectl apply -f -
    77            {{- with .Values.resources }}
    78            resources:
    79              {{- toYaml . | nindent 12 }}
    80            {{- end }}
    81            {{- with .Values.containerSecurityContext }}
    82            securityContext:
    83              {{- toYaml . | nindent 12 }}
    84            {{- end }}
    85            volumeMounts:
    86              - mountPath: /tmp
    87                name: crds
    88        volumes:
    89          - name: crds
    90            emptyDir: {}
    91        restartPolicy: OnFailure
    92        {{- with $podSecurityContext }}
    93        securityContext:
    94          {{- toYaml . | nindent 8 }}
    95        {{- end }}
    96        {{- with .Values.nodeSelector }}
    97        nodeSelector:
    98          {{- toYaml . | nindent 8 }}
    99        {{- end }}
   100        {{- with .Values.tolerations }}
   101        tolerations:
   102          {{- toYaml . | nindent 8 }}
   103        {{- end }}
   104        {{- with .Values.affinity }}
   105        affinity:
   106          {{- toYaml . | nindent 8 }}
   107        {{- end }}
   108  {{- end }}