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>
124 lines
4.1 KiB
YAML
124 lines
4.1 KiB
YAML
{{- $moduleGateway := dict }}
|
|
{{- include "helm_lib_module_gateway" (list . $moduleGateway) }}
|
|
{{- if and (eq (include "helm_lib_module_gateway_enabled" .) "true") .Values.global.modules.publicDomainTemplate .Values.global.clusterIsBootstrapped }}
|
|
---
|
|
apiVersion: gateway.networking.k8s.io/v1
|
|
kind: ListenerSet
|
|
metadata:
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
spec:
|
|
listeners:
|
|
{{- if (include "helm_lib_module_https_route_tls_enabled" .) }}
|
|
- allowedRoutes:
|
|
namespaces:
|
|
from: Same
|
|
hostname: {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
|
|
name: cluster-map
|
|
port: 443
|
|
protocol: HTTPS
|
|
tls:
|
|
certificateRefs:
|
|
- group: ""
|
|
kind: Secret
|
|
name: {{ include "helm_lib_module_https_secret_name" (list . "ingress-tls" "httproute-tls") }}
|
|
namespace: d8-cluster-map
|
|
mode: Terminate
|
|
- allowedRoutes:
|
|
namespaces:
|
|
from: Same
|
|
hostname: {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
|
|
name: cluster-map-redirect
|
|
port: 80
|
|
protocol: HTTP
|
|
{{- else }}
|
|
- allowedRoutes:
|
|
namespaces:
|
|
from: Same
|
|
hostname: {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
|
|
name: cluster-map
|
|
port: 80
|
|
protocol: HTTP
|
|
{{- end }}
|
|
parentRef:
|
|
group: gateway.networking.k8s.io
|
|
kind: Gateway
|
|
name: {{ $moduleGateway.name }}
|
|
namespace: {{ $moduleGateway.namespace }}
|
|
---
|
|
apiVersion: gateway.networking.k8s.io/v1
|
|
kind: HTTPRoute
|
|
metadata:
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
annotations:
|
|
web.deckhouse.io/export-name: "cluster-map"
|
|
web.deckhouse.io/export-icon: "/icon.svg"
|
|
{{- if and (ne (include "helm_lib_module_https_mode" .) "Disabled") .Values.clusterMap.auth.externalAuthentication }}
|
|
alb.network.deckhouse.io/auth-signin: {{ replace "$host" (include "helm_lib_module_public_domain" (list . "cluster-map")) .Values.clusterMap.auth.externalAuthentication.authSignInURL | quote }}
|
|
alb.network.deckhouse.io/auth-url: {{ .Values.clusterMap.auth.externalAuthentication.authURL | quote }}
|
|
alb.network.deckhouse.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" (eq (include "cluster_map_viewer_token" .) "true") | quote }}
|
|
{{- end }}
|
|
{{- if .Values.clusterMap.auth.whitelistSourceRanges }}
|
|
alb.network.deckhouse.io/whitelist-source-range: {{ .Values.clusterMap.auth.whitelistSourceRanges | join "," | quote }}
|
|
{{- end }}
|
|
spec:
|
|
hostnames:
|
|
- {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
|
|
parentRefs:
|
|
- group: gateway.networking.k8s.io
|
|
kind: ListenerSet
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
sectionName: cluster-map
|
|
rules:
|
|
- backendRefs:
|
|
- group: ""
|
|
kind: Service
|
|
name: cluster-map
|
|
port: 80
|
|
weight: 1
|
|
matches:
|
|
- path:
|
|
type: PathPrefix
|
|
value: /
|
|
{{- if or (eq (include "helm_lib_module_https_mode" .) "CertManager") (eq (include "helm_lib_module_https_mode" .) "CustomCertificate") }}
|
|
filters:
|
|
- type: ResponseHeaderModifier
|
|
responseHeaderModifier:
|
|
add:
|
|
- name: Strict-Transport-Security
|
|
value: max-age=31536000; includeSubDomains
|
|
{{- end }}
|
|
{{- if (include "helm_lib_module_https_route_tls_enabled" .) }}
|
|
---
|
|
apiVersion: gateway.networking.k8s.io/v1
|
|
kind: HTTPRoute
|
|
metadata:
|
|
name: cluster-map-redirect
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
spec:
|
|
hostnames:
|
|
- {{ include "helm_lib_module_public_domain" (list . "cluster-map") }}
|
|
parentRefs:
|
|
- group: gateway.networking.k8s.io
|
|
kind: ListenerSet
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
sectionName: cluster-map-redirect
|
|
rules:
|
|
- filters:
|
|
- type: RequestRedirect
|
|
requestRedirect:
|
|
scheme: https
|
|
statusCode: 301
|
|
matches:
|
|
- path:
|
|
type: PathPrefix
|
|
value: /
|
|
{{- end }}
|
|
{{- end }}
|