From: Sylvain Desbureaux Date: Fri, 25 Feb 2022 09:46:34 +0000 (+0100) Subject: [GLOBAL] Allow anonymous access to main repo X-Git-Tag: 10.0.0~70^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=oom.git;a=commitdiff_plain;h=a64b1b58109d6b36deb961e27ded829e478cb74e [GLOBAL] Allow anonymous access to main repo Today, access to main repo (nexus3.onap.org:10001 by default) mandates an user configuration. If someone is proxying it with a repository with anonymous access, it may not work. This patch allows to remove authentication by setting user to empty string. Issue-ID: OOM-2928 Signed-off-by: Sylvain Desbureaux Change-Id: I379d43343694d7dcb9212687c5a8104cc8c77bc3 --- diff --git a/kubernetes/common/repositoryGenerator/templates/_repository.tpl b/kubernetes/common/repositoryGenerator/templates/_repository.tpl index f57d390477..1b99285a80 100644 --- a/kubernetes/common/repositoryGenerator/templates/_repository.tpl +++ b/kubernetes/common/repositoryGenerator/templates/_repository.tpl @@ -154,6 +154,7 @@ 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 -}} @@ -164,9 +165,11 @@ {{- 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 }}