From 7b5954ea000f798478fa2e0f0323aa31431258b2 Mon Sep 17 00:00:00 2001 From: Volodymyr Stoiko Date: Wed, 13 May 2026 20:53:20 +0300 Subject: [PATCH] helm: grant hub tokenreviews and label worker pods for internal auth (#1926) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * helm: grant hub tokenreviews and pass trusted controllers Adds RBAC for hub to call the authentication.k8s.io/v1 TokenReview endpoint, used by the new internalauth middleware to validate projected ServiceAccountTokens presented by in-cluster gRPC callers. Adds tap.internalAuth.trustedControllers value (empty by default), threaded through to hub's -trusted-controllers flag as a CSV. Listing a controller here lets pods owned by it authenticate to hub via the projected SA token (audience kubeshark-hub). Hub-spawned Jobs are always trusted regardless of this list. Hub matches OwnerReferences by name AND UID, so a name-only forgery does not grant trust. Sub-issue of kubeshark/hub#656. * helm: inline trusted controllers in hub deployment template The chart already knows its own controller names (worker DaemonSet metadata.name is the literal "kubeshark-worker-daemon-set" in 09-worker-daemon-set.yaml). Pasting the same literal into a user-facing tap.internalAuth.trustedControllers value adds a step without buying anything — if the worker DS rename, the deployment template would have to change in lockstep regardless. Drop the values knob, render the flag unconditionally with the literal worker DS name (matching the convention used elsewhere in this chart, e.g. the hub deployment's {{ include "kubeshark.name" . }}-hub). * helm: drop redundant comment on tokenreviews RBAC * helm: drop -trusted-controllers flag (no caller today) The flag was wiring forward-prep for a hypothetical worker->hub gRPC caller from the DaemonSet. Hub-spawned Jobs (dissection-job) are admitted via internalauth.RegisterSpawnedJob, not via this flag. Re-add when an actual DaemonSet-deployed caller materializes. * helm: label worker DS pods for hub internal auth Worker pods don't call hub gRPC today, but pre-labeling the DS pod template means a future worker->hub gRPC caller is one PR (worker-side) away from working — no chart change required. Matches the generic label-driven trust model in hub#783. * helm: rename trust label to kubeshark.io/internal-auth Matches the hub rename. Generic name so the same label can mark pods trusted by future kubeshark services beyond hub. --- helm-chart/templates/02-cluster-role.yaml | 6 ++++++ helm-chart/templates/09-worker-daemon-set.yaml | 1 + 2 files changed, 7 insertions(+) diff --git a/helm-chart/templates/02-cluster-role.yaml b/helm-chart/templates/02-cluster-role.yaml index fc1750499..5c5583085 100644 --- a/helm-chart/templates/02-cluster-role.yaml +++ b/helm-chart/templates/02-cluster-role.yaml @@ -44,6 +44,12 @@ rules: - create - update - delete + - apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role diff --git a/helm-chart/templates/09-worker-daemon-set.yaml b/helm-chart/templates/09-worker-daemon-set.yaml index e9a8d4ef1..7c36c0bc5 100644 --- a/helm-chart/templates/09-worker-daemon-set.yaml +++ b/helm-chart/templates/09-worker-daemon-set.yaml @@ -21,6 +21,7 @@ spec: metadata: labels: app.kubeshark.com/app: worker + kubeshark.io/internal-auth: "true" {{- include "kubeshark.labels" . | nindent 8 }} name: kubeshark-worker-daemon-set namespace: kubeshark