cd2ff083ff2d897c7edbb97bde0668f5de40adec
[demo.git] / vnfs / DAaaS / training-core / charts / kubernetes-HDFS / charts / hdfs-config-k8s / templates / _helpers.tpl
1 {{/* vim: set filetype=mustache: */}}
2 {{/*
3 Expand the name of the chart.
4 */}}
5 {{- define "hdfs-config-k8s.name" -}}
6 {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7 {{- end -}}
8
9 {{/*
10 Create a default fully qualified app name.
11 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12 If release name contains chart name it will be used as a full name.
13 */}}
14 {{- define "hdfs-config-k8s.fullname" -}}
15 {{- if .Values.fullnameOverride -}}
16 {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17 {{- else -}}
18 {{- $name := default .Chart.Name .Values.nameOverride -}}
19 {{- if contains $name .Release.Name -}}
20 {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21 {{- else -}}
22 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23 {{- end -}}
24 {{- end -}}
25 {{- end -}}
26
27 {{/*
28 Create chart name and version as used by the chart label.
29 */}}
30 {{- define "hdfs-config-k8s.chart" -}}
31 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32 {{- end -}}
33
34 {{/*
35 Create the kerberos principal suffix for core HDFS services
36 */}}
37 {{- define "hdfs-principal" -}}
38 {{- printf "hdfs/_HOST@%s" .Values.kerberosRealm -}}
39 {{- end -}}
40
41 {{/*
42 Create the kerberos principal for HTTP services
43 */}}
44 {{- define "http-principal" -}}
45 {{- printf "HTTP/_HOST@%s" .Values.kerberosRealm -}}
46 {{- end -}}
47
48 {{/*
49 Create the datanode data dir list.  The below uses two loops to make sure the
50 last item does not have comma. It uses index 0 for the last item since that is
51 the only special index that helm template gives us.
52 */}}
53 {{- define "datanode-data-dirs" -}}
54 {{- range $index, $path := .Values.global.dataNodeHostPath -}}
55   {{- if ne $index 0 -}}
56     /hadoop/dfs/data/{{ $index }},
57   {{- end -}}
58 {{- end -}}
59 {{- range $index, $path := .Values.global.dataNodeHostPath -}}
60   {{- if eq $index 0 -}}
61     /hadoop/dfs/data/{{ $index }}
62   {{- end -}}
63 {{- end -}}
64 {{- end -}}