istio.io/istio@v0.0.0-20240520182934-d79c90f27776/manifests/charts/gateway/templates/_helpers.tpl (about)

     1  {{- define "gateway.name" -}}
     2  {{- if eq .Release.Name "RELEASE-NAME" -}}
     3    {{- .Values.name | default "istio-ingressgateway" -}}
     4  {{- else -}}
     5    {{- .Values.name | default .Release.Name | default "istio-ingressgateway" -}}
     6  {{- end -}}
     7  {{- end }}
     8  
     9  {{/*
    10  Create chart name and version as used by the chart label.
    11  */}}
    12  {{- define "gateway.chart" -}}
    13  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
    14  {{- end }}
    15  
    16  {{- define "gateway.labels" -}}
    17  helm.sh/chart: {{ include "gateway.chart" . }}
    18  {{ include "gateway.selectorLabels" . }}
    19  {{- if .Chart.AppVersion }}
    20  app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
    21  {{- end }}
    22  app.kubernetes.io/managed-by: {{ .Release.Service }}
    23  app.kubernetes.io/name: {{ include "gateway.name" . }}
    24  {{- range $key, $val := .Values.labels }}
    25  {{- if not (or (eq $key "app") (eq $key "istio")) }}
    26  {{ $key | quote }}: {{ $val | quote }}
    27  {{- end }}
    28  {{- end }}
    29  {{- end }}
    30  
    31  {{- define "gateway.podLabels" -}}
    32  {{ include "gateway.selectorLabels" . }}
    33  {{- range $key, $val := .Values.labels }}
    34  {{- if not (or (eq $key "app") (eq $key "istio")) }}
    35  {{ $key | quote }}: {{ $val | quote }}
    36  {{- end }}
    37  {{- end }}
    38  {{- end }}
    39  
    40  {{- define "gateway.selectorLabels" -}}
    41  {{- if hasKey .Values.labels "app" }}
    42  {{- with .Values.labels.app }}app: {{.|quote}}
    43  {{- end}}
    44  {{- else }}app: {{ include "gateway.name" . }}
    45  {{- end }}
    46  {{- if hasKey .Values.labels "istio" }}
    47  {{- with .Values.labels.istio }}
    48  istio: {{.|quote}}
    49  {{- end}}
    50  {{- else }}
    51  istio: {{ include "gateway.name" . | trimPrefix "istio-" }}
    52  {{- end }}
    53  {{- end }}
    54  
    55  {{- define "gateway.serviceAccountName" -}}
    56  {{- if .Values.serviceAccount.create }}
    57  {{- .Values.serviceAccount.name | default (include "gateway.name" .)    }}
    58  {{- else }}
    59  {{- .Values.serviceAccount.name | default "default" }}
    60  {{- end }}
    61  {{- end }}