Merge R3 into master
[it/dep.git] / ric-aux / helm / infrastructure / subcharts / docker-credential / templates / secrets-docker-reg.yaml
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16 {{ $auxNameSpace := include "common.namespace.aux" . }}
17 {{ $infraNameSpace := include "common.namespace.infra" . }}
18 {{ $nameSpaceList := list $auxNameSpace $infraNameSpace }}
19 {{- range $nameSpaceList }}
20 {{- $namespace := . }}
21 {{- range keys $.Values.credential }}
22 {{- with index $.Values.credential . }}
23 {{- $repo := .registry }}
24 {{- $cred := .credential }}
25 {{- $user := default "docker" $cred.user }}
26 {{- $password := default "docker" $cred.password }}
27 {{- $mail := default "@" $cred.mail }}
28 {{- $auth := printf "%s:%s" $user $password | b64enc }}
29 ---
30 apiVersion: v1
31 kind: Secret
32 metadata:
33   name: secret-{{ $repo | replace "." "-" | replace ":" "-" | replace "/" "-" }}
34   namespace: {{ $namespace }}
35 data:
36   .dockercfg: {{ printf "{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}" $repo $user $password $mail $auth | b64enc }}
37 type: kubernetes.io/dockercfg
38 {{- end }}
39 {{- end }}
40 {{- end }}