v0.8.0: problem badges, actions as the viewer, load, events, lock

Problems: cards, namespace and node boxes and the tree carry a yellow or
red badge, computed on the server from object state (crash loops, image
pulls, pending and unschedulable pods, readiness older than 2 minutes, a
stuck rollout, a failed CronJob run, Services without endpoints,
Ingresses to missing Services, node conditions), recent Warning events
(notable reasons at once, others after five repeats) and Deckhouse
ClusterAlerts mapped by their labels. A Problems panel lists them all.
Checked against the live cluster: upmeter's synthetic probe pods and
ingress-nginx's fakeservice Ingresses are excluded, they fail on purpose.

Actions: restart, scale, run a CronJob now, suspend/resume, delete a
pod, cordon/uncordon. They run with the viewer's bearer token from the
DexAuthenticator (sendAuthorizationHeader), buttons follow a
SelfSubjectAccessReview, the service account stays read-only. Cross-site
writes are refused by Sec-Fetch-Site/Origin/content type. Scale retries
on conflict: right after a restart a single Get+Update got 409.

Load (metrics.k8s.io against requests/limits/allocatable, per-pod table)
and an Events tab. Cards are locked until the padlock is opened; the map
exports to PNG; the page refreshes badges every minute in place.

Performance, measured on the live cluster:
- layout of big views 3-4x faster: equal-size cards with no edges are
  laid out on the grid ELK would produce (same sizes, checked against
  ELK on a frozen node view), skipping ~8 ms per ELK call;
- hubble-relay gets ~20% fewer flows: the to-overlay copy of pod-to-pod
  traffic is dropped at the agents; 331/331 directions unchanged;
- static files carry ETags, a reload revalidates instead of pulling
  ~2 MB of vendored scripts.

KUBECONFIG is honoured for running the binary on a workstation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Виталий Чефанов
2026-09-24 17:25:36 +03:00
co-authored by Claude Opus 5.5
parent 8b8fe341d5
commit 3cdc2583ee
36 changed files with 2909 additions and 83 deletions
+2
View File
@@ -96,6 +96,8 @@ spec:
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: LOG_TAIL_LINES
value: {{ .Values.clusterMap.logs.tailLines | quote }}
- name: SYSTEM_NAMESPACE_PREFIXES
+5
View File
@@ -20,6 +20,11 @@ spec:
applicationHTTPRouteListenerSetName: cluster-map
{{- end }}
applicationIngressClassName: {{ include "helm_lib_module_ingress_class" . | quote }}
{{- if .Values.clusterMap.actions.enabled }}
# actions run as the viewer: the user's token goes to the module in the
# Authorization header (and the token's audience includes kubernetes)
sendAuthorizationHeader: true
{{- end }}
{{- with .Values.clusterMap.auth.allowedUserEmails }}
allowedEmails:
{{- . | toYaml | nindent 2 }}
+1 -1
View File
@@ -59,7 +59,7 @@ metadata:
{{- 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: "X-Auth-Request-User,X-Auth-Request-Email"
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" .Values.clusterMap.actions.enabled | quote }}
{{- end }}
{{- if .Values.clusterMap.auth.whitelistSourceRanges }}
alb.network.deckhouse.io/whitelist-source-range: {{ .Values.clusterMap.auth.whitelistSourceRanges | join "," | quote }}
+1 -1
View File
@@ -15,7 +15,7 @@ metadata:
{{- if and (ne (include "helm_lib_module_https_mode" .) "Disabled") .Values.clusterMap.auth.externalAuthentication }}
nginx.ingress.kubernetes.io/auth-signin: {{ .Values.clusterMap.auth.externalAuthentication.authSignInURL | quote }}
nginx.ingress.kubernetes.io/auth-url: {{ .Values.clusterMap.auth.externalAuthentication.authURL | quote }}
nginx.ingress.kubernetes.io/auth-response-headers: "X-Auth-Request-User,X-Auth-Request-Email"
nginx.ingress.kubernetes.io/auth-response-headers: {{ ternary "X-Auth-Request-User,X-Auth-Request-Email,Authorization" "X-Auth-Request-User,X-Auth-Request-Email" .Values.clusterMap.actions.enabled | quote }}
{{- end }}
{{- if .Values.clusterMap.auth.whitelistSourceRanges }}
nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.clusterMap.auth.whitelistSourceRanges | join "," | quote }}
+12 -1
View File
@@ -8,7 +8,9 @@ metadata:
automountServiceAccountToken: true
---
# Read-only on exactly what the map shows. No Secrets, no ConfigMaps, no
# write verbs. pods/log backs the Logs tab.
# write verbs. pods/log backs the Logs tab, events and clusteralerts the
# problem badges, metrics.k8s.io the Load section. Actions (restart, scale…)
# never use this account: they run with the viewer's own token.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
@@ -21,6 +23,15 @@ rules:
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch"]
- apiGroups: ["deckhouse.io"]
resources: ["clusteralerts"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metrics.k8s.io"]
resources: ["pods", "nodes"]
verbs: ["get", "list"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets", "daemonsets"]
verbs: ["get", "list", "watch"]