Skip to content

Add k8s-pods app: pod table with namespace filter and pod deletion - #10

Merged
setnilson merged 1 commit into
masterfrom
k8s-pods-app
Sep 29, 2026
Merged

setnilson merged 1 commit into
masterfrom
k8s-pods-app

Conversation

@setnilson

Copy link
Copy Markdown
Owner

Summary

Adds a new Datadog app, apps/k8s-pods, that lists Kubernetes pods in a table with name, namespace, status, restarts, and age, and supports filtering by namespace and deleting unhealthy pods.

  • Pods are read via DDSQL (tableQuery against the containers dataset with a fixed SQL template, capped at 500 rows) with a natural-language queryInventory fallback if the fixed SQL does not match the org's schema. Rows are normalized and deduplicated per pod in the backend function (listPods.backend.ts).
  • The UI filters by namespace with a Select populated from the reported pods, marks pods as unhealthy (phase outside Running/Succeeded/Completed, or restarts >= 5) with status badges, and shows a Delete action only for unhealthy pods (src/App.tsx).
  • Deletion goes through a backend function (deletePod.backend.ts) that issues a DELETE against the Kubernetes API server via the generic HTTP action from @datadog/action-catalog/http/http. The action's connectionId must be a static top-level constant (enforced by the Datadog vite plugin), so it is configured via the kubeAPIConnectionId constant; no credentials are handled in app code, and pod/namespace names are strictly validated before use.
  • Note: the DDSQL containers column names (kube_pod_name, kube_namespace, kube_pod_status_phase, kube_container_status_restarts_total, started_at) could not be probed from this sandbox; if the query errors in your org, the app automatically falls back to the natural-language inventory query, and the SQL constant can be adjusted in one place.

Changes

  • Scaffolded apps/k8s-pods (vite-react template) with unique app identifier in datadog-app.config.json / vite.config.ts.
  • src/listPods.backend.ts: fixed DDSQL query + NL fallback, pod normalization/dedup, clamped limit.
  • src/deletePod.backend.ts: Kubernetes pod deletion via the generic HTTP action, input validation, static connection ID configuration.
  • src/App.tsx: pods table (DRUIDS Table, Badge for status), namespace filter, delete action for unhealthy pods, API-server URL setting.
  • Aligned react/react-dom with the root overrides (^18.3.1) per the workspace dependency rules.
  • Regenerated root package-lock.json and committed it together with the new app.

Testing

  • npm run typecheck -w apps/k8s-pods passes.
  • npm run lint -w apps/k8s-pods passes with zero warnings.
  • npm run build -w apps/k8s-pods builds successfully (requires DD_SITE to be unset locally because an empty DD_SITE env value is rejected by the vite plugin; CI is unaffected).
  • Lockfile gate: fetched origin/master (fe1e996), regenerated package-lock.json with npm install --package-lock-only --ignore-scripts, validated with npm ci --ignore-scripts, and confirmed both the apps/k8s-pods record and node_modules/k8s-pods workspace link are present.

PR by Bits - View session in Datadog

Co-authored-by: setnilson <110850377+setnilson@users.noreply.github.com>
@datadog-staging

datadog-staging Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

View session in Datadog

Bits Code status: ✅ Done

@setnilson
setnilson merged commit 22d0e8c into master Sep 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants