Files
cluster-map/templates/dex-authenticator.yaml
Виталий ЧефановandClaude Opus 5.5 c50020e420 v0.10.0: each viewer sees what their own RBAC allows
Until now anyone admitted through Dex saw every namespace and every log,
read with the module's service account. auth.visibility: ViewerRBAC (the
default) asks the API server as the viewer, with the token the
DexAuthenticator forwards: list pods in all namespaces means the whole
cluster; otherwise the namespaces where they can list pods. Logs also
need get pods/log, node cards list nodes, cluster-wide alerts are for
cluster-wide viewers. Traffic to a hidden namespace keeps its counts with
the peer shown as hidden. One minute cache per token hash, SSARs in
parallel (8), a cluster-wide viewer costs two.

Verified against the live cluster with two real tokens: a service
account with view in one namespace got that namespace only (0 nodes, 403
on another namespace's YAML and logs, 403 on node usage); the module's
own account, cluster-wide, got all 56 namespaces and 6 nodes; no token,
401. auth.visibility: Everything keeps the old behaviour. The
DexAuthenticator now forwards the token when either actions or ViewerRBAC
need it (templates/_helpers.tpl).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 01:03:50 +03:00

51 lines
2.2 KiB
YAML

{{- $moduleGateway := dict }}
{{- include "helm_lib_module_gateway" (list . $moduleGateway) }}
{{- $ingressEnabled := eq (include "helm_lib_module_ingress_enabled" .) "true" }}
{{- $gatewayEnabled := eq (include "helm_lib_module_gateway_enabled" .) "true" }}
{{- if and .Values.clusterMap.internal.deployDexAuthenticator (or $ingressEnabled $gatewayEnabled) }}
---
apiVersion: deckhouse.io/v1
kind: DexAuthenticator
metadata:
name: cluster-map
namespace: d8-cluster-map
{{- include "helm_lib_module_labels" (list . (dict "app" "dex-authenticator" "name" "cluster-map")) | nindent 2 }}
{{- if eq (include "cluster_map_viewer_token" .) "true" }}
annotations:
# user-authn then asks Dex for a token with the kubernetes audience,
# which the API server accepts: actions and ViewerRBAC visibility use it
# (as the console does)
dexauthenticator.deckhouse.io/allow-access-to-kubernetes: "true"
{{- end }}
spec:
applicationDomain: {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
{{- if and $ingressEnabled (include "helm_lib_module_https_ingress_tls_enabled" .) }}
applicationIngressCertificateSecretName: {{ include "helm_lib_module_https_secret_name" (list . "ingress-tls") }}
{{- end }}
{{- if and $gatewayEnabled (include "helm_lib_module_https_route_tls_enabled" .) }}
gatewayAPI:
applicationHTTPRouteListenerSetName: cluster-map
{{- end }}
applicationIngressClassName: {{ include "helm_lib_module_ingress_class" . | quote }}
{{- if eq (include "cluster_map_viewer_token" .) "true" }}
# actions and visibility run as the viewer: the user's token goes to the
# module in the Authorization header
sendAuthorizationHeader: true
{{- end }}
{{- with .Values.clusterMap.auth.allowedUserEmails }}
allowedEmails:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- with .Values.clusterMap.auth.allowedUserGroups }}
allowedGroups:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- with .Values.clusterMap.auth.whitelistSourceRanges }}
whitelistSourceRanges:
{{- . | toYaml | nindent 2 }}
{{- end }}
{{- include "helm_lib_node_selector" (tuple . "system") | nindent 2 }}
{{- include "helm_lib_tolerations" (tuple . "system") | nindent 2 }}
highAvailability: false
{{- end }}