helm: gate worker hub token on the same condition as hub AUTH_ENABLED (#1954)

The hub's AUTH_ENABLED is derived from cloudLicenseEnabled/demoModeEnabled/
tap.auth.enabled, but the worker DaemonSet gated HUB_INTERNAL_TOKEN_PATH, its
volumeMount and the projected serviceAccountToken on tap.auth.enabled alone.
With demoModeEnabled: true (or the default cloudLicenseEnabled: true) and
tap.auth.enabled unset, the hub required a bearer token the workers never got,
so every worker -> hub call returned 401: tracer target refresh and name
resolution history silently stopped while capture kept working.

Extract the condition into a kubeshark.authEnabled helper and consume it from
both 12-config-map.yaml and 09-worker-daemon-set.yaml so the two cannot drift.
AUTH_ENABLED renders identically to before for all combinations of
cloudLicenseEnabled/license/demoModeEnabled/tap.auth.enabled/tap.auth.type.
This commit is contained in:
Volodymyr Stoiko
2026-08-07 05:34:58 +00:00
parent f38980ea94
commit c8a9ba1196
3 changed files with 18 additions and 8 deletions
@@ -146,7 +146,7 @@ spec:
value: '{{ (include "sentry.enabled" .) }}'
- name: SENTRY_ENVIRONMENT
value: '{{ .Values.tap.sentry.environment }}'
{{- if (((.Values.tap).auth).enabled) }}
{{- if eq (include "kubeshark.authEnabled" .) "true" }}
- name: HUB_INTERNAL_TOKEN_PATH
value: /var/run/secrets/kubeshark/hub-token/token
{{- end }}
@@ -239,7 +239,7 @@ spec:
{{- if .Values.tap.persistentStorage }}
subPathExpr: $(NODE_NAME)
{{- end }}
{{- if (((.Values.tap).auth).enabled) }}
{{- if eq (include "kubeshark.authEnabled" .) "true" }}
- mountPath: /var/run/secrets/kubeshark/hub-token
name: hub-internal-token
readOnly: true
@@ -439,7 +439,7 @@ spec:
emptyDir:
sizeLimit: {{ .Values.tap.storageLimit }}
{{- end }}
{{- if (((.Values.tap).auth).enabled) }}
{{- if eq (include "kubeshark.authEnabled" .) "true" }}
- name: hub-internal-token
projected:
sources:
+1 -5
View File
@@ -18,11 +18,7 @@ data:
INGRESS_ENABLED: '{{ .Values.tap.ingress.enabled }}'
INGRESS_HOST: '{{ .Values.tap.ingress.host }}'
PROXY_FRONT_PORT: '{{ .Values.tap.proxy.front.port }}'
AUTH_ENABLED: '{{- if and .Values.cloudLicenseEnabled (not (empty .Values.license)) -}}
{{ (default false .Values.demoModeEnabled) | ternary true ((and .Values.tap.auth.enabled (or (eq .Values.tap.auth.type "oidc") (eq .Values.tap.auth.type "dex"))) | ternary true false) }}
{{- else -}}
{{ .Values.cloudLicenseEnabled | ternary "true" ((default false .Values.demoModeEnabled) | ternary "true" .Values.tap.auth.enabled) }}
{{- end }}'
AUTH_ENABLED: '{{ include "kubeshark.authEnabled" . }}'
AUTH_TYPE: '{{- if and .Values.cloudLicenseEnabled (not (or (eq .Values.tap.auth.type "oidc") (eq .Values.tap.auth.type "dex"))) -}}
default
{{- else -}}
+14
View File
@@ -110,3 +110,17 @@ Dex IdP: retrieve a secret for static client with a specific ID
{{- end }}
{{- end }}
{{- end }}
{{/*
Single source of truth for whether the hub enforces authentication.
Consumed by the hub ConfigMap (AUTH_ENABLED) and by the worker DaemonSet, which
must mount an internal hub token whenever the hub requires one. Keeping the two
in sync prevents workers from being issued no token while the hub demands one.
*/}}
{{- define "kubeshark.authEnabled" -}}
{{- if and .Values.cloudLicenseEnabled (not (empty .Values.license)) -}}
{{ (default false .Values.demoModeEnabled) | ternary true ((and .Values.tap.auth.enabled (or (eq .Values.tap.auth.type "oidc") (eq .Values.tap.auth.type "dex"))) | ternary true false) }}
{{- else -}}
{{ .Values.cloudLicenseEnabled | ternary "true" ((default false .Values.demoModeEnabled) | ternary "true" .Values.tap.auth.enabled) }}
{{- end -}}
{{- end -}}