First draft of the SMO package based on the ONAP charts
[it/dep.git] / smo-install / oran_oom / aux-common / templates / _storageClass.tpl
1 {{/*
2 # Copyright © 2019 Amdocs, Bell Canada, Orange
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
17 {{/*
18   Expand the name of the storage class.
19   The value "common.fullname"-data is used by default,
20   unless either override mechanism is used.
21
22   - .Values.global.persistence.storageClass  : override default storageClass for all charts
23   - .Values.persistence.storageClassOverride : override global and default storage class on a per chart basis
24   - .Values.persistence.storageClass         : override default storage class on a per chart basis
25 */}}
26 {{- define "common.storageClass" -}}
27   {{- if .Values.persistence.storageClassOverride -}}
28     {{- if ne "-" .Values.persistence.storageClassOverride -}}
29       {{- printf "%s" .Values.persistence.storageClassOverride -}}
30     {{- else -}}
31       {{- $storage_class := "" -}}
32       {{- printf "%q" $storage_class -}}
33     {{- end -}}
34   {{- else -}}
35     {{- if or .Values.persistence.storageClass .Values.global.persistence.storageClass }}
36       {{- if ne "-" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}}
37         {{- printf "%s" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}}
38       {{- else -}}
39         {{- $storage_class := "" -}}
40         {{- printf "%q" $storage_class -}}
41       {{- end -}}
42     {{- else -}}
43       {{- printf "%s-data" (include "common.fullname" .) -}}
44     {{- end -}}
45   {{- end -}}
46 {{- end -}}
47
48 {{/*
49   Calculate if we need a PV. If a storageClass is provided, then we don't need.
50 */}}
51 {{- define "common.needPV" -}}
52 {{- if or (or .Values.persistence.storageClassOverride .Values.persistence.storageClass) .Values.global.persistence.storageClass -}}
53   False
54 {{- else -}}
55   True
56 {{- end -}}
57 {{- end -}}