You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.4 KiB
104 lines
3.4 KiB
2 years ago
|
{{/*
|
||
|
Expand the name of the chart.
|
||
|
*/}}
|
||
|
{{- define "agent-common.name" -}}
|
||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
|
Create a default fully qualified app name.
|
||
1 year ago
|
We truncate at 63 chars - 11 because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||
2 years ago
|
If release name contains chart name it will be used as a full name.
|
||
|
*/}}
|
||
|
{{- define "agent-common.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 "agent-common.chart" -}}
|
||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
|
Common labels
|
||
|
*/}}
|
||
|
{{- define "agent-common.labels" -}}
|
||
|
helm.sh/chart: {{ include "agent-common.chart" . }}
|
||
|
app.kubernetes.io/component: agent-common
|
||
2 years ago
|
hyperlane/deployment: {{ .Values.hyperlane.runEnv | quote }}
|
||
|
hyperlane/context: {{ .Values.hyperlane.context | quote }}
|
||
2 years ago
|
{{ include "agent-common.selectorLabels" . }}
|
||
|
{{- if .Chart.AppVersion }}
|
||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||
|
{{- end }}
|
||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
|
Selector labels
|
||
|
*/}}
|
||
|
{{- define "agent-common.selectorLabels" -}}
|
||
1 year ago
|
app.kubernetes.io/name: {{ include "agent-common.name" . | trunc 63 | trimSuffix "-"}}
|
||
2 years ago
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
|
Create the name of the service account to use
|
||
|
*/}}
|
||
|
{{- define "agent-common.serviceAccountName" -}}
|
||
|
{{- if .Values.serviceAccount.create }}
|
||
|
{{- default (include "agent-common.fullname" .) .Values.serviceAccount.name }}
|
||
|
{{- else }}
|
||
|
{{- default "default" .Values.serviceAccount.name }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
2 years ago
|
The name of the ClusterSecretStore/SecretStore
|
||
2 years ago
|
*/}}
|
||
2 years ago
|
{{- define "agent-common.secret-store.name" -}}
|
||
2 years ago
|
{{- default "external-secrets-gcp-cluster-secret-store" .Values.externalSecrets.storeName }}
|
||
2 years ago
|
{{- end }}
|
||
|
|
||
|
{{/*
|
||
|
Recursively converts a config object into environment variables than can
|
||
1 year ago
|
be parsed by rust. For example, a config of { foo: { bar: { baz: 420 }, booGo: 421 } } will
|
||
|
be: HYP_FOO_BAR_BAZ=420 and HYP_FOO_BOOGO=421
|
||
2 years ago
|
Env vars can be formatted in FOO="BAR" format if .format is "dot_env",
|
||
|
FOO: "BAR" format if .format is "config_map", or otherwise
|
||
|
they will be formatted as spec YAML-friendly environment variables
|
||
|
*/}}
|
||
|
{{- define "agent-common.config-env-vars" -}}
|
||
1 year ago
|
{{- range $key_or_idx, $value := .config }}
|
||
|
{{- $key_name := printf "%s%v" (default "" $.key_name_prefix) $key_or_idx }}
|
||
|
{{- if or (typeIs "map[string]interface {}" $value) (typeIs "[]interface {}" $value) }}
|
||
|
{{- include "agent-common.config-env-vars" (dict "config" $value "format" $.format "key_name_prefix" (printf "%s_" $key_name)) }}
|
||
2 years ago
|
{{- else }}
|
||
1 year ago
|
{{- include "agent-common.config-env-var" (dict "key" $key_name "value" $value "format" $.format ) }}
|
||
2 years ago
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{- define "agent-common.config-env-var" }}
|
||
|
{{- if (eq .format "dot_env") }}
|
||
1 year ago
|
HYP_{{ .key | upper }}={{ .value | quote }}
|
||
2 years ago
|
{{- else if (eq .format "config_map") }}
|
||
1 year ago
|
HYP_{{ .key | upper }}: {{ .value | quote }}
|
||
2 years ago
|
{{- else }}
|
||
1 year ago
|
- name: HYP_{{ .key | upper }}
|
||
2 years ago
|
value: {{ .value | quote }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
|