Skip to content

[FEAT cloudctl] - Add foreach command with context selector and parallel execution #73

Description

@onuryilmaz

User Story

As a cloudctl user, I want to run a kubectl command across many clusters at once, so I can perform fleet-wide operations and compliance checks efficiently.

Description

cloudctl foreach --selector <sel> kubectl <args> — filters kubeconfig contexts using label-style selectors, shows a confirmation prompt, then runs the command in parallel across all selected contexts with per-context prefixed output and fail count aggregation.

Selector syntax: name=VALUE, name!=VALUE, name in (a,b,c), name notin (a,b,c), name~=REGEX, name!~=REGEX. Empty selector matches all contexts.

Acceptance Criteria

  • Context list read from kubeconfig
  • All selector syntaxes supported
  • Confirmation prompt shown unless --quiet / -q
  • Commands run in parallel across selected contexts
  • stdout/stderr output prefixed with [context-name]
  • Exit with error if any execution fails; total failure count reported

Reference Issues

Epic: #70

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationCapabilities that enhance the tool's use in CI/CD or scriptsfeatureNew functional capabilities or significant additions to the CLI.good first issueGood for newcomersneeds-refinementNeeds scoping before implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions