1 ################################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
19 Resolve the name of the common image repository.
20 The value for .Values.repository is used by default,
21 unless either override mechanism is used.
23 - .Values.global.repository : override default image repository for all images
24 - .Values.repositoryOverride : override global and default image repository on a per image basis
26 {{- define "common.repository" -}}
27 {{- $componentname := .Chart.Name -}}
28 {{- $firsttier := (index .Values (printf "%s" $componentname)) -}}
30 {{- $secondtier := (index .Values (printf "%s" $componentname) (printf "%s" "repositoryOverride")) -}}
31 {{- if $secondtier -}}
32 {{- printf "%s" $secondtier -}}
34 {{- if .Values.global -}}
35 {{- if .Values.global.repository -}}
36 {{- printf "%s" .Values.global.repository -}}
38 {{- printf "%s" .Values.repository -}}
41 {{- printf "%s" .Values.repository -}}
45 {{- if .Values.global -}}
46 {{- if .Values.global.repository -}}
47 {{- printf "%s" .Values.global.repository -}}
49 {{- printf "%s" .Values.repository -}}
52 {{- printf "%s" .Values.repository -}}
59 Resolve the docker image repository secret token configmap.
60 The secret token should be installed by K8S system admin.
61 The value for .Values.repositoryCred is used by default,
62 unless either override mechanism is used.
64 - .Values.global.repositoryCred : override default docker registry credential
65 - .Values.repositoryCredOverride : override global and default docker registry credential
67 {{- define "common.repositoryCred" -}}
68 {{- if .Values.repositoryCredOverride -}}
69 {{- printf "%s" .Values.repositoryCredOverride -}}
71 {{- if .Values.global -}}
72 {{- if .Values.global.repositoryCred -}}
73 {{- printf "%s" .Values.global.repositoryCred -}}
75 {{- printf "%s" .Values.repositoryCred -}}
78 {{- printf "%s" .Values.repositoryCred -}}
85 Define the golbal image pull policy.
86 The value for .Values.imagePullPolicy is used by default,
87 unless either override mechanism is used.
89 - .Values.global.imagePullPolicy : override default pull policy
90 - .Values.imagePullPolicyOverride : override global and default pull policy
92 {{- define "common.pullPolicy" -}}
93 {{- if .Values.imagePullPolicyOverride -}}
94 {{- printf "%s" .Values.imagePullPolicyOverride -}}
96 {{- if .Values.global -}}
97 {{- if .Values.global.imagePullPolicy -}}
98 {{- printf "%s" .Values.global.imagePullPolicy -}}
100 {{- printf "%s" .Values.imagePullPolicy -}}
103 {{- printf "%s" .Values.imagePullPolicy -}}
110 Resolve the docker registry certificate name.
111 The value for .Values.repositoryCert is used by default,
112 unless either override mechanism is used.
114 - .Values.global.repositoryCert : override default repository certificate
115 - .Values.repositoryCertOverride : override global and default repository certificate
117 {{- define "common.repositorycert" -}}
118 {{- if .Values.repositoryCertOverride -}}
119 {{- printf "%s" .Values.repositoryCertOverride -}}
121 {{- if .Values.global -}}
122 {{- if .Values.global.repositoryCert -}}
123 {{- printf "%s" .Values.global.repositoryCert -}}
125 {{- printf "%s" .Values.repositoryCert -}}
128 {{- printf "%s" .Values.repositoryCert -}}
139 Generate certificates for the docker registry
141 {{- define "common.repository.gen-certs" -}}
142 {{- $altNames := list ( printf "docker.%s" .Values.ingress.hostpostfix ) -}}
143 {{- $ca := genCA "docker-registry-ca" 365 -}}
144 {{- $cert := genSignedCert ( include "nexus.name" . ) nil $altNames 365 $ca -}}
145 tls.crt: {{ $cert.Cert | b64enc }}
146 tls.key: {{ $cert.Key | b64enc }}