github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/contrib/config/kubernetes/helm/templates/_helpers.tpl (about)

     1  {{/* vim: set filetype=mustache: */}}
     2  {{/*
     3  Expand the name of the chart.
     4  */}}
     5  {{- define "dgraph.name" -}}
     6  {{- default .Chart.Name .Values.nameOverride | trunc 24 -}}
     7  {{- end -}}
     8  {{/*
     9  Create a default fully qualified app name.
    10  We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
    11  */}}
    12  {{- define "dgraph.fullname" -}}
    13  {{- $name := default .Chart.Name .Values.nameOverride -}}
    14  {{- printf "%s-%s" .Release.Name $name | trunc 24 -}}
    15  {{- end -}}
    16  {{/*
    17  Create chart name and version as used by the chart label.
    18  */}}
    19  {{- define "dgraph.chart" -}}
    20  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
    21  {{- end -}}
    22  
    23  {{/*
    24  Create a default fully qualified data name.
    25  */}}
    26  {{- define "dgraph.zero.fullname" -}}
    27  {{ template "dgraph.fullname" . }}-{{ .Values.zero.name }}
    28  {{- end -}}
    29  
    30  {{/*
    31  Return the proper image name (for the metrics image)
    32  */}}
    33  {{- define "dgraph.image" -}}
    34  {{- $registryName := .Values.image.registry -}}
    35  {{- $repositoryName := .Values.image.repository -}}
    36  {{- $tag := .Values.image.tag | toString -}}
    37  {{/*
    38  Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
    39  but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
    40  Also, we can't use a single if because lazy evaluation is not an option
    41  */}}
    42  {{- if .Values.global }}
    43      {{- if .Values.global.imageRegistry }}
    44          {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
    45      {{- else -}}
    46          {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
    47      {{- end -}}
    48  {{- else -}}
    49      {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
    50  {{- end -}}
    51  {{- end -}}
    52  
    53  {{/*
    54  Return the proper Docker Image Registry Secret Names
    55  */}}
    56  {{- define "dgraph.imagePullSecrets" -}}
    57  {{/*
    58  Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
    59  but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
    60  Also, we can't use a single if because lazy evaluation is not an option
    61  */}}
    62  {{- if .Values.global }}
    63  {{- if .Values.global.imagePullSecrets }}
    64  imagePullSecrets:
    65  {{- range .Values.global.imagePullSecrets }}
    66    - name: {{ . }}
    67  {{- end }}
    68  {{- else if .Values.image.pullSecrets }}
    69  imagePullSecrets:
    70  {{- range .Values.image.pullSecrets }}
    71    - name: {{ . }}
    72  {{- end }}
    73  {{- end -}}
    74  {{- else if .Values.image.pullSecrets }}
    75  imagePullSecrets:
    76  {{- range .Values.image.pullSecrets }}
    77    - name: {{ . }}
    78  {{- end }}
    79  {{- end -}}
    80  {{- end -}}
    81  
    82  {{/*
    83  Create a default fully qualified alpha name.
    84  */}}
    85  {{- define "dgraph.alpha.fullname" -}}
    86  {{ template "dgraph.fullname" . }}-{{ .Values.alpha.name }}
    87  {{- end -}}
    88  
    89  
    90  {{/*
    91  Create a default fully qualified ratel name.
    92  */}}
    93  {{- define "dgraph.ratel.fullname" -}}
    94  {{ template "dgraph.fullname" . }}-{{ .Values.ratel.name }}
    95  {{- end -}}
    96  
    97  
    98  
    99  
   100