Merge "[GLOBAL] Allow anonymous access to main repo"
authorJack Lucas <jflos@sonoris.net>
Wed, 6 Apr 2022 15:19:59 +0000 (15:19 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 6 Apr 2022 15:19:59 +0000 (15:19 +0000)
kubernetes/common/repositoryGenerator/templates/_repository.tpl

index f57d390..1b99285 100644 (file)
     mail: email (optional)
   You can also set the same things for dockerHub, elastic and googleK8s if
   needed.
+  if not needed, set global.repositoryCred.user to empty value.
 */}}
 {{- define "repositoryGenerator.secret" -}}
   {{- $dot := default . .dot -}}
   {{- if $subchartDot.Values.global.repositoryCred }}
   {{-   $repo := $subchartDot.Values.global.repository }}
   {{-   $cred := $subchartDot.Values.global.repositoryCred }}
-  {{-   $mail := default "@" $cred.mail }}
-  {{-   $auth := printf "%s:%s" $cred.user $cred.password | b64enc }}
-  {{-   $repoCreds = printf "\"%s\": {\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $repo $cred.user $cred.password $mail $auth }}
+  {{-   if $cred.user }}
+  {{-     $mail := default "@" $cred.mail }}
+  {{-     $auth := printf "%s:%s" $cred.user $cred.password | b64enc }}
+  {{-     $repoCreds = printf "\"%s\": {\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}" $repo $cred.user $cred.password $mail $auth }}
+  {{-   end }}
   {{- end }}
   {{- if $subchartDot.Values.global.dockerHubRepositoryCred }}
   {{-   $dhRepo := $subchartDot.Values.global.dockerHubRepository }}