Skip to content

feat(argo): multi-cluster argocd fleet synchronization and rollouts - #98

Merged
dan-petty merged 6 commits into
release/v0.2.15from
feat/argo-multicluster-fleet-sync
Sep 10, 2026
Merged

dan-petty merged 6 commits into
release/v0.2.15from
feat/argo-multicluster-fleet-sync

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Implements multi-cluster ArgoCD fleet synchronization, progressive delivery rollout orchestration, and automated metric-driven rollback gates.

Closes #91

Key Capabilities

  • Multi-Cluster Fleet Synchronization (devops argo fleet sync): Coordinates application synchronization across arbitrary fleets of target Kubernetes clusters (e.g. dev, staging, prod) with bounded concurrency limits (ThreadPoolExecutor), full timing tracking, and JSON output support.
  • Progressive Delivery Rollout Lifecycle: Introduces devops argo rollouts promote, devops argo rollouts abort, and devops argo rollouts restart commands with RFC 1123 resource validation and bounded timeouts.
  • Metric-Driven Automated Rollback Gates: Implements devops argo rollouts analyze evaluating Prometheus/LogQL error rate and latency thresholds with automatic abort execution on threshold violation.
  • FastMCP Integration: Exposes argo_fleet_sync and argo_rollout_analyze tools and resource://argo/fleet/status resource.
  • Architectural Invariants & Encapsulation: Strictly satisfies cyclomatic complexity $\le 10$, nesting depth $\le 5$, and complete output submodule Rich isolation.

Verification

  • Comprehensive test suite in tests/test_argo_fleet.py with 98.47% code coverage across devops_cli.argo.
  • Full 10-gate CI quality suite passing cleanly (uv run devops ci).

- Implement multi-cluster fleet coordination engine with bounded concurrency under devops argo fleet sync
- Add progressive delivery rollout controls (promote, abort, restart) wrapping kubectl argo rollouts
- Introduce automated metric-driven rollback gates evaluating Prometheus/LogQL error rates with auto-abort capability
- Add format_argo_fleet_sync_table and format_argo_rollout_analysis_table formatters
- Register argo_fleet_sync, argo_rollout_analyze FastMCP tools and resource://argo/fleet/status resource
- Add comprehensive test suite with 98%+ code coverage adhering to strict architectural invariants
Copilot AI lite review requested due to automatic review settings September 10, 2026 13:48
@dan-petty dan-petty added this to the v0.2.15 milestone Sep 10, 2026
@dan-petty dan-petty added type/feature Type feature: a new function scope/k8s Kubernetes commands, Helm charts, pods, services, and policies priority/p1-high Priority P1: high-impact work for the next planned milestone status/in-progress Status In Progress: an owner works on the item labels Sep 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical and moderate issues affect fleet targeting, rollback safety, dry-run behavior, and MCP side effects.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds multi-cluster ArgoCD synchronization, rollout controls, metric gates, MCP integrations, tests, and documentation.

Changes:

  • Adds fleet synchronization and rollout lifecycle commands.
  • Adds Prometheus-based rollback analysis and MCP tools/resources.
  • Adds models, formatters, tests, and documentation.
File summaries
File Description
tests/test_argo_fleet.py Tests fleet, rollout, CLI, MCP, and formatting behavior.
src/devops_cli/output/formatters/tables.py Adds Argo result tables.
src/devops_cli/output/formatters/__init__.py Exports formatters.
src/devops_cli/output/formatter.py Re-exports formatter APIs.
src/devops_cli/output/__init__.py Exposes output formatters.
src/devops_cli/models/argo.py Adds fleet and rollout models.
src/devops_cli/commands/argo.py Registers Argo CLI commands.
src/devops_cli/argo/rollouts.py Implements rollout actions and metric gates.
src/devops_cli/argo/fleet.py Implements concurrent fleet synchronization.
src/devops_cli/argo/__init__.py Exports Argo operations.
src/devops_cli/ai/mcp/server.py Adds MCP tools and fleet resource.
README.md Updates the command overview.
docs/MCP_TOOLS.md Documents MCP tools.
docs/commands/argo.md Documents Argo commands.
docs/CLI_REFERENCE.md Updates the CLI reference.
docs/agent/task.md Updates task tracking.
Review details

