mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-09-01 00:57:17 +00:00
The chart answered three unrelated questions with one switch: whether the Hub gates its API, whether the dashboard must log in to fetch a licence key, and which product features exist. So a default install rendered AUTH_ENABLED=true purely to make the cloud login reachable, and tap.auth.enabled=true with type=saml rendered AUTH_ENABLED=false, shipping an unauthenticated Hub to an operator who had asked for SSO. kubeshark.authEnabled is now tap.auth.enabled verbatim. AUTH_TYPE is the configured type verbatim, instead of being rewritten to 'default' whenever cloud licensing or demo mode was on. Settings that cannot work now fail the render rather than being quietly rewritten into something that does. The dashboard's REACT_APP_AUTH_ENABLED was a second, hand-maintained copy of the old expression with an extra internetConnectivity term, so air-gapped installs rendered a gated Hub against a dashboard that never mounted a login. It uses the same helper now. The worker hub token is projected unconditionally. Gating it on the auth decision coupled a DaemonSet rollout to that decision, so anything enabling auth without re-rendering workers left them holding no token against a Hub that required one. The CLI no longer writes AUTH_ENABLED, AUTH_TYPE or AUTH_SAML_IDP_METADATA_URL. Those come from the values the release was installed with; writing them from the CLI's own config meant a plain 'kubeshark tap' against an SSO release could silently reconfigure or disable its authentication.
137 lines
4.0 KiB
Smarty
137 lines
4.0 KiB
Smarty
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "kubeshark.name" -}}
|
|
{{- .Release.Name | 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 "kubeshark.fullname" -}}
|
|
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "kubeshark.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Common labels
|
|
*/}}
|
|
{{- define "kubeshark.labels" -}}
|
|
helm.sh/chart: {{ include "kubeshark.chart" . }}
|
|
{{ include "kubeshark.selectorLabels" . }}
|
|
app.kubernetes.io/version: {{ .Chart.Version | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- if .Values.tap.labels }}
|
|
{{ toYaml .Values.tap.labels }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Selector labels
|
|
*/}}
|
|
{{- define "kubeshark.selectorLabels" -}}
|
|
app.kubernetes.io/name: {{ include "kubeshark.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the name of the service account to use
|
|
*/}}
|
|
{{- define "kubeshark.serviceAccountName" -}}
|
|
{{- printf "%s-service-account" .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Set configmap and secret names based on gitops.enabled
|
|
*/}}
|
|
{{- define "kubeshark.configmapName" -}}
|
|
kubeshark-config-map{{ if .Values.tap.gitops.enabled }}-default{{ end }}
|
|
{{- end -}}
|
|
|
|
{{- define "kubeshark.secretName" -}}
|
|
kubeshark-secret{{ if .Values.tap.gitops.enabled }}-default{{ end }}
|
|
{{- end -}}
|
|
|
|
|
|
{{/*
|
|
Escape double quotes in a string
|
|
*/}}
|
|
{{- define "kubeshark.escapeDoubleQuotes" -}}
|
|
{{- regexReplaceAll "\"" . "\"" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Define debug docker tag suffix
|
|
*/}}
|
|
{{- define "kubeshark.dockerTagDebugVersion" -}}
|
|
{{- .Values.tap.pprof.enabled | ternary "-debug" "" }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create docker tag default version
|
|
*/}}
|
|
{{- define "kubeshark.defaultVersion" -}}
|
|
{{- $defaultVersion := (printf "v%s" .Chart.Version) -}}
|
|
{{- if .Values.tap.docker.tagLocked }}
|
|
{{- $defaultVersion = regexReplaceAll "^([^.]+\\.[^.]+).*" $defaultVersion "$1" -}}
|
|
{{- end }}
|
|
{{- $defaultVersion }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Set sentry based on internet connectivity and telemetry
|
|
*/}}
|
|
{{- define "sentry.enabled" -}}
|
|
{{- $sentryEnabledVal := .Values.tap.sentry.enabled -}}
|
|
{{- if not .Values.internetConnectivity -}}
|
|
{{- $sentryEnabledVal = false -}}
|
|
{{- else if not .Values.tap.telemetry.enabled -}}
|
|
{{- $sentryEnabledVal = false -}}
|
|
{{- end -}}
|
|
{{- $sentryEnabledVal -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Dex IdP: retrieve a secret for static client with a specific ID
|
|
*/}}
|
|
{{- define "getDexKubesharkStaticClientSecret" -}}
|
|
{{- $clientId := .clientId -}}
|
|
{{- range .clients }}
|
|
{{- if eq .id $clientId }}
|
|
{{- .secret }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Whether the Hub enforces authentication and authorization on its API.
|
|
This is `tap.auth.enabled` and nothing else: licensing, demo mode and the
|
|
choice of identity provider do not affect whether the API is gated.
|
|
*/}}
|
|
{{- define "kubeshark.authEnabled" -}}
|
|
{{ .Values.tap.auth.enabled }}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Reject auth settings that cannot work, instead of rendering a Hub that
|
|
authenticates nobody.
|
|
*/}}
|
|
{{- define "kubeshark.validateAuth" -}}
|
|
{{- if .Values.tap.auth.enabled -}}
|
|
{{- if and (eq .Values.tap.auth.type "saml") (empty .Values.tap.auth.saml.idpMetadataUrl) -}}
|
|
{{- fail "tap.auth.enabled is true with tap.auth.type=saml but tap.auth.saml.idpMetadataUrl is empty. Set the IdP metadata URL, or pick another tap.auth.type (oidc, dex, descope)." -}}
|
|
{{- end -}}
|
|
{{- if and (or (eq .Values.tap.auth.type "oidc") (eq .Values.tap.auth.type "dex")) (empty (((.Values.tap).auth).oidc).issuer) -}}
|
|
{{- fail "tap.auth.enabled is true with tap.auth.type=oidc but tap.auth.oidc.issuer is empty. Set the OIDC issuer, or pick another tap.auth.type." -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|