| gio | 4a9d83d | 2024-04-14 13:14:40 +0400 | [diff] [blame^] | 1 | apiVersion: apps/v1 |
| 2 | kind: Deployment |
| 3 | metadata: |
| 4 | name: {{ include "zot.fullname" . }} |
| 5 | labels: |
| 6 | {{- include "zot.labels" . | nindent 4 }} |
| 7 | spec: |
| 8 | replicas: {{ .Values.replicaCount }} |
| 9 | {{- with .Values.strategy }} |
| 10 | strategy: |
| 11 | {{- toYaml . | nindent 4 }} |
| 12 | {{- end }} |
| 13 | selector: |
| 14 | matchLabels: |
| 15 | {{- include "zot.selectorLabels" . | nindent 6 }} |
| 16 | template: |
| 17 | metadata: |
| 18 | annotations: |
| 19 | {{- with .Values.podAnnotations }} |
| 20 | {{- toYaml . | nindent 8 }} |
| 21 | {{- end }} |
| 22 | {{- if and .Values.mountConfig .Values.configFiles }} |
| 23 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 24 | {{- end }} |
| 25 | {{- if .Values.forceRoll }} |
| 26 | rollme: {{ randAlphaNum 5 | quote }} |
| 27 | {{- end }} |
| 28 | labels: |
| 29 | {{- include "zot.selectorLabels" . | nindent 8 }} |
| 30 | spec: |
| 31 | {{- with .Values.imagePullSecrets }} |
| 32 | imagePullSecrets: |
| 33 | {{- toYaml . | nindent 8 }} |
| 34 | {{- end }} |
| 35 | serviceAccountName: {{ include "zot.serviceAccountName" . }} |
| 36 | securityContext: |
| 37 | {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 38 | containers: |
| 39 | - name: {{ .Chart.Name }} |
| 40 | securityContext: |
| 41 | {{- toYaml .Values.securityContext | nindent 12 }} |
| 42 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 43 | imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 44 | env: |
| 45 | {{- toYaml .Values.env | nindent 12 }} |
| 46 | ports: |
| 47 | - name: zot |
| 48 | containerPort: 5000 |
| 49 | protocol: TCP |
| 50 | {{- if or (not (empty .Values.extraVolumeMounts)) .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets }} |
| 51 | volumeMounts: |
| 52 | {{- if .Values.mountConfig }} |
| 53 | - mountPath: '/etc/zot' |
| 54 | name: {{ .Release.Name }}-config |
| 55 | {{- end }} |
| 56 | {{- if .Values.mountSecret }} |
| 57 | - mountPath: '/secret' |
| 58 | name: {{ .Release.Name }}-secret |
| 59 | {{- end }} |
| 60 | {{- range .Values.externalSecrets }} |
| 61 | - mountPath: {{ .mountPath | quote }} |
| 62 | name: {{ .secretName | quote }} |
| 63 | {{- end }} |
| 64 | {{- if .Values.persistence }} |
| 65 | - mountPath: '/var/lib/registry' |
| 66 | name: {{ .Release.Name }}-volume |
| 67 | {{- end }} |
| 68 | {{- with .Values.extraVolumeMounts }} |
| 69 | {{- toYaml . | nindent 12 }} |
| 70 | {{- end }} |
| 71 | {{- end }} |
| 72 | livenessProbe: |
| 73 | initialDelaySeconds: 5 |
| 74 | httpGet: |
| 75 | path: /v2/ |
| 76 | port: 5000 |
| 77 | scheme: {{ .Values.httpGet.scheme }} |
| 78 | {{- if .Values.authHeader }} |
| 79 | httpHeaders: |
| 80 | - name: Authorization |
| 81 | value: Basic {{ .Values.authHeader }} |
| 82 | {{- end }} |
| 83 | readinessProbe: |
| 84 | initialDelaySeconds: 5 |
| 85 | httpGet: |
| 86 | path: /v2/ |
| 87 | port: 5000 |
| 88 | scheme: {{ .Values.httpGet.scheme }} |
| 89 | {{- if .Values.authHeader }} |
| 90 | httpHeaders: |
| 91 | - name: Authorization |
| 92 | value: Basic {{ .Values.authHeader }} |
| 93 | {{- end }} |
| 94 | startupProbe: |
| 95 | initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} |
| 96 | periodSeconds: {{ .Values.startupProbe.periodSeconds }} |
| 97 | failureThreshold: {{ .Values.startupProbe.failureThreshold }} |
| 98 | httpGet: |
| 99 | path: /v2/ |
| 100 | port: 5000 |
| 101 | scheme: {{ .Values.httpGet.scheme }} |
| 102 | {{- if .Values.authHeader }} |
| 103 | httpHeaders: |
| 104 | - name: Authorization |
| 105 | value: Basic {{ .Values.authHeader }} |
| 106 | {{- end }} |
| 107 | resources: |
| 108 | {{- toYaml .Values.resources | nindent 12 }} |
| 109 | {{- if or .Values.mountConfig .Values.mountSecret .Values.persistence .Values.externalSecrets (not (empty .Values.extraVolumes))}} |
| 110 | volumes: |
| 111 | {{- if .Values.mountConfig }} |
| 112 | - name: {{ .Release.Name }}-config |
| 113 | configMap: |
| 114 | name: {{ .Release.Name }}-config |
| 115 | {{- end }} |
| 116 | {{- if .Values.mountSecret }} |
| 117 | - name: {{ .Release.Name }}-secret |
| 118 | secret: |
| 119 | secretName: {{ .Release.Name }}-secret |
| 120 | {{- end }} |
| 121 | {{- range .Values.externalSecrets }} |
| 122 | - name: {{ .secretName }} |
| 123 | secret: |
| 124 | secretName: {{ .secretName }} |
| 125 | {{- end }} |
| 126 | {{- if .Values.persistence }} |
| 127 | - name: {{ .Release.Name }}-volume |
| 128 | persistentVolumeClaim: |
| 129 | claimName: {{ .Values.pvc.name | default (printf "%s-pvc" .Release.Name) }} |
| 130 | {{- end }} |
| 131 | {{- with .Values.extraVolumes }} |
| 132 | {{- toYaml . | nindent 8 }} |
| 133 | {{- end }} |
| 134 | {{- end }} |
| 135 | {{- with .Values.nodeSelector }} |
| 136 | nodeSelector: |
| 137 | {{- toYaml . | nindent 8 }} |
| 138 | {{- end }} |
| 139 | {{- with .Values.affinity }} |
| 140 | affinity: |
| 141 | {{- toYaml . | nindent 8 }} |
| 142 | {{- end }} |
| 143 | {{- with .Values.tolerations }} |
| 144 | tolerations: |
| 145 | {{- toYaml . | nindent 8 }} |
| 146 | {{- end }} |