github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/helm/templates/deployment.yaml (about)

     1  apiVersion: apps/v1
     2  kind: Deployment
     3  metadata:
     4    name: {{ include "kubeblocks.fullname" . }}
     5    labels:
     6      {{- include "kubeblocks.labels" . | nindent 4 }}
     7      app.kubernetes.io/component: "apps"
     8  spec:
     9    {{- if not .Values.autoscaling.enabled }}
    10    replicas: {{ .Values.replicaCount }}
    11    {{- end }}
    12    selector:
    13      matchLabels:
    14        {{- include "kubeblocks.selectorLabels" . | nindent 6 }}
    15    {{- if .Values.updateStrategy }}
    16    strategy:
    17      {{ toYaml .Values.updateStrategy | nindent 4 | trim }}
    18    {{- end }}
    19    template:
    20      metadata:
    21        {{- with .Values.podAnnotations }}
    22        annotations:
    23          {{- toYaml . | nindent 8 }}
    24        {{- end }}
    25        labels:
    26          {{- include "kubeblocks.selectorLabels" . | nindent 8 }}
    27      spec:
    28        priorityClassName: {{ template "kubeblocks.priorityClassName" . }}
    29        {{- with .Values.image.imagePullSecrets }}
    30        imagePullSecrets:
    31          {{- toYaml . | nindent 8 }}
    32        {{- end }}
    33        serviceAccountName: {{ include "kubeblocks.serviceAccountName" . }}
    34        securityContext:
    35          {{- toYaml .Values.podSecurityContext | nindent 8 }}
    36        initContainers: # only download tools image to local
    37          - name: tools
    38            image: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tools.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
    39            imagePullPolicy: {{ .Values.image.pullPolicy }}
    40            command:
    41              - /bin/true
    42          - name: datascript
    43            image: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.datascript.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
    44            imagePullPolicy: {{ .Values.image.pullPolicy }}
    45            command:
    46              - /bin/true
    47        containers:
    48          - name: manager
    49            args:
    50              - "--health-probe-bind-address=:8081"
    51              - "--metrics-bind-address=:8080"
    52              - "--leader-elect"
    53              - "--zap-devel={{- default "false" .Values.loggerSettings.developmentMode }}"
    54              - "--zap-time-encoding={{- default "iso8601" .Values.loggerSettings.timeEncoding }}"
    55              {{- with .Values.loggerSettings.level }}
    56              - "--zap-log-level={{ . }}"
    57              {{- end }}
    58              {{- with .Values.loggerSettings.encoder }}
    59              - "--zap-encoder={{ . }}"
    60              {{- end }}
    61              - "--extensions={{- default "true" ( include "kubeblocks.addonControllerEnabled" . ) }}"
    62              - "--apps=true"
    63              - "--workloads=true"
    64              - "--storage=true"
    65            env:
    66              - name: CM_NAMESPACE
    67                value: {{ .Release.Namespace }}
    68              {{- with .Values.affinity }}
    69              - name: CM_AFFINITY
    70                value: {{ toJson . | quote }}
    71              {{- end }}
    72              {{- with .Values.nodeSelector }}
    73              - name: CM_NODE_SELECTOR
    74                value: {{ toJson . | quote }}
    75              {{- end }}
    76              {{- with .Values.tolerations }}
    77              - name: CM_TOLERATIONS
    78                value: {{ toJson . | quote }}
    79              {{- end }}
    80              - name: KUBEBLOCKS_IMAGE_PULL_POLICY
    81                value: {{ .Values.image.pullPolicy }}
    82              - name: KUBEBLOCKS_TOOLS_IMAGE
    83                value: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tools.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
    84              - name: KUBEBLOCKS_DATASCRIPT_CLIENTS_IMAGE
    85                value: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.datascript.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
    86              - name: KUBEBLOCKS_SERVICEACCOUNT_NAME
    87                value: {{ include "kubeblocks.serviceAccountName" . }}
    88              {{- if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1" }}
    89              - name: VOLUMESNAPSHOT_API_BETA
    90                value: "false"
    91              {{- else if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1" }}
    92              - name: VOLUMESNAPSHOT_API_BETA
    93                value: "true"
    94              {{- end }}
    95              {{- if .Values.admissionWebhooks.enabled }}
    96              - name: ENABLE_WEBHOOKS
    97                value: "true"
    98              {{- end }}
    99              - name: ENABLE_RBAC_MANAGER
   100                value: {{ .Values.rbac.enabled | quote}}
   101              {{- if ( include "kubeblocks.addonControllerEnabled" . ) | deepEqual "true" }}
   102              - name: ADDON_JOB_TTL
   103                value: {{ .jobTTL | quote }}
   104              - name: ADDON_JOB_IMAGE_PULL_POLICY
   105                value: {{ .jobImagePullPolicy | default "IfNotPresent" }}
   106              - name: KUBEBLOCKS_ADDON_SA_NAME
   107                value: {{ include "kubeblocks.addonSAName" . }}
   108              - name: KUBEBLOCKS_ADDON_HELM_INSTALL_OPTIONS
   109                value: {{ join " " .Values.addonHelmInstallOptions }}
   110              {{- end }}
   111              {{- if .Values.enabledAlphaFeatureGates.recoverVolumeExpansionFailure }}
   112              - name: RECOVER_VOLUME_EXPANSION_FAILURE
   113                value: "true"
   114              {{- end }}
   115              - name: DP_ENCRYPTION_KEY
   116                valueFrom:
   117                  secretKeyRef:
   118                    name: {{ include "kubeblocks.fullname" . }}-secret
   119                    key: dataProtectionEncryptionKey
   120              - name: KUBE_PROVIDER
   121                value: {{ .Values.provider | quote }}
   122            {{- with .Values.securityContext }}
   123            securityContext:
   124              {{- toYaml . | nindent 12 }}
   125            {{- end }}
   126            image: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
   127            imagePullPolicy: {{ .Values.image.pullPolicy }}
   128            ports:
   129              - name: webhook-server
   130                containerPort: 9443
   131                protocol: TCP
   132              - name: health
   133                containerPort: 8081
   134                protocol: TCP
   135              - name: metrics
   136                containerPort: 8080
   137                protocol: TCP
   138            livenessProbe:
   139              httpGet:
   140                path: /healthz
   141                port: health
   142              initialDelaySeconds: 15
   143              periodSeconds: 20
   144            readinessProbe:
   145              httpGet:
   146                path: /readyz
   147                port: health
   148              initialDelaySeconds: 5
   149              periodSeconds: 10
   150            resources:
   151              {{- toYaml .Values.resources | nindent 12 }}
   152            volumeMounts:
   153            - mountPath: /etc/kubeblocks
   154              name: manager-config
   155            {{- if .Values.admissionWebhooks.enabled }}
   156              - mountPath: /tmp/k8s-webhook-server/serving-certs
   157                name: cert
   158                readOnly: true
   159            {{- end }}
   160        {{- if .Values.hostNetwork }}
   161        hostNetwork: {{ .Values.hostNetwork }}
   162        {{- end }}
   163        {{- if .Values.dnsPolicy }}
   164        dnsPolicy: {{ .Values.dnsPolicy }}
   165        {{- end }}
   166        {{- with .Values.topologySpreadConstraints }}
   167        topologySpreadConstraints:
   168          {{- toYaml . | nindent 8 }}
   169        {{- end }}
   170        {{- with .Values.affinity }}
   171        affinity:
   172          {{- toYaml . | nindent 8 }}
   173        {{- end }}
   174        {{- with .Values.nodeSelector }}
   175        nodeSelector:
   176          {{- toYaml . | nindent 8 }}
   177        {{- end }}
   178        {{- with .Values.tolerations }}
   179        tolerations:
   180          {{- toYaml . | nindent 8 }}
   181        {{- end }}
   182        terminationGracePeriodSeconds: 10
   183        volumes:
   184          - name: manager-config
   185            configMap:
   186              name: {{ include "kubeblocks.fullname" . }}-manager-config
   187          {{- if .Values.admissionWebhooks.enabled }}
   188          - name: cert
   189            secret:
   190              defaultMode: 420
   191              secretName: {{ include "kubeblocks.fullname" . }}.{{ .Release.Namespace }}.svc.tls-pair
   192          {{- end }}