Suppressed comments (8)

docs/agent/task.md:982

  • This task is marked complete even though linked issue #91 is still open and has no recorded closing pull request. The repository lifecycle defines completion only after merge and issue closure; keep this item in review/pending until those conditions are met.
  - [x] Multi-Cluster ArgoCD Fleet Sync & Rollouts (`devops argo fleet sync`) (P1 - High, Issue #91, PR #98)

src/devops_cli/ai/mcp/server.py:288

  • The two new MCP tools are defined here but are not imported or listed in devops_cli.ai.mcp.__init__, unlike the existing MCP tool exports. Package-level consumers cannot import the documented tools, even though direct server tests pass; update the public MCP exports with the new symbols.
@mcp.tool()
def argo_fleet_sync(

src/devops_cli/argo/fleet.py:79

  • A successful POST only means ArgoCD accepted an asynchronous sync operation; it does not mean the application reached Synced. This immediately reports each target as Synced, so the fleet can return success while a deployment is still running or has failed. Poll the operation/application status or report an explicit triggered/pending state.
        _execute_cluster_sync(app_name, cluster, prune=prune, force=force)
        return ArgoFleetAppTarget(
            app_name=app_name,
            cluster=cluster,
            status="Synced",
            message="Application synced successfully",
            duration_seconds=round(time.monotonic() - start_time, 2),

src/devops_cli/argo/fleet.py:101

  • Using clusters or [...] treats an explicitly empty cluster list (for example, --clusters "") as the default dev/staging/prod fleet. That makes a request intended to target no clusters unexpectedly trigger deployments; distinguish None from an empty list and reject or explicitly no-op the latter.
    target_clusters = clusters or ["dev", "staging", "prod"]

src/devops_cli/argo/rollouts.py:171

  • When every metric passes, this sets action_taken to promoted without calling promote_rollout; the analysis result therefore claims a rollout mutation that never happened. Either perform the promotion explicitly or report a non-mutating result such as passed/ready_to_promote.
    action = "promoted" if all_passed else "manual_intervention_required"
    reason = "All metric gates passed" if all_passed else "; ".join(failure_reasons)

src/devops_cli/argo/rollouts.py:136

  • The new rollout metric-analysis/rollback stage is also uninstrumented: no @trace_span or GLOBAL_METRICS records gate latency, metric-fetch failures, or abort outcomes. Add the required tracing and metrics so automated rollback behavior is observable in production.
def evaluate_rollout_gate(
    rollout_name: str,
    namespace: str = "default",
    thresholds: list[RolloutMetricThreshold] | None = None,
    auto_abort: bool = True,
    dry_run: bool = False,
) -> RolloutAnalysisResult:
    """Evaluate metric gates for an active rollout and execute automated rollback on violation."""

src/devops_cli/commands/argo.py:562

  • The CLI constructs exactly one Prometheus instant-query gate for HTTP 5xx error rate. There is no latency threshold input and no LogQL/Loki query path, so the advertised Prometheus/LogQL error-rate-and-latency rollback capability is not implemented by this command.
    thresholds = [
        RolloutMetricThreshold(
            metric_name="http_error_rate_percentage",
            query=f'sum(rate(http_requests_total{{status=~"5..",app="{name}"}}[2m])) / sum(rate(http_requests_total{{app="{name}"}}[2m])) * 100',
            threshold=error_rate_threshold,

src/devops_cli/models/argo.py:63

  • These new Pydantic list fields use literal mutable defaults instead of the repository's Field(default_factory=list) convention. Use factories for targets and metric_results to keep model defaults explicit and consistent with the rest of the codebase.
    targets: list[ArgoFleetAppTarget] = []
  • Files reviewed: 16/16 changed files
  • Comments generated: 14
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/devops_cli/ai/mcp/server.py Resolved
Comment thread src/devops_cli/argo/fleet.py Resolved
Comment thread src/devops_cli/argo/fleet.py Resolved
Comment thread src/devops_cli/argo/rollouts.py Resolved
Comment thread src/devops_cli/commands/argo.py Resolved
Comment thread src/devops_cli/argo/fleet.py Resolved
Comment thread src/devops_cli/argo/rollouts.py Resolved
Comment thread src/devops_cli/argo/rollouts.py Resolved
Comment thread src/devops_cli/commands/argo.py Resolved
Comment thread src/devops_cli/argo/fleet.py Resolved
@dan-petty
dan-petty merged commit 0a30cca into release/v0.2.15 Sep 10, 2026
4 checks passed
@dan-petty
dan-petty deleted the feat/argo-multicluster-fleet-sync branch September 10, 2026 19:16
dan-petty added a commit that referenced this pull request Sep 10, 2026
* fix(review): remediate security findings and enhance review feedback loop

- Remediate all 11 verified findings across security, sandbox isolation, and resource bounds:
  - CodeMode: Remove reflection primitives (getattr, hasattr, type) and sys module from safe_builtins to prevent sandbox escape
  - K8s: Remove hardcoded default password for Open-WebUI admin account, generating a cryptographically secure random token when omitted
  - SSH: Mask secrets in key rotation error messages and provide actionable connectivity guidance
  - Harness Memory: Enforce bounded LIMIT clause and cursor iteration on SQLite search queries
  - Pydantic AI Tools: Enforce unconditional path traversal validation across all tool parameters regardless of schema presence
  - Harness Compaction: Enforce bounded capacity and FIFO eviction for overflow fallback memory using OrderedDict
  - Pipeline Protocol: Sanitize stage exception messages using mask_secrets in StageExecutionRecord
  - Ollama Models: Add URL scheme validation and block link-local cloud metadata (169.254.169.254) in base_url
  - Ollama Client: Sanitize HTTP status and streaming error messages using mask_secrets
  - Valkey: Centralize and sanitize error messages across all Valkey CLI commands using mask_secrets
- Update DevSecOps review prompts, verification falsification rules, and task manuals for the closed-loop feedback loop
- Export verified findings into the continuous learning feedback dataset
- Bump version to 0.2.15 in pyproject.toml and package init
- Synchronize CLI documentation and README

Closes #87

* fix(review): address copilot feedback on sandbox isolation, credential masking, and query bounds

* feat(security): complete security scanner migration to BaseSecurityScanner and ScannerRegistry (#93)

* feat(security): complete security scanner migration to BaseSecurityScanner and ScannerRegistry

* fix(security): address review feedback on security scanner base migration

* refactor(core): eliminate obsolete shims, aliases, proxy wrappers, and backwards compatibility remnants (#95)

* refactor(core): eliminate obsolete shims, aliases, proxy wrappers, and backwards compatibility remnants

- Strip unicode icons and emojis from README bullets and markdown files
- Remove numeric counts, timestamps, and arbitrary identifiers from test names, variables, and documentation
- Remove legacy __getattr__ proxies, wrapper functions, and private aliases across commands and AI modules
- Replace private re-exports with canonical functions in security.sanitizer
- Extract clean GhCliClient and eliminate inner class shims in GitHub commands
- Clean up stopwatch timers and semantic schema variable identifiers
- Update all impacted tests and verify complete 10-gate CI suite

Closes #94

* fix(review): address copilot feedback on paginated json, adapter tests, and git boundary

- Add parse_paginated_json to handle concatenated multi-page JSON arrays from gh api --paginate in GhCliClient and gh commands
- Implement edit_milestone method on GhCliClient for full synchronizer compatibility
- Author focused unit tests for GhCliClient and parse_paginated_json in test_github_client.py
- Exercise real git repository boundary and gitignore filtering in test_review_runner.py

* refactor(pages,review): eliminate legacy config paths and harden secret redaction

* fix(review,security): decouple secret redaction and resolve CodeQL clear-text false positives

* feat(k8s): centralized kubernetes logging stack and LogQL integration (#96)

* feat(k8s): centralized kubernetes logging stack and LogQL integration

- Add declarative Loki and Fluent Bit manifests under k8s/logging with PSA labels and network isolation
- Register logging stack in deploy-stack and teardown-stack lifecycle
- Implement native LogQL query parser, line filter evaluator, and stream engine in k8s.logql
- Add OpenTelemetry trace_id extraction and trace correlation in LogQL entries and Grafana Loki datasource
- Support live follow and transparent fallback to kubectl logs in devops k8s logs
- Register FastMCP tools k8s_logs_query and k8s_logs_tail
- Author unit tests and verify 10-gate CI suite

Closes #89

* fix(k8s): remediate code review findings on centralized logging stack and logql integration

* feat(k8s): configure qdrant service with nodePort 31744 for direct host RAG access

* fix(k8s): resolve code review feedback on centralized logging stack and logql integration

* fix(k8s): confine rich markup escaping to output submodule and restore qdrant clusterip security perimeter

* feat(tf): infracost finops cloud cost estimation and reporting (#97)

* feat(tf): infracost finops cloud cost estimation and reporting

* fix(tf): address code review feedback on Infracost FinOps cost engine

- Enforce DependencyError when Infracost binary is missing in non-mock execution
- Raise typed SubprocessError on non-zero Infracost breakdown/diff subprocess exit
- Add ToolExecutionError error boundaries around breakdown and diff JSON deserialization
- Add --compare-to baseline option to run_infracost_diff and CLI command
- Validate budget thresholds before rendering and serializing JSON output
- Register dynamic MCP resource resource://tf/cost/latest
- Add comprehensive unit tests covering parsing, baseline diffs, and budget serialization

* feat(argo): multi-cluster argocd fleet synchronization and rollouts (#98)

* feat(argo): multi-cluster argocd fleet synchronization and rollouts

- Implement multi-cluster fleet coordination engine with bounded concurrency under devops argo fleet sync
- Add progressive delivery rollout controls (promote, abort, restart) wrapping kubectl argo rollouts
- Introduce automated metric-driven rollback gates evaluating Prometheus/LogQL error rates with auto-abort capability
- Add format_argo_fleet_sync_table and format_argo_rollout_analysis_table formatters
- Register argo_fleet_sync, argo_rollout_analyze FastMCP tools and resource://argo/fleet/status resource
- Add comprehensive test suite with 98%+ code coverage adhering to strict architectural invariants

* fix(argo): address review feedback on fleet sync and rollouts

* perf(ci): optimize caching configuration across all github workflows (#100)

* perf(ci): optimize caching configuration across all github workflows

* fix(ci): bound tooling cache key and enforce exact devcontainer cacheFrom assertion

* refactor(agent): modularize task tracking to eliminate merge conflicts

- Decompose monolithic docs/agent/task.md into isolated per-task tracking files under docs/agent/tasks/ (task-<issue>-<slug>.md)
- Update GitHub Projects v2 parser (src/devops_cli/github/projects.py) to recursively scan and parse docs/agent/tasks/ by default while excluding archives and READMEs
- Decompose parser functions to enforce cyclomatic complexity <= 10 and nesting depth <= 5
- Archive historical phases 1-50 in docs/agent/archive/historical-phases-1-to-50.md
- Replace docs/agent/task.md with a lean index table pointing to modular task files
- Update AGENTS.md, ROUTINE_TASKS.md, and Knowledge Base Task Manual 13 with the modular task architecture and commit context mandate
- Author comprehensive unit tests in tests/test_github_projects.py

Closes #101

* feat(ai): strengthen target-agnostic review prompts and feedback dataset synchronization

* feat(ai): generalize devops ai review for target-agnostic evaluation and multi-convention discovery

* fix(telemetry): optimize jaeger memory sizing, exception span hygiene, and embedding fast failover

- Update k8s/otel/jaeger.yaml to configure MEMORY_MAX_TRACES to 10000 and scale memory limits to 1024Mi to eliminate OOMKills
- Refactor telemetry tracer span exception handling to avoid attaching stack traces to handled CLI exits (typer.Exit)
- Add DEFAULT_RAG_EMBEDDING_TIMEOUT (15.0s) and rapid 2.0s connect timeouts for fast Ollama multi-node failover
- Author comprehensive unit tests in tests/test_telemetry.py and tests/test_rag_embeddings.py
- Ground and deliver GitHub task 104 in docs/agent/tasks/task-104-telemetry-trace-optimizations.md (Closes #104)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1-high Priority P1: high-impact work for the next planned milestone scope/k8s Kubernetes commands, Helm charts, pods, services, and policies status/in-progress Status In Progress: an owner works on the item type/feature Type feature: a new function

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants