mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-17 05:31:16 +08:00
139 lines
4.4 KiB
Smarty
139 lines
4.4 KiB
Smarty
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "openshell.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create a default fully qualified app name.
|
|
*/}}
|
|
{{- define "openshell.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 "openshell.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "openshell.labels" -}}
|
|
helm.sh/chart: {{ include "openshell.chart" . }}
|
|
{{ include "openshell.selectorLabels" . }}
|
|
{{- if .Chart.AppVersion }}
|
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
{{- end }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "openshell.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "openshell.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "openshell.serviceAccountName" -}}
|
|
{{- if .Values.serviceAccount.create }}
|
|
{{- default (include "openshell.fullname" .) .Values.serviceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.serviceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account assigned to sandbox pods
|
|
*/}}
|
|
{{- define "openshell.sandboxServiceAccountName" -}}
|
|
{{- if .Values.sandboxServiceAccount.create }}
|
|
{{- default (printf "%s-sandbox" (include "openshell.fullname" .) | trunc 63 | trimSuffix "-") .Values.sandboxServiceAccount.name }}
|
|
{{- else }}
|
|
{{- default "default" .Values.sandboxServiceAccount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Gateway image reference. Uses image.tag when set; falls back to .Chart.AppVersion
|
|
so a released chart automatically pulls the matching image without extra overrides.
|
|
*/}}
|
|
{{- define "openshell.image" -}}
|
|
{{- printf "%s:%s" .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Supervisor image reference. Same appVersion fallback as openshell.image so
|
|
the supervisor and gateway images stay in sync across releases.
|
|
*/}}
|
|
{{- define "openshell.supervisorImage" -}}
|
|
{{- printf "%s:%s" .Values.supervisor.image.repository (.Values.supervisor.image.tag | default .Chart.AppVersion) }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Namespaced Issuer (selfSigned) for cert-manager CA bootstrap.
|
|
*/}}
|
|
{{- define "openshell.issuerSelfSigned" -}}
|
|
{{- printf "%s-selfsigned" (include "openshell.fullname" .) | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Namespace where sandbox pods are created. An explicit
|
|
.Values.server.sandboxNamespace is used verbatim. Otherwise it defaults to
|
|
.Release.Namespace so `helm install -n my-ns` works without extra overrides.
|
|
*/}}
|
|
{{- define "openshell.sandboxNamespace" -}}
|
|
{{- .Values.server.sandboxNamespace | default .Release.Namespace -}}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
gRPC endpoint sandbox pods use to call back into the gateway. An explicit
|
|
.Values.server.grpcEndpoint is used verbatim. Otherwise it is derived from
|
|
the in-cluster Service DNS, release namespace, service port, and disableTls
|
|
flag — so the default value works for any release name or namespace without
|
|
override.
|
|
*/}}
|
|
{{/*
|
|
Supervisor sideload method. When supervisor.sideloadMethod is set, use it
|
|
verbatim. Otherwise auto-detect from the cluster version: the ImageVolume
|
|
feature gate is enabled by default starting in K8s v1.35 (GA in v1.36).
|
|
Clusters on v1.33-v1.34 can opt in by setting sideloadMethod explicitly
|
|
after enabling the feature gate.
|
|
*/}}
|
|
{{- define "openshell.supervisorSideloadMethod" -}}
|
|
{{- if .Values.supervisor.sideloadMethod -}}
|
|
{{- .Values.supervisor.sideloadMethod -}}
|
|
{{- else -}}
|
|
{{- if semverCompare ">=1.35-0" .Capabilities.KubeVersion.Version -}}
|
|
image-volume
|
|
{{- else -}}
|
|
init-container
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end }}
|
|
|
|
{{- define "openshell.grpcEndpoint" -}}
|
|
{{- if .Values.server.grpcEndpoint -}}
|
|
{{- .Values.server.grpcEndpoint -}}
|
|
{{- else -}}
|
|
{{- $scheme := ternary "http" "https" (default false .Values.server.disableTls) -}}
|
|
{{- printf "%s://%s.%s.svc.cluster.local:%d" $scheme (include "openshell.fullname" .) .Release.Namespace (int .Values.service.port) -}}
|
|
{{- end -}}
|
|
{{- end }}
|