github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/examples/helm-charts/chart/templates/deployment.yaml (about)

     1  apiVersion: apps/v1
     2  kind: Deployment
     3  metadata:
     4    name: {{ template "podinfo.fullname" . }}
     5    labels:
     6      {{- include "podinfo.labels" . | nindent 4 }}
     7  spec:
     8    {{- if not .Values.hpa.enabled }}
     9    replicas: {{ .Values.replicaCount }}
    10    {{- end }}
    11    strategy:
    12      type: RollingUpdate
    13      rollingUpdate:
    14        maxUnavailable: 1
    15    selector:
    16      matchLabels:
    17        {{- include "podinfo.selectorLabels" . | nindent 6 }}
    18    template:
    19      metadata:
    20        labels:
    21          {{- include "podinfo.selectorLabels" . | nindent 8 }}
    22        annotations:
    23          prometheus.io/scrape: "true"
    24          prometheus.io/port: "{{ .Values.service.httpPort }}"
    25          {{- range $key, $value := .Values.podAnnotations }}
    26          {{ $key }}: {{ $value | quote }}
    27          {{- end }}
    28      spec:
    29        terminationGracePeriodSeconds: 30
    30        {{- if .Values.serviceAccount.enabled }}
    31        serviceAccountName: {{ template "podinfo.serviceAccountName" . }}
    32        {{- end }}
    33        containers:
    34          - name: {{ .Chart.Name }}
    35            image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
    36            imagePullPolicy: {{ .Values.image.pullPolicy }}
    37            {{- if .Values.securityContext }}
    38            securityContext:
    39              {{- toYaml .Values.securityContext | nindent 12 }}
    40            {{- else if (or .Values.service.hostPort .Values.tls.hostPort) }}
    41            securityContext:
    42              allowPrivilegeEscalation: true
    43              capabilities:
    44                drop:
    45                  - ALL
    46                add:
    47                  - NET_BIND_SERVICE
    48            {{- end }}
    49            command:
    50              - ./podinfo
    51              - --port={{ .Values.service.httpPort | default 9898 }}
    52              {{- if .Values.host }}
    53              - --host={{ .Values.host }}
    54              {{- end }}
    55              {{- if .Values.tls.enabled }}
    56              - --secure-port={{ .Values.tls.port }}
    57              {{- end }}
    58              {{- if .Values.tls.certPath }}
    59              - --cert-path={{ .Values.tls.certPath }}
    60              {{- end }}
    61              {{- if .Values.service.metricsPort }}
    62              - --port-metrics={{ .Values.service.metricsPort }}
    63              {{- end }}
    64              {{- if .Values.service.grpcPort }}
    65              - --grpc-port={{ .Values.service.grpcPort }}
    66              {{- end }}
    67              {{- if .Values.service.grpcService }}
    68              - --grpc-service-name={{ .Values.service.grpcService }}
    69              {{- end }}
    70              {{- range .Values.backends }}
    71              - --backend-url={{ . }}
    72              {{- end }}
    73              {{- if .Values.cache }}
    74              - --cache-server={{ .Values.cache }}
    75              {{- else if .Values.redis.enabled }}
    76              - --cache-server=tcp://{{ template "podinfo.fullname" . }}-redis:6379
    77              {{- end }}
    78              - --level={{ .Values.logLevel }}
    79              - --random-delay={{ .Values.faults.delay }}
    80              - --random-error={{ .Values.faults.error }}
    81              {{- if .Values.faults.unhealthy }}
    82              - --unhealthy
    83              {{- end }}
    84              {{- if .Values.faults.unready }}
    85              - --unready
    86              {{- end }}
    87              {{- if .Values.h2c.enabled }}
    88              - --h2c
    89              {{- end }}
    90            env:
    91            {{- if .Values.ui.message }}
    92            - name: PODINFO_UI_MESSAGE
    93              value: {{ quote .Values.ui.message }}
    94            {{- end }}
    95            {{- if .Values.ui.logo }}
    96            - name: PODINFO_UI_LOGO
    97              value: {{ .Values.ui.logo }}
    98            {{- end }}
    99            {{- if .Values.ui.color }}
   100            - name: PODINFO_UI_COLOR
   101              value: {{ quote .Values.ui.color }}
   102            {{- end }}
   103            {{- if .Values.backend }}
   104            - name: PODINFO_BACKEND_URL
   105              value: {{ .Values.backend }}
   106            {{- end }}
   107            ports:
   108              - name: http
   109                containerPort: {{ .Values.service.httpPort | default 9898 }}
   110                protocol: TCP
   111                {{- if .Values.service.hostPort }}
   112                hostPort: {{ .Values.service.hostPort }}
   113                {{- end }}
   114              {{- if .Values.tls.enabled }}
   115              - name: https
   116                containerPort: {{ .Values.tls.port | default 9899 }}
   117                protocol: TCP
   118                {{- if .Values.tls.hostPort }}
   119                hostPort: {{ .Values.tls.hostPort }}
   120                {{- end }}
   121              {{- end }}
   122              {{- if .Values.service.metricsPort }}
   123              - name: http-metrics
   124                containerPort: {{ .Values.service.metricsPort }}
   125                protocol: TCP
   126              {{- end }}
   127              {{- if .Values.service.grpcPort }}
   128              - name: grpc
   129                containerPort: {{ .Values.service.grpcPort }}
   130                protocol: TCP
   131              {{- end }}
   132            {{- if .Values.probes.startup.enable }}
   133            startupProbe:
   134              exec:
   135                command:
   136                - podcli
   137                - check
   138                - http
   139                - localhost:{{ .Values.service.httpPort | default 9898 }}/healthz
   140              {{- with .Values.probes.startup }}
   141              initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
   142              timeoutSeconds: {{ .timeoutSeconds | default 5 }}
   143              failureThreshold: {{ .failureThreshold | default 3 }}
   144              successThreshold: {{ .successThreshold | default 1 }}
   145              periodSeconds: {{ .periodSeconds | default 10 }}
   146              {{- end }}
   147              {{- end }}
   148            livenessProbe:
   149              exec:
   150                command:
   151                - podcli
   152                - check
   153                - http
   154                - localhost:{{ .Values.service.httpPort | default 9898 }}/healthz
   155              {{- with .Values.probes.liveness }}
   156              initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
   157              timeoutSeconds: {{ .timeoutSeconds | default 5 }}
   158              failureThreshold: {{ .failureThreshold | default 3 }}
   159              successThreshold: {{ .successThreshold | default 1 }}
   160              periodSeconds: {{ .periodSeconds | default 10 }}
   161              {{- end }}
   162            readinessProbe:
   163              exec:
   164                command:
   165                - podcli
   166                - check
   167                - http
   168                - localhost:{{ .Values.service.httpPort | default 9898 }}/readyz
   169              {{- with .Values.probes.readiness }}
   170              initialDelaySeconds: {{ .initialDelaySeconds | default 1 }}
   171              timeoutSeconds: {{ .timeoutSeconds | default 5 }}
   172              failureThreshold: {{ .failureThreshold | default 3 }}
   173              successThreshold: {{ .successThreshold | default 1 }}
   174              periodSeconds: {{ .periodSeconds | default 10 }}
   175              {{- end }}
   176            volumeMounts:
   177            - name: data
   178              mountPath: /data
   179            {{- if .Values.tls.enabled }}
   180            - name: tls
   181              mountPath: {{ .Values.tls.certPath | default "/data/cert" }}
   182              readOnly: true
   183            {{- end }}
   184            resources:
   185  {{ toYaml .Values.resources | indent 12 }}
   186      {{- with .Values.nodeSelector }}
   187        nodeSelector:
   188  {{ toYaml . | indent 8 }}
   189      {{- end }}
   190      {{- with .Values.affinity }}
   191        affinity:
   192  {{ toYaml . | indent 8 }}
   193      {{- end }}
   194      {{- with .Values.tolerations }}
   195        tolerations:
   196  {{ toYaml . | indent 8 }}
   197      {{- end }}
   198        volumes:
   199        - name: data
   200          emptyDir: {}
   201        {{- if .Values.tls.enabled }}
   202        - name: tls
   203          secret:
   204            secretName: {{ template "podinfo.tlsSecretName" . }}
   205        {{- end }}