Skip to content

Unify Compose/Helm lifecycle behavior in cds up/down/state - #699

Open
RonaldHensbergen wants to merge 2 commits into
mainfrom
fix/issue-689-unify-lifecycle
Open

RonaldHensbergen wants to merge 2 commits into
mainfrom
fix/issue-689-unify-lifecycle

Conversation

@RonaldHensbergen

Copy link
Copy Markdown
Owner

Resolves #689.

Summary

Unifies four areas where Compose and Helm lifecycle handling had diverged:

  1. Readiness: helm_up() now waits for readiness by polling get_k8s_state() + group_services_by_health() (via new poll_k8s_state_until_settled()), the exact same functions cds state --target helm uses — instead of Helm's own --wait plus a separate per-workload kubectl wait/rollout status loop. Both Compose and Helm now share a single _poll_until_settled() core loop (extracted from poll_state_until_settled()), so "ready" (up) and "healthy" (state) always agree.
  2. --timeout budgeting: previously Helm's --timeout was applied in full to helm upgrade --install --wait and again in full to each subsequent per-workload wait, so total wall-clock time could scale with workload count. It's now a single overall deadline shared between the apply step and the readiness poll, matching how Compose already treats --timeout.
  3. --no-color/--no-build: --no-color is now wired through to helm_up's state redraw output (previously a no-op under --target helm). --no-build now prints an explicit note that it has no effect under Helm, since that target doesn't build local images yet (tracked separately in Make cds up --target helm self-contained (build images, prepare cluster, import images) #690).
  4. namespace/release derivation: cds down/cds state --target helm previously read the raw base profile file only, ignoring both extends chains and --environment overlays — so cds up --target helm --environment prod and a later cds down --target helm --environment prod could target different releases/namespaces if the overlay changed metadata.name/spec.runtime.namespace. down/state now resolve extends + --environment (via a new best-effort resolver that deliberately skips full profile validation, so a profile that's since been edited into an invalid state can still be torn down/inspected against its real release) through the same _helm_identity() rule up's plan already uses. Added --environment support to down/state.

Testing

  • python scripts/run_tests_with_deprecation_gate.py — 862 tests pass, 1 skipped.
  • make lint — clean (ruff, yamllint, markdownlint, renovate config all pass).
  • coverage run -m unittest discover ... — 89% overall coverage on cli/ (gate is 80%).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

- Readiness: helm_up() now polls get_k8s_state()/group_services_by_health()
  via a new poll_k8s_state_until_settled(), sharing the exact bucket/settle
  logic cds state --target helm already uses, instead of a separate
  helm --wait + per-workload kubectl wait/rollout status loop.
- Refactored the shared polling core out of poll_state_until_settled()
  into a private _poll_until_settled(fetch_grouped_fn) so Compose and
  Helm both drive the same loop.
- Timeout: --timeout is now a single overall budget for helm_up (apply +
  readiness poll), matching how Compose already treats --timeout as one
  deadline instead of resetting per workload.
- --no-color is now wired through to helm_up's redraw output; --no-build
  prints an explicit note that it has no effect under --target helm
  (no build step exists there yet).
- namespace/release derivation: down/state now resolve a profile's
  extends chain and --environment overlay (via a new best-effort
  resolver that skips full validation, so an already-invalid profile can
  still be torn down/inspected) through the same _helm_identity() rule
  up's plan-derived namespace/release already use. Added --environment
  support to down/state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merges origin/main (#700, #701, #702, #703, #704, #705) into this
branch, resolving conflicts in cli/k8s_runner.py::helm_up() and
cli/main.py's up/down command dispatch. Keeps this branch's unified
lifecycle behavior (deadline-based timeout budget, _helm_identity()
release/namespace rule, _k8s_runtime_defaults(..., environment) for
down/state) while layering in main's SonarCloud command-argument/path
injection hardening (_validate_k8s_name/_validate_kube_context/
_validate_timeout, and .resolve() on chart_dir/log_path).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

Unify Compose and Helm lifecycle behavior in cds up/down/state

1 participant