Skip to content

feat(k8s): report instance counters onto the deployment during the wait#201

Open
pablovilas wants to merge 1 commit into
betafrom
feat/k8s-report-instance-counts
Open

feat(k8s): report instance counters onto the deployment during the wait#201
pablovilas wants to merge 1 commit into
betafrom
feat/k8s-report-instance-counts

Conversation

@pablovilas

Copy link
Copy Markdown

Summary

  • wait_deployment_active computes desired / launched / ready every 10s but only printed them into the log line — so k8s custom-scope deployments carry no launched_instances / healthy_instances / amount_instances_to_wait in strategy_data, and the dashboard can't show "X/Y launched" / "X/Y healthy" (SWM-managed scopes report these; this agent never did).
  • On every change in the counts, the script now PATCHes the deployment with a partial strategy_data body carrying only the three counters. A partial body merges server-side — core's updateById deep-merges current + incoming and every deployment strategy (blue_green, initial, external) returns the merged strategyData — so switched_traffic and friends are untouched. This is byte-identical to the scope-workflow-manager's production contract (onInstancesCheckFunctionCreator).
  • Best-effort telemetry: a failed patch logs at debug and never fails the deployment. Zero/non-numeric desired is never reported (a scope that declares nothing shows nothing).
  • Since initial, blue_green, and switch_traffic workflows all run this step, counters flow for every deploy shape, live and after the fact.

With this, the deployment page's instance meters and "n/n" chip subtitles light up for k8s custom scopes with zero FE/BFF changes (pairs with nullplatform/admin-dashboard#2014, which renders counters for any scope type).

Test Plan

  • bats k8s/deployment/tests/wait_deployment_active.bats — 25/25 (3 new: partial-body counters patch, change-only re-reporting, failed report never fails the deployment)
  • Full k8s/deployment/tests suite — the only failures (build_deployment.bats file-type parameter / secret-files, 2) reproduce on pristine main (c9b25bf) with this change stashed — pre-existing, unrelated.

🤖 Generated with Claude Code

The wait_deployment_active loop already computes desired/launched/ready
every cycle but only printed them into the log line, so the platform had
no launched/healthy counts for k8s custom scopes (no instance meters, no
n/n chip subtitles — unlike SWM-managed scopes, which report them).

Each change in the counts now PATCHes the deployment with a partial
strategy_data body ({amount_instances_to_wait, launched_instances,
healthy_instances}) — the deployment strategies merge a partial body over
the current data server-side, so switched_traffic and friends are
untouched; this is the same contract the scope-workflow-manager uses.
Reporting is best-effort: a failed patch logs at debug and never fails
the deployment.
@pablovilas
pablovilas force-pushed the feat/k8s-report-instance-counts branch from eea47a5 to 5b2653f Compare July 14, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant