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>
145 lines
5.0 KiB
YAML
145 lines
5.0 KiB
YAML
{{- $traffic := .Values.clusterMap.traffic }}
|
|
{{- /* Without the hubble CA there is no relay to talk to: cilium-hubble is off. */}}
|
|
{{- $trafficMode := ternary $traffic.mode "Disabled" (ne .Values.clusterMap.internal.hubbleCA "") }}
|
|
{{- if (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") }}
|
|
---
|
|
apiVersion: autoscaling.k8s.io/v1
|
|
kind: VerticalPodAutoscaler
|
|
metadata:
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
spec:
|
|
targetRef:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: cluster-map
|
|
updatePolicy:
|
|
updateMode: "InPlaceOrRecreate"
|
|
resourcePolicy:
|
|
containerPolicies:
|
|
- containerName: cluster-map
|
|
minAllowed:
|
|
cpu: 10m
|
|
memory: 64Mi
|
|
maxAllowed:
|
|
cpu: 500m
|
|
# the traffic collector keeps distinct connections for the whole
|
|
# retention window; a day on a busy cluster needs more than an hour
|
|
memory: {{ ternary "2Gi" "512Mi" (gt (int $traffic.retentionMinutes) 180) }}
|
|
{{- end }}
|
|
---
|
|
apiVersion: policy/v1
|
|
kind: PodDisruptionBudget
|
|
metadata:
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
spec:
|
|
maxUnavailable: 1
|
|
selector:
|
|
matchLabels:
|
|
app: cluster-map
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: cluster-map
|
|
namespace: d8-cluster-map
|
|
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map")) | nindent 2 }}
|
|
spec:
|
|
# One replica by design: traffic history lives in the process. Two replicas
|
|
# would each keep their own history and double the load on hubble-relay.
|
|
replicas: 1
|
|
revisionHistoryLimit: 2
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: cluster-map
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: cluster-map
|
|
annotations:
|
|
checksum/hubble-ca: {{ .Values.clusterMap.internal.hubbleCA | sha256sum }}
|
|
spec:
|
|
serviceAccountName: cluster-map
|
|
automountServiceAccountToken: true
|
|
{{- include "helm_lib_priority_class" (tuple . "cluster-low") | nindent 6 }}
|
|
{{- include "helm_lib_node_selector" (tuple . "system") | nindent 6 }}
|
|
{{- include "helm_lib_tolerations" (tuple . "system") | nindent 6 }}
|
|
{{- include "helm_lib_module_pod_security_context_run_as_user_deckhouse" . | nindent 6 }}
|
|
{{- if .Values.clusterMap.registry.dockercfg }}
|
|
imagePullSecrets:
|
|
- name: deckhouse-registry
|
|
{{- end }}
|
|
containers:
|
|
- name: cluster-map
|
|
image: {{ include "helm_lib_module_image" (list . "clusterMap") }}
|
|
imagePullPolicy: IfNotPresent
|
|
{{- include "helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all_pss_restricted" . | nindent 8 }}
|
|
env:
|
|
- name: LISTEN_ADDR
|
|
value: ":8080"
|
|
- name: METRICS_ADDR
|
|
value: ":9090"
|
|
- name: TRAFFIC_MODE
|
|
value: {{ $trafficMode | quote }}
|
|
- name: TRAFFIC_RETENTION
|
|
value: {{ printf "%dm" (int $traffic.retentionMinutes) | quote }}
|
|
- name: TRAFFIC_ON_DEMAND_IDLE
|
|
value: {{ printf "%dm" (int $traffic.onDemandIdleMinutes) | quote }}
|
|
- name: TRAFFIC_COLLECT_INFRA
|
|
value: {{ $traffic.collectInfraTraffic | quote }}
|
|
- name: HUBBLE_RELAY_ADDR
|
|
value: {{ printf "hubble-relay.d8-cni-cilium.svc.%s:443" .Values.global.discovery.clusterDomain | quote }}
|
|
- name: HUBBLE_CA_FILE
|
|
value: /etc/hubble-ca/ca.crt
|
|
- name: ACTIONS_ENABLED
|
|
value: {{ .Values.clusterMap.actions.enabled | quote }}
|
|
- name: VISIBILITY
|
|
value: {{ .Values.clusterMap.auth.visibility | quote }}
|
|
- name: LOG_TAIL_LINES
|
|
value: {{ .Values.clusterMap.logs.tailLines | quote }}
|
|
- name: SYSTEM_NAMESPACE_PREFIXES
|
|
value: {{ .Values.clusterMap.systemNamespacePrefixes | join "," | quote }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 8080
|
|
protocol: TCP
|
|
- name: metrics
|
|
containerPort: 9090
|
|
protocol: TCP
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: http
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /readyz
|
|
port: http
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
resources:
|
|
requests:
|
|
{{- include "helm_lib_module_ephemeral_storage_only_logs" . | nindent 12 }}
|
|
{{- if not (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") }}
|
|
cpu: 25m
|
|
memory: 96Mi
|
|
{{- end }}
|
|
{{- if .Values.clusterMap.internal.hubbleCA }}
|
|
volumeMounts:
|
|
- name: hubble-ca
|
|
mountPath: /etc/hubble-ca
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if .Values.clusterMap.internal.hubbleCA }}
|
|
volumes:
|
|
- name: hubble-ca
|
|
configMap:
|
|
name: hubble-ca
|
|
{{- end }}
|