|
| 1 | +{{- if eq .Values.type "statefulset" -}} |
| 2 | +apiVersion: apps/v1 |
| 3 | +kind: StatefulSet |
| 4 | +metadata: |
| 5 | + name: {{ template "verdaccio.fullname" . }} |
| 6 | + labels: |
| 7 | + {{- include "verdaccio.labels" . | nindent 4 }} |
| 8 | + {{- with .Values.annotations }} |
| 9 | + annotations: |
| 10 | + {{- toYaml . | nindent 4 }} |
| 11 | + {{- end }} |
| 12 | +spec: |
| 13 | + serviceName: {{ template "verdaccio.fullname" . }} |
| 14 | + {{- if .Values.replicaCountEnabled }} |
| 15 | + replicas: {{ .Values.replicaCount }} |
| 16 | + {{- else }} |
| 17 | + replicas: 1 |
| 18 | + {{- end}} |
| 19 | + selector: |
| 20 | + matchLabels: |
| 21 | + {{- include "verdaccio.selectorLabels" . | nindent 6 }} |
| 22 | + updateStrategy: |
| 23 | + type: RollingUpdate |
| 24 | + template: |
| 25 | + metadata: |
| 26 | + annotations: |
| 27 | + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 28 | + checksum/htpasswd-secret: {{ toJson .Values.secrets.htpasswd | sha256sum }} |
| 29 | + {{- if .Values.secretEnvVars }} |
| 30 | + checksum/env-secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} |
| 31 | + {{- end }} |
| 32 | + {{- if .Values.cachingNginx.enabled }} |
| 33 | + checksum/config-nginx: {{ include (print $.Template.BasePath "/configmap-nginx.yaml") . | sha256sum }} |
| 34 | + {{- end }} |
| 35 | + {{- include "verdaccio.podAnnotations" . | nindent 8 }} |
| 36 | + labels: |
| 37 | + {{- include "verdaccio.podLabels" . | nindent 8 }} |
| 38 | + spec: |
| 39 | + serviceAccountName: {{ include "verdaccio.serviceAccountName" . }} |
| 40 | + {{- include "verdaccio.imagePullSecrets" . | nindent 6 }} |
| 41 | + {{- with .Values.podSecurityContext }} |
| 42 | + securityContext: |
| 43 | + {{- toYaml . | nindent 8 }} |
| 44 | + {{- end }} |
| 45 | + {{- with .Values.extraInitContainers }} |
| 46 | + initContainers: |
| 47 | + {{- include "tplvalues.render" (dict "value" . "context" $) | nindent 8 }} |
| 48 | + {{- end }} |
| 49 | + containers: |
| 50 | + {{- if .Values.cachingNginx.enabled }} |
| 51 | + - name: {{ template "verdaccio.name" . }}-nginx |
| 52 | + imagePullPolicy: {{ .Values.cachingNginx.pullPolicy }} |
| 53 | + image: {{ .Values.cachingNginx.repository }}:{{ .Values.cachingNginx.tag }} |
| 54 | + volumeMounts: |
| 55 | + - name: config-volume |
| 56 | + mountPath: /etc/nginx/nginx.conf |
| 57 | + subPath: nginx.conf |
| 58 | + - name: config-volume |
| 59 | + mountPath: /etc/nginx/conf.d/default.conf |
| 60 | + subPath: default.conf |
| 61 | + resources: |
| 62 | + {{ toYaml .Values.cachingNginx.resources | nindent 12 }} |
| 63 | + ports: |
| 64 | + - containerPort: 80 |
| 65 | + name: caching-nginx |
| 66 | + {{- end }} |
| 67 | + - name: {{ template "verdaccio.name" . }} |
| 68 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 69 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 70 | + {{- if or .Values.secretEnvVars .Values.existingSecret }} |
| 71 | + envFrom: |
| 72 | + {{- if .Values.secretEnvVars }} |
| 73 | + - secretRef: |
| 74 | + name: {{ template "verdaccio.fullname" . }}-env |
| 75 | + {{- end }} |
| 76 | + {{- if .Values.existingSecret }} |
| 77 | + - secretRef: |
| 78 | + name: {{ .Values.existingSecret }} |
| 79 | + {{- end }} |
| 80 | + {{- end }} |
| 81 | + ports: |
| 82 | + - containerPort: 4873 |
| 83 | + name: http |
| 84 | + {{- range .Values.extraPorts }} |
| 85 | + - containerPort: {{ .port }} |
| 86 | + name: {{ .targetPort }} |
| 87 | + {{- end }} |
| 88 | + livenessProbe: |
| 89 | + httpGet: |
| 90 | + path: /-/ping |
| 91 | + port: http |
| 92 | + {{- with .Values.livenessProbe }} |
| 93 | + initialDelaySeconds: {{ .initialDelaySeconds | default 5 }} |
| 94 | + periodSeconds: {{ .periodSeconds | default 10 }} |
| 95 | + timeoutSeconds: {{ .timeoutSeconds | default 1 }} |
| 96 | + successThreshold: {{ .successThreshold | default 1 }} |
| 97 | + failureThreshold: {{ .failureThreshold | default 3 }} |
| 98 | + {{- end }} |
| 99 | + readinessProbe: |
| 100 | + httpGet: |
| 101 | + path: /-/ping |
| 102 | + port: http |
| 103 | + {{- with .Values.readinessProbe }} |
| 104 | + initialDelaySeconds: {{ .initialDelaySeconds | default 5 }} |
| 105 | + periodSeconds: {{ .periodSeconds | default 10 }} |
| 106 | + timeoutSeconds: {{ .timeoutSeconds | default 1 }} |
| 107 | + successThreshold: {{ .successThreshold | default 1 }} |
| 108 | + failureThreshold: {{ .failureThreshold | default 3 }} |
| 109 | + {{- end }} |
| 110 | + {{- with .Values.securityContext }} |
| 111 | + securityContext: |
| 112 | + {{- toYaml . | nindent 12 }} |
| 113 | + {{- end }} |
| 114 | + {{- with .Values.resources }} |
| 115 | + resources: |
| 116 | + {{- toYaml . | nindent 12 }} |
| 117 | + {{- end }} |
| 118 | + volumeMounts: |
| 119 | + {{- with .Values.persistence.mounts }} |
| 120 | + {{- include "tplvalues.render" (dict "value" . "context" $) | nindent 12 }} |
| 121 | + {{- end }} |
| 122 | + - mountPath: /verdaccio/storage |
| 123 | + name: storage |
| 124 | + readOnly: false |
| 125 | + {{- if .Values.secrets.htpasswd }} |
| 126 | + - mountPath: /verdaccio/storage/htpasswd |
| 127 | + name: htpasswd |
| 128 | + subPath: htpasswd |
| 129 | + readOnly: true |
| 130 | + {{- end }} |
| 131 | + - mountPath: /verdaccio/conf |
| 132 | + name: config |
| 133 | + readOnly: true |
| 134 | + {{- with .Values.extraEnvVars }} |
| 135 | + env: |
| 136 | + {{- toYaml . | nindent 12 }} |
| 137 | + {{- end }} |
| 138 | + volumes: |
| 139 | + - name: config |
| 140 | + configMap: |
| 141 | + name: {{ .Values.existingConfigMap | default (include "verdaccio.fullname" .) }} |
| 142 | + {{- if .Values.secrets.htpasswd }} |
| 143 | + - name: htpasswd |
| 144 | + secret: |
| 145 | + secretName: {{ include "verdaccio.fullname" . }}-htpasswd |
| 146 | + {{- end }} |
| 147 | + {{- if .Values.cachingNginx.enabled }} |
| 148 | + - name: config-volume |
| 149 | + configMap: |
| 150 | + name: {{ include "verdaccio.fullname" . }}-nginx-config |
| 151 | + {{- end }} |
| 152 | + {{- with .Values.persistence.volumes }} |
| 153 | + {{- include "tplvalues.render" (dict "value" . "context" $) | nindent 6 }} |
| 154 | + {{- end }} |
| 155 | + {{- if .Values.affinity }} |
| 156 | + affinity: |
| 157 | + {{- toYaml .Values.affinity | nindent 8 }} |
| 158 | + {{- end }} |
| 159 | + {{- if .Values.nodeSelector }} |
| 160 | + nodeSelector: |
| 161 | + {{- toYaml .Values.nodeSelector | nindent 8 }} |
| 162 | + {{- end }} |
| 163 | + {{- if .Values.tolerations }} |
| 164 | + tolerations: |
| 165 | + {{- toYaml .Values.tolerations | nindent 8 }} |
| 166 | + {{- end }} |
| 167 | + {{- if .Values.priorityClass.enabled }} |
| 168 | + priorityClassName: {{ .Values.priorityClass.name }} |
| 169 | + {{- end }} |
| 170 | + {{- if .Values.topologySpreadConstraints }} |
| 171 | + topologySpreadConstraints: |
| 172 | + {{- toYaml .Values.topologySpreadConstraints | nindent 8 }} |
| 173 | + {{- end }} |
| 174 | + volumeClaimTemplates: |
| 175 | + - metadata: |
| 176 | + name: storage |
| 177 | + spec: |
| 178 | + accessModes: [ {{ .Values.persistence.accessMode | quote }} ] |
| 179 | + {{- if (eq "-" .Values.persistence.storageClass) }} |
| 180 | + storageClassName: "" |
| 181 | + {{- else }} |
| 182 | + storageClassName: "{{ .Values.persistence.storageClass }}" |
| 183 | + {{- end }} |
| 184 | + resources: |
| 185 | + requests: |
| 186 | + storage: {{ .Values.persistence.size | quote }} |
| 187 | +{{- end -}} |
0 commit comments