142 lines
4.8 KiB
Smarty
142 lines
4.8 KiB
Smarty
{{/* vim: set filetype=mustache: */}}
|
|
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "gateway.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified app name.
|
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
If release name contains chart name it will be used as a full name.
|
|
*/}}
|
|
{{- define "gateway.fullname" -}}
|
|
{{- if .Values.fullnameOverride }}
|
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- else }}
|
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
{{- if contains $name .Release.Name }}
|
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
|
{{- else }}
|
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "gateway.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "gateway.labels" -}}
|
|
helm.sh/chart: {{ include "gateway.chart" . }}
|
|
{{ include "gateway.selectorLabels" . }}
|
|
{{- if .Chart.AppVersion }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
{{- end }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "gateway.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "gateway.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "gateway.apitraffic.serviceAccountName" -}}
|
|
{{- if .Values.apitraffic.serviceAccount.create }}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "apitraffic") .Values.apitraffic.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.apitraffic.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- define "gateway.anm.serviceAccountName" -}}
|
|
{{- if .Values.anm.serviceAccount.create }}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "anm") .Values.anm.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.anm.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- define "gateway.apimgr.serviceAccountName" -}}
|
|
{{- if .Values.apimgr.serviceAccount.create }}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "apimgr") .Values.apimgr.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.apimgr.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- define "gateway.aga.serviceAccountName" -}}
|
|
{{- if .Values.aga.serviceAccount.create }}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "aga") .Values.aga.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.aga.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- define "gateway.tests.serviceAccountName" -}}
|
|
{{- if .Values.global.tests.serviceAccount.create }}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "tests") .Values.global.tests.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.global.tests.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Secret name for metrics db credentials, either the existing one or the one created by this chart
|
|
*/}}
|
|
{{- define "gateway.metrics-db.secretName" -}}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "metrics-db") .Values.global.database.metrics.existingSecret.name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Secret name for cassandra password, either the existing one or the one created by this chart
|
|
*/}}
|
|
{{- define "gateway.cassandra.secretName" -}}
|
|
{{- default (printf "%s-%s" (include "gateway.fullname" .) "cassandra") .Values.global.cassandra.existingSecret.name }}
|
|
{{- end }}
|
|
{{/*
|
|
|
|
Filters the API GW related volumes from the global section
|
|
Usage (example with traffic, can also be anm, aga, apimgr, portal):
|
|
{{ include "gateway.volumeMounts" (dict "component" "traffic" "storage" .Values.global.storage) }}
|
|
*/}}
|
|
{{- define "gateway.volumeMounts" -}}
|
|
{{- $component := .component }}
|
|
{{- $volumeMounts := list }}
|
|
{{- range .storage.volumes }}
|
|
{{- if and (or (empty $component) (has $component .usedBy)) .enabled }}
|
|
{{- $mountPath := .mountPath | default .mountPoint | default (printf "/opt/Axway/apigateway/%s" .name) }}
|
|
{{- $volumeMounts = append $volumeMounts (dict "name" .name "mountPath" $mountPath) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- toYaml $volumeMounts }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Usage (example with traffic, can also be anm, aga, apimgr, portal):
|
|
{{ include "gateway.volumes" (dict "component" "traffic" "storage" .Values.global.storage) }}
|
|
*/}}
|
|
{{- define "gateway.volumes" -}}
|
|
{{- $component := .component }}
|
|
{{- $volumes := list }}
|
|
{{- range .storage.volumes }}
|
|
{{- if and (or (empty $component) (has $component .usedBy)) .enabled }}
|
|
{{- $volumes = append $volumes (dict "name" .name "persistentVolumeClaim" (dict "claimName" (coalesce .claimName .name))) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- toYaml $volumes }}
|
|
{{- end }}
|