Extend K8S and RIC installation instructions
[it/dep.git] / ric-common / Common-Template / helm / ric-common / templates / _helmrepo.tpl
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #   Copyright (c) 2019 Nokia.                                                  #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 ################################################################################
17
18 {{/*
19   Resolve the name of the common helm repository.
20   The value for .Values.helmRepository is used by default,
21   unless either override mechanism is used.
22
23   - .Values.global.helmRepository  : override default helm repository for all components that use helm
24   - .Values.helmRepositoryOverride : override global and default helm repository on a per component base
25 */}}
26 {{- define "common.helmrepository" -}}
27   {{- if .Values.helmRepositoryOverride -}}
28     {{- printf "%s" .Values.helmRepositoryOverride -}}
29   {{- else -}}
30     {{- if  .Values.global -}}
31       {{- if .Values.global.helmRepository -}}
32         {{- printf "%s" .Values.global.helmRepository -}}
33       {{- else -}}
34         {{- printf "%s" .Values.helmRepository -}}
35       {{- end -}}
36     {{- else -}}
37       {{- printf "%s" .Values.helmRepository -}}
38     {{- end -}}
39   {{- end -}}
40 {{- end -}}
41
42
43 {{/*
44   Resolve the helm repository secret token.
45   The secret token should be installed by K8S system admin.
46   The value for .Values.helmRepositoryCred is used by default,
47   unless either override mechanism is used.
48
49   - .Values.global.helmRepositoryCred  : override default helm repository credential
50   - .Values.helmRepositoryCredOverride : override global and default helm repository credential
51 */}}
52 {{- define "common.helmrepositorycred" -}}
53   {{- if .Values.helmRepositoryCredOverride -}}
54     {{- printf "%s" .Values.helmRepositoryCredOverride -}}
55   {{- else -}}
56     {{- if  .Values.global -}}
57       {{- if .Values.global.helmRepositoryCred -}}
58         {{- printf "%s" .Values.global.helmRepositoryCred -}}
59       {{- else -}}
60         {{- printf "%s" .Values.helmRepositoryCred -}}
61       {{- end -}}
62     {{- else -}}
63       {{- printf "%s" .Values.helmRepositoryCred -}}
64     {{- end -}}
65   {{- end -}}
66 {{- end -}}
67
68 {{/*
69   Resolve the helm repository certificate.
70   The certificate should be installed by K8S system admin.
71   The value for .Values.helmRepositoryCert is used by default,
72   unless either override mechanism is used.
73
74   - .Values.global.helmrepositoryCert  : override default helm repository certificate
75   - .Values.helmRepositoryCertOverride : override global and default helm repository certificate
76 */}}
77 {{- define "common.helmrepositorycert" -}}
78   {{- if .Values.helmRepositoryCertOverride -}}
79     {{- printf "%s" .Values.helmRepositoryCertOverride -}}
80   {{- else -}}
81     {{- if  .Values.global -}}
82       {{- if .Values.global.helmRepositoryCert -}}
83         {{- printf "%s" .Values.global.helmRepositoryCert -}}
84       {{- else -}}
85         {{- printf "%s" .Values.helmRepositoryCert -}}
86       {{- end -}}
87     {{- else -}}
88       {{- printf "%s" .Values.helmRepositoryCert -}}
89     {{- end -}}
90   {{- end -}}
91 {{- end -}}
92
93
94
95 {{/*
96 Generate certificates for the helm repo
97 */}}
98 {{- define "common.helmrepository.gen-certs" -}}
99 {{- $altNames := list ( printf "helm.%s" .Values.ingress.hostpostfix ) -}}
100 {{- $ca := genCA "helm-repository-ca" 365 -}}
101 {{- $cert := genSignedCert ( include "nexus.name" . ) nil $altNames 365 $ca -}}
102 tls.crt: {{ $cert.Cert | b64enc }}
103 tls.key: {{ $cert.Key | b64enc }}
104 {{- end -}}
105