44{{- end }}
55{{- end }}
66
7+ {{- /* Safe accessor for dvcr storage type to avoid nil pointer during linting */ -}}
8+ {{- define " dvcr.storageType" -}}
9+ {{- $mc := .Values.virtualization.internal.moduleConfig | default dict -}}
10+ {{- dig " dvcr" " storage" " type" " " $mc -}}
11+ {{- end -}}
12+
713{{- define " dvcr.envs" -}}
814- name: REGISTRY_HTTP_TLS_CERTIFICATE
915 value: /etc/ssl/docker/tls.crt
2329 name: dvcr-secrets
2430 key: salt
2531
26- {{- if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " PersistentVolumeClaim" }}
32+ {{- if eq (include " dvcr.storageType " . ) " PersistentVolumeClaim" }}
2733- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
2834 value: " /var/lib/registry"
29- {{- else if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " ObjectStorage" }}
30- {{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.type " S3" }}
35+ {{- else if eq (include " dvcr.storageType " . ) " ObjectStorage" }}
36+ {{- if eq (dig " dvcr " " storage " " objectStorage " " type " " " .Values.virtualization.internal.moduleConfig ) " S3" }}
3137- name: REGISTRY_STORAGE_S3_REGION
32- value: " {{ .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.s3.region }}"
38+ value: " {{ dig " dvcr " " storage " " objectStorage " " s3 " " region " " " .Values.virtualization.internal.moduleConfig }}"
3339- name: REGISTRY_STORAGE_S3_BUCKET
34- value: " {{ .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.s3.bucket }}"
40+ value: " {{ dig " dvcr " " storage " " objectStorage " " s3 " " bucket " " " .Values.virtualization.internal.moduleConfig }}"
3541- name: REGISTRY_STORAGE_S3_ACCESSKEY
3642 valueFrom:
3743 secretKeyRef:
4349 name: dvcr-object-storage-credentials
4450 key: s3SecretKey
4551- name: REGISTRY_STORAGE_S3_REGIONENDPOINT
46- value: " {{ .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.s3.regionEndpoint }}"
52+ value: " {{ dig " dvcr " " storage " " objectStorage " " s3 " " regionEndpoint " " " .Values.virtualization.internal.moduleConfig }}"
4753 {{- end }}
4854{{- end }}
4955{{- end }}
5359- name: " dvcr-config"
5460 mountPath: " /etc/docker/registry"
5561
56- {{- if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " PersistentVolumeClaim" }}
62+ {{- if eq (include " dvcr.storageType " . ) " PersistentVolumeClaim" }}
5763- name: data
5864 mountPath: /var/lib/registry/
5965{{- end }}
7480 configMap:
7581 name: dvcr-config
7682
77- {{- if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " PersistentVolumeClaim" }}
83+ {{- if eq (include " dvcr.storageType " . ) " PersistentVolumeClaim" }}
7884- name: data
7985 persistentVolumeClaim:
8086 claimName: dvcr
@@ -94,18 +100,18 @@ true
94100
95101
96102{{- define " dvcr.helm_lib_deployment_strategy_and_replicas_for_ha" -}}
97- {{- if and (include " helm_lib_ha_enabled" . ) (eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " ObjectStorage" ) }}
103+ {{- if and (include " helm_lib_ha_enabled" . ) (eq (include " dvcr.storageType " . ) " ObjectStorage" ) }}
98104replicas: 2
99105strategy:
100106 type: RollingUpdate
101107 rollingUpdate:
102108 maxSurge: 0
103109 maxUnavailable: 1
104- {{- else if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " ObjectStorage" }}
110+ {{- else if eq (include " dvcr.storageType " . ) " ObjectStorage" }}
105111replicas: 1
106112strategy:
107113 type: RollingUpdate
108- {{- else if eq .Values.virtualization.internal.moduleConfig. dvcr.storage.type " PersistentVolumeClaim" }}
114+ {{- else if eq (include " dvcr.storageType " . ) " PersistentVolumeClaim" }}
109115replicas: 1
110116strategy:
111117 type: Recreate
@@ -116,7 +122,7 @@ strategy:
116122 {{- $context := index . 0 -}}
117123 {{- $yes := index . 1 -}}
118124 {{- $no := index . 2 -}}
119- {{- if and (include " helm_lib_ha_enabled" $context ) (eq $context .Values.virtualization.internal.moduleConfig. dvcr.storage.type " ObjectStorage" ) }}
125+ {{- if and (include " helm_lib_ha_enabled" $context ) (eq (include " dvcr.storageType " $context ) " ObjectStorage" ) }}
120126 {{- $yes -}}
121127 {{- else }}
122128 {{- $no -}}
0 commit comments