@@ -3,37 +3,7 @@ Copyright Broadcom, Inc. All Rights Reserved.
3
3
SPDX-License-Identifier : APACHE-2.0
4
4
*/}}
5
5
6
- {{- $secretName := .Values.registry.existingSecret -}}
7
- {{- $namespace := .Release.Namespace -}}
8
- {{- $secret := lookup "v1" "Secret" $namespace $secretName -}}
9
- {{- $existingEnvVarsSecretRegistry := dict -}}
10
- {{- if $secret.data }}
11
- {{- $_REGISTRY_HTPASSWD := index $secret.data "REGISTRY_HTPASSWD" | default "" -}}
12
- {{- $_REGISTRY_HTTP_SECRET := index $secret.data "REGISTRY_HTTP_SECRET" | default "" -}}
13
- {{- $_REGISTRY_REDIS_PASSWORD := index $secret.data "REGISTRY_REDIS_PASSWORD" | default "" -}}
14
- {{- $_REGISTRY_STORAGE_AZURE_ACCOUNTKEY := index $secret.data "REGISTRY_STORAGE_AZURE_ACCOUNTKEY" | default "" -}}
15
- {{- $_GCS_KEY_DATA := index $secret.data "GCS_KEY_DATA" | default "" -}}
16
- {{- $_REGISTRY_STORAGE_S3_ACCESSKEY := index $secret.data "REGISTRY_STORAGE_S3_ACCESSKEY" | default "" -}}
17
- {{- $_REGISTRY_STORAGE_S3_SECRETKEY := index $secret.data "REGISTRY_STORAGE_S3_SECRETKEY" | default "" -}}
18
- {{- $_REGISTRY_STORAGE_SWIFT_PASSWORD := index $secret.data "REGISTRY_STORAGE_SWIFT_PASSWORD" | default "" -}}
19
- {{- $_REGISTRY_STORAGE_SWIFT_SECRETKEY := index $secret.data "REGISTRY_STORAGE_SWIFT_SECRETKEY" | default "" -}}
20
- {{- $_REGISTRY_STORAGE_SWIFT_ACCESSKEY := index $secret.data "REGISTRY_STORAGE_SWIFT_ACCESSKEY" | default "" -}}
21
- {{- $_REGISTRY_STORAGE_OSS_ACCESSKEYSECRET := index $secret.data "REGISTRY_STORAGE_OSS_ACCESSKEYSECRET" | default "" -}}
22
- {{- $existingEnvVarsSecretRegistry = dict
23
- " REGISTRY_HTPASSWD" ($_REGISTRY_HTPASSWD | b64dec)
24
- " REGISTRY_HTTP_SECRET" ($_REGISTRY_HTTP_SECRET | b64dec)
25
- " REGISTRY_REDIS_PASSWORD" ($_REGISTRY_REDIS_PASSWORD | b64dec)
26
- " REGISTRY_STORAGE_AZURE_ACCOUNTKEY" ($_REGISTRY_STORAGE_AZURE_ACCOUNTKEY | b64dec)
27
- " GCS_KEY_DATA" ($_GCS_KEY_DATA | b64dec)
28
- " REGISTRY_STORAGE_S3_ACCESSKEY" ($_REGISTRY_STORAGE_S3_ACCESSKEY | b64dec)
29
- " REGISTRY_STORAGE_S3_SECRETKEY" ($_REGISTRY_STORAGE_S3_SECRETKEY | b64dec)
30
- " REGISTRY_STORAGE_SWIFT_PASSWORD" ($_REGISTRY_STORAGE_SWIFT_PASSWORD | b64dec)
31
- " REGISTRY_STORAGE_SWIFT_SECRETKEY" ($_REGISTRY_STORAGE_SWIFT_SECRETKEY | b64dec)
32
- " REGISTRY_STORAGE_SWIFT_ACCESSKEY" ($_REGISTRY_STORAGE_SWIFT_ACCESSKEY | b64dec)
33
- " REGISTRY_STORAGE_OSS_ACCESSKEYSECRET" ($_REGISTRY_STORAGE_OSS_ACCESSKEYSECRET | b64dec)
34
- -}}
35
- {{- end }}
36
-
6
+ {{- if not .Values.registry.existingSecret }}
37
7
apiVersion : v1
38
8
kind : Secret
39
9
metadata :
@@ -47,35 +17,31 @@ metadata:
47
17
{{- end }}
48
18
type : Opaque
49
19
data :
50
- REGISTRY_HTPASSWD : {{ $existingEnvVarsSecretRegistry.REGISTRY_HTPASSWD | default .Values.registry.credentials.htpasswd | b64enc | quote }}
51
- {{- $registryHttpSecret := $existingEnvVarsSecretRegistry.REGISTRY_HTTP_SECRET | default "" -}}
52
- {{- if eq $registryHttpSecret "" }}
53
- REGISTRY_HTTP_SECRET : {{ include "common.secrets.passwords.manage" ( dict "secret" (include "harbor.registry" .) "key" "REGISTRY_HTTP_SECRET" "length" 16 "providedValues" (list "registry.secret") "context" $ ) }}
54
- {{- else }}
55
- REGISTRY_HTTP_SECRET : {{ print $registryHttpSecret | b64enc | quote }}
56
- {{- end }}
57
- REGISTRY_REDIS_PASSWORD : {{ $existingEnvVarsSecretRegistry.REGISTRY_REDIS_PASSWORD | default (include "harbor.redis.rawPassword" .) | b64enc | quote }}
20
+ REGISTRY_HTPASSWD : {{ .Values.registry.credentials.htpasswd | b64enc | quote }}
21
+ REGISTRY_HTTP_SECRET : {{ include "common.secrets.passwords.manage" (dict "secret" (include "harbor.registry" .) "key" "REGISTRY_HTTP_SECRET" "length" 16 "providedValues" (list "registry.secret") "context" $) }}
22
+ REGISTRY_REDIS_PASSWORD : {{ (include "harbor.redis.rawPassword" .) | b64enc | quote }}
58
23
{{- if eq .Values.persistence.imageChartStorage.type "azure" }}
59
- REGISTRY_STORAGE_AZURE_ACCOUNTKEY : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_AZURE_ACCOUNTKEY | default .Values.persistence.imageChartStorage.azure.accountkey | b64enc | quote }}
24
+ REGISTRY_STORAGE_AZURE_ACCOUNTKEY : {{ .Values.persistence.imageChartStorage.azure.accountkey | b64enc | quote }}
60
25
{{- else if eq .Values.persistence.imageChartStorage.type "gcs" }}
61
26
{{- if .Values.persistence.imageChartStorage.gcs.encodedkey }}
62
- GCS_KEY_DATA : {{ $existingEnvVarsSecretRegistry.GCS_KEY_DATA | default .Values.persistence.imageChartStorage.gcs.encodedkey | quote }}
27
+ GCS_KEY_DATA : {{ .Values.persistence.imageChartStorage.gcs.encodedkey | quote }}
63
28
{{- end }}
64
29
{{- else if eq .Values.persistence.imageChartStorage.type "s3" }}
65
30
{{- if .Values.persistence.imageChartStorage.s3.accesskey }}
66
- REGISTRY_STORAGE_S3_ACCESSKEY : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_S3_ACCESSKEY | default .Values.persistence.imageChartStorage.s3.accesskey | b64enc | quote }}
31
+ REGISTRY_STORAGE_S3_ACCESSKEY : {{ .Values.persistence.imageChartStorage.s3.accesskey | b64enc | quote }}
67
32
{{- end }}
68
33
{{- if .Values.persistence.imageChartStorage.s3.secretkey }}
69
- REGISTRY_STORAGE_S3_SECRETKEY : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_S3_SECRETKEY | default .Values.persistence.imageChartStorage.s3.secretkey | b64enc | quote }}
34
+ REGISTRY_STORAGE_S3_SECRETKEY : {{ .Values.persistence.imageChartStorage.s3.secretkey | b64enc | quote }}
70
35
{{- end }}
71
36
{{- else if eq .Values.persistence.imageChartStorage.type "swift" }}
72
- REGISTRY_STORAGE_SWIFT_PASSWORD : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_SWIFT_PASSWORD | default .Values.persistence.imageChartStorage.swift.password | b64enc | quote }}
37
+ REGISTRY_STORAGE_SWIFT_PASSWORD : {{ .Values.persistence.imageChartStorage.swift.password | b64enc | quote }}
73
38
{{- if .Values.persistence.imageChartStorage.swift.secretkey }}
74
- REGISTRY_STORAGE_SWIFT_SECRETKEY : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_SWIFT_SECRETKEY | default .Values.persistence.imageChartStorage.swift.secretkey | b64enc | quote }}
39
+ REGISTRY_STORAGE_SWIFT_SECRETKEY : {{ .Values.persistence.imageChartStorage.swift.secretkey | b64enc | quote }}
75
40
{{- end }}
76
41
{{- if .Values.persistence.imageChartStorage.swift.accesskey }}
77
- REGISTRY_STORAGE_SWIFT_ACCESSKEY : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_SWIFT_ACCESSKEY | default .Values.persistence.imageChartStorage.swift.accesskey | b64enc | quote }}
42
+ REGISTRY_STORAGE_SWIFT_ACCESSKEY : {{ .Values.persistence.imageChartStorage.swift.accesskey | b64enc | quote }}
78
43
{{- end }}
79
44
{{- else if eq .Values.persistence.imageChartStorage.type "oss" }}
80
- REGISTRY_STORAGE_OSS_ACCESSKEYSECRET : {{ $existingEnvVarsSecretRegistry.REGISTRY_STORAGE_OSS_ACCESSKEYSECRET | default .Values.persistence.imageChartStorage.oss.accesskeysecret | b64enc | quote }}
45
+ REGISTRY_STORAGE_OSS_ACCESSKEYSECRET : {{ .Values.persistence.imageChartStorage.oss.accesskeysecret | b64enc | quote }}
81
46
{{- end }}
47
+ {{- end }}
0 commit comments