diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md index a5cc28b5fc..9cc301d8c2 100644 --- a/docs/CLI_REFERENCE.md +++ b/docs/CLI_REFERENCE.md @@ -881,7 +881,7 @@ devops k8s bootstrap [OPTIONS] |---|---|---|---| | `--dir`, `-d` | `path` | `k8s` | Directory containing Kubernetes manifests. | | `--auto-start` / `--no-auto-start` | `boolean` | `True` | Auto-start minikube if stopped. | -| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | ### `devops k8s bootstrap-openwebui` @@ -922,7 +922,7 @@ devops k8s deploy-stack [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--k8s-dir` | `path` | `k8s` | Path to k8s/ config directory. | -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--domain`, `-d` | `string` | - | Domain to substitute for template (defaults to k8s.domain in config.yaml). | | `--wait` / `--no-wait` | `boolean` | `True` | Wait for Helm releases and workloads to become ready before returning. | @@ -952,7 +952,7 @@ devops k8s sync-secrets [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -1012,7 +1012,7 @@ devops k8s configure-urls [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--addressing`, `-a` | `string` | - | How to record endpoints: 'nodeport' writes a cluster-specific host and port, 'proxy' writes portable k8s:// service addresses needing no port-forward, only for the Services that the API server reaches, 'fqdn' discovers Ingress hostnames and writes domain-based URLs. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -1056,7 +1056,7 @@ devops k8s port-forward [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--argocd-port` | `integer` | `8080` | Local port for ArgoCD. | | `--grafana-port` | `integer` | `8030` | Local port for Grafana. | @@ -1107,7 +1107,7 @@ devops k8s teardown-stack [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--k8s-dir` | `path` | `k8s` | Path to k8s/ config directory. | -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -1219,7 +1219,7 @@ devops k8s enable-tls [OPTIONS] | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--tls-dir` | `path` | `~/.config/devops-cli/tls` | Directory with generated TLS certificates. | | `--secret-name` | `string` | `homelab-tls` | Name of the Kubernetes TLS secret to create or update. | -| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--overwrite`, `-f` | `boolean` | - | Overwrite existing files or resources if they exist. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | diff --git a/docs/MCP_TOOLS.md b/docs/MCP_TOOLS.md index 38057f6a6b..db98a9b5c3 100644 --- a/docs/MCP_TOOLS.md +++ b/docs/MCP_TOOLS.md @@ -1172,7 +1172,7 @@ Bootstrap homelab Kubernetes cluster with Minikube, Calico, and ingress. |---|---|---|---|---| | `k8s_dir` | `string` | No | `k8s` | Directory containing Kubernetes manifests. | | `auto_start` | `boolean` | No | `True` | Auto-start minikube if stopped. | -| `stack` | `string` | No | `all` | Stack to operate on: infra | llm | all. | +| `stack` | `string` | No | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `dry_run` | `boolean` | No | `False` | Preview execution plan without mutating external state. | ### `k8s_chaos` @@ -1225,7 +1225,7 @@ reads them. A locked or missing keyring stops it before it applies anything. | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | `k8s_dir` | `string` | No | `k8s` | Path to k8s/ config directory. | -| `stack` | `string` | No | `infra` | Stack to operate on: infra | llm | all. | +| `stack` | `string` | No | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `context` | `string` | No | - | Kubernetes cluster context name. | | `domain` | `string` | No | - | Domain to substitute for template (defaults to k8s.domain in config.yaml). | | `wait` | `boolean` | No | `True` | Wait for Helm releases and workloads to become ready before returning. | @@ -1281,7 +1281,7 @@ Generate Homelab certificates and apply TLS secrets across Kubernetes cluster na | `context` | `string` | No | - | Kubernetes cluster context name. | | `tls_dir` | `string` | No | `` | Directory with generated TLS certificates. | | `secret_name` | `string` | No | `homelab-tls` | Name of the Kubernetes TLS secret to create or update. | -| `stack` | `string` | No | `all` | Stack to operate on: infra | llm | all. | +| `stack` | `string` | No | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `overwrite` | `boolean` | No | `False` | Overwrite existing files or resources if they exist. | | `dry_run` | `boolean` | No | `False` | Preview execution plan without mutating external state. | @@ -1381,7 +1381,7 @@ Uninstall the k8s infrastructure / LLM stack and delete namespaces. | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | `k8s_dir` | `string` | No | `k8s` | Path to k8s/ config directory. | -| `stack` | `string` | No | `infra` | Stack to operate on: infra | llm | all. | +| `stack` | `string` | No | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `context` | `string` | No | - | Kubernetes cluster context name. | | `dry_run` | `boolean` | No | `False` | Preview execution plan without mutating external state. | diff --git a/docs/commands/k8s.md b/docs/commands/k8s.md index f986eea438..72774c4e92 100644 --- a/docs/commands/k8s.md +++ b/docs/commands/k8s.md @@ -151,7 +151,7 @@ devops k8s bootstrap [OPTIONS] |---|---|---|---| | `--dir`, `-d` | `path` | `k8s` | Directory containing Kubernetes manifests. | | `--auto-start` / `--no-auto-start` | `boolean` | `True` | Auto-start minikube if stopped. | -| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | --- @@ -196,7 +196,7 @@ devops k8s deploy-stack [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--k8s-dir` | `path` | `k8s` | Path to k8s/ config directory. | -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--domain`, `-d` | `string` | - | Domain to substitute for template (defaults to k8s.domain in config.yaml). | | `--wait` / `--no-wait` | `boolean` | `True` | Wait for Helm releases and workloads to become ready before returning. | @@ -228,7 +228,7 @@ devops k8s sync-secrets [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -294,7 +294,7 @@ devops k8s configure-urls [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--addressing`, `-a` | `string` | - | How to record endpoints: 'nodeport' writes a cluster-specific host and port, 'proxy' writes portable k8s:// service addresses needing no port-forward, only for the Services that the API server reaches, 'fqdn' discovers Ingress hostnames and writes domain-based URLs. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -342,7 +342,7 @@ devops k8s port-forward [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--argocd-port` | `integer` | `8080` | Local port for ArgoCD. | | `--grafana-port` | `integer` | `8030` | Local port for Grafana. | @@ -399,7 +399,7 @@ devops k8s teardown-stack [OPTIONS] | Option / Flag | Type | Default | Description | |---|---|---|---| | `--k8s-dir` | `path` | `k8s` | Path to k8s/ config directory. | -| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `infra` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | @@ -523,7 +523,7 @@ devops k8s enable-tls [OPTIONS] | `--context`, `-c` | `string` | - | Kubernetes cluster context name. | | `--tls-dir` | `path` | `~/.config/devops-cli/tls` | Directory with generated TLS certificates. | | `--secret-name` | `string` | `homelab-tls` | Name of the Kubernetes TLS secret to create or update. | -| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | all. | +| `--stack`, `-s` | `string` | `all` | Stack to operate on: infra | llm | logging | devops | gitea | all. | | `--overwrite`, `-f` | `boolean` | - | Overwrite existing files or resources if they exist. | | `--dry-run` | `boolean` | - | Preview execution plan without mutating external state. | diff --git a/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/.openspec.yaml b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/.openspec.yaml new file mode 100644 index 0000000000..97e3642024 --- /dev/null +++ b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-10-27 diff --git a/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/design.md b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/design.md new file mode 100644 index 0000000000..ef24eb057f --- /dev/null +++ b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/design.md @@ -0,0 +1,32 @@ +# Design + +## Context + +See proposal.md - Why. `HELP.k8s.stack` defines a static help string that only names `infra | llm | all`. + +## Goals / Non-Goals + +**Goals:** +- Centralize accepted stack values in `CONST_K8S_VALID_STACKS` in `src/devops_cli/config/constants.py`. +- Re-use `CONST_K8S_VALID_STACKS` for `VALID_STACKS` in `networking.py` and `stack_lifecycle.py`. +- Dynamically format `HELP.k8s.stack` using `CONST_K8S_VALID_STACKS`. +- Ensure tests verify that all valid stacks appear in the help string. + +**Non-Goals:** +- Modify stack deployment logic or change the set of accepted stacks. + +## Decisions + +### Centralize stack definition in constants.py +Declare `CONST_K8S_VALID_STACKS: Final[tuple[str, ...]] = ("infra", "llm", "logging", "devops", "gitea", "all")` in `src/devops_cli/config/constants.py`. +- *Rationale*: `constants.py` has only standard library dependencies. `src/devops_cli/lang/en/help.py` can import it without circular dependencies. +- *Rejected Alternative*: Import `VALID_STACKS` directly from `src/devops_cli/commands/k8s/networking.py` into `help.py`. Rejected because `networking.py` imports `HELP` from `devops_cli.lang`, creating a circular import cycle. + +### Format help string dynamically +Format `HELP.k8s.stack` as `f"Stack to operate on: {' | '.join(CONST_K8S_VALID_STACKS)}."`. +- *Rationale*: Guarantees that any stack added to `CONST_K8S_VALID_STACKS` is automatically included in the CLI help of all commands sharing `HELP.k8s.stack`. +- *Rejected Alternative*: Manually updating the static string to `"Stack to operate on: infra | llm | logging | devops | gitea | all."`. Rejected because future stack additions would cause help to become stale again. + +## Risks / Trade-offs + +- [Generated docs drift] → Run `devops docs generate --sync-readme` and verify with `devops docs check`. diff --git a/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/proposal.md b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/proposal.md new file mode 100644 index 0000000000..4c8415a92c --- /dev/null +++ b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/proposal.md @@ -0,0 +1,46 @@ +# Proposal + +## Why + +Issue #2157: `devops k8s deploy-stack --help` says for `--stack`: "Stack to operate on: infra | llm | all." The command accepts more stacks. `VALID_STACKS` in `src/devops_cli/commands/k8s/networking.py:68` contains `("infra", "llm", "logging", "devops", "gitea", "all")`. The help string does not name `logging`, `devops`, or `gitea`. When contributors add a new stack, a hardcoded help string becomes incorrect again. + +## What Changes + +- Declare `CONST_K8S_VALID_STACKS` in `src/devops_cli/config/constants.py` as the single source of truth for valid stacks. +- Reference `CONST_K8S_VALID_STACKS` for `VALID_STACKS` in `src/devops_cli/commands/k8s/networking.py` and `src/devops_cli/commands/k8s/stack_lifecycle.py`. +- Update `HELP.k8s.stack` in `src/devops_cli/lang/en/help.py` to format all items of `CONST_K8S_VALID_STACKS` dynamically. +- Regenerate the CLI documentation to reflect the updated help text. +- Add an automated test that fails if any item in `VALID_STACKS` is missing from the help text. +- This change alters command help text observed by users, so it includes a new capability specification delta: `k8s-stack-help`. +- This change fits one pull request. + +## Capabilities + +### New Capabilities + +- `k8s-stack-help`: help documentation for Kubernetes stack commands dynamically names every valid stack. + +### Modified Capabilities + +None. + +## Impact + +- `src/devops_cli/config/constants.py` +- `src/devops_cli/commands/k8s/networking.py` +- `src/devops_cli/commands/k8s/stack_lifecycle.py` +- `src/devops_cli/lang/en/help.py` +- `docs/CLI_REFERENCE.md` +- `docs/commands/k8s.md` +- `tests/test_k8s_networking.py` + +## Feasibility + +- Running `uv run devops k8s deploy-stack --help` produces `--stack: Stack to operate on: infra | llm | all.` +- Inspection of `src/devops_cli/commands/k8s/networking.py:68` and `src/devops_cli/commands/k8s/stack_lifecycle.py:286` confirms `VALID_STACKS` contains `("infra", "llm", "logging", "devops", "gitea", "all")`. +- `CONST_K8S_VALID_STACKS` in `src/devops_cli/config/constants.py` can be imported by `src/devops_cli/lang/en/help.py` with zero circular import risk. +- Verification with `uv run pytest tests/test_cli_startup_imports.py` confirms importing constants does not exceed startup module limits. + +## Existing Tool Considered + +Python standard library tuple constants and string joining format the help string from the constant. No custom parser or external library is needed. The redundant tuple literal in `stack_lifecycle.py` and `networking.py` is removed in favor of `CONST_K8S_VALID_STACKS`. diff --git a/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/specs/k8s-stack-help/spec.md b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/specs/k8s-stack-help/spec.md new file mode 100644 index 0000000000..b4d0c9cdfa --- /dev/null +++ b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/specs/k8s-stack-help/spec.md @@ -0,0 +1,22 @@ +# Spec Delta + +## Purpose + +The Kubernetes stack commands display CLI help that dynamically includes every accepted stack value. + +## ADDED Requirements + +### Requirement: Stack option help names all supported stacks +The `--stack` option help for Kubernetes stack commands SHALL name every valid stack configured in `VALID_STACKS`. + +#### Scenario: Display deploy-stack help +- **WHEN** user executes `devops k8s deploy-stack --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` + +#### Scenario: Display teardown-stack help +- **WHEN** user executes `devops k8s teardown-stack --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` + +#### Scenario: Display port-forward help +- **WHEN** user executes `devops k8s port-forward --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` diff --git a/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/tasks.md b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/tasks.md new file mode 100644 index 0000000000..607bbe566c --- /dev/null +++ b/openspec/changes/archive/2026-10-27-2157-k8s-stack-help/tasks.md @@ -0,0 +1,11 @@ +# Tasks + +## 1. Kubernetes stack help naming every stack + +- [x] 1.1 Add failing tests asserting that `HELP.k8s.stack` and commands using it contain all values from `VALID_STACKS`; verify failure with `uv run pytest tests/test_k8s_networking.py -k test_k8s_stack_help_names_every_valid_stack` +- [x] 1.2 Define `CONST_K8S_VALID_STACKS` in `src/devops_cli/config/constants.py`, bind `VALID_STACKS` to it in `src/devops_cli/commands/k8s/networking.py` and `src/devops_cli/commands/k8s/stack_lifecycle.py`, and dynamically format `HELP.k8s.stack` in `src/devops_cli/lang/en/help.py`; verify with `uv run pytest tests/test_k8s_networking.py -k test_k8s_stack_help_names_every_valid_stack` +- [x] 1.3 Regenerate CLI reference documentation with `uv run devops docs generate --sync-readme` and verify with `uv run devops docs check` + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD). diff --git a/openspec/specs/k8s-stack-help/spec.md b/openspec/specs/k8s-stack-help/spec.md new file mode 100644 index 0000000000..37b1d53745 --- /dev/null +++ b/openspec/specs/k8s-stack-help/spec.md @@ -0,0 +1,21 @@ +# k8s-stack-help Specification + +## Purpose +The Kubernetes stack commands display CLI help that dynamically includes every accepted stack value. + +## Requirements + +### Requirement: Stack option help names all supported stacks +The `--stack` option help for Kubernetes stack commands SHALL name every valid stack configured in `VALID_STACKS`. + +#### Scenario: Display deploy-stack help +- **WHEN** user executes `devops k8s deploy-stack --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` + +#### Scenario: Display teardown-stack help +- **WHEN** user executes `devops k8s teardown-stack --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` + +#### Scenario: Display port-forward help +- **WHEN** user executes `devops k8s port-forward --help` +- **THEN** the `--stack` option description lists every stack in `VALID_STACKS` diff --git a/src/devops_cli/commands/k8s/networking.py b/src/devops_cli/commands/k8s/networking.py index 35799dd484..bdfcd0631a 100644 --- a/src/devops_cli/commands/k8s/networking.py +++ b/src/devops_cli/commands/k8s/networking.py @@ -20,6 +20,7 @@ CONST_ADDRESSING_PROXY, CONST_AI_GATEWAY_PROVIDER, CONST_K8S_INGRESS_SERVICE_PATTERNS, + CONST_K8S_VALID_STACKS, CONST_OUTPUT_FORMAT_TABLE, CONST_PLACEHOLDER_NODE, CONST_PLACEHOLDER_PORT, @@ -65,7 +66,7 @@ logger = logging.getLogger(__name__) -VALID_STACKS: tuple[str, ...] = ("infra", "llm", "logging", "devops", "gitea", "all") +VALID_STACKS: tuple[str, ...] = CONST_K8S_VALID_STACKS def _resolve_stacks(stack: str) -> list[str]: diff --git a/src/devops_cli/commands/k8s/stack_lifecycle.py b/src/devops_cli/commands/k8s/stack_lifecycle.py index be5b3729ac..d8f1f056f9 100644 --- a/src/devops_cli/commands/k8s/stack_lifecycle.py +++ b/src/devops_cli/commands/k8s/stack_lifecycle.py @@ -32,6 +32,7 @@ CONST_K8S_ARGOCD_HOMELAB_APPLICATIONS_BY_STACK, CONST_K8S_DEVOPS_CONFIGMAP, CONST_K8S_OLLAMA_PROFILES_PATH, + CONST_K8S_VALID_STACKS, ) from devops_cli.config.defaults import ( DEFAULT_K8S_DIR, @@ -283,7 +284,7 @@ "llm": (Path("llm", "gateway", "servicemonitor.yaml"),), } -VALID_STACKS: tuple[str, ...] = ("infra", "llm", "logging", "devops", "gitea", "all") +VALID_STACKS: tuple[str, ...] = CONST_K8S_VALID_STACKS def _recover_stuck_helm_release( diff --git a/src/devops_cli/config/constants.py b/src/devops_cli/config/constants.py index 2676921e26..d25ad92b67 100644 --- a/src/devops_cli/config/constants.py +++ b/src/devops_cli/config/constants.py @@ -1034,6 +1034,15 @@ "Kustomization", ) """The standard file names Kustomize recognizes for a directory overlay.""" +CONST_K8S_VALID_STACKS: Final[tuple[str, ...]] = ( + "infra", + "llm", + "logging", + "devops", + "gitea", + "all", +) +"""The valid stack identifiers accepted by Kubernetes stack commands (#2157).""" CONST_K8S_ARGOCD_APPLICATION_DIRS: Final[tuple[Path, ...]] = ( Path("k8s/argocd/apps"), Path("k8s/argocd/bootstrap"), diff --git a/src/devops_cli/lang/en/help.py b/src/devops_cli/lang/en/help.py index 16c0c2fcda..909650654c 100644 --- a/src/devops_cli/lang/en/help.py +++ b/src/devops_cli/lang/en/help.py @@ -4,6 +4,8 @@ from dataclasses import dataclass, field +from devops_cli.config.constants import CONST_K8S_VALID_STACKS + @dataclass(frozen=True) class MainHelp: @@ -411,7 +413,7 @@ class K8sCommandHelp: pod_name: str = "Pod name." manifests_dir: str = "Directory containing Kubernetes manifests." auto_start: str = "Auto-start minikube if stopped." - stack: str = "Stack to operate on: infra | llm | all." + stack: str = f"Stack to operate on: {' | '.join(CONST_K8S_VALID_STACKS)}." k8s_dir: str = "Path to k8s/ config directory." email: str = "Admin email address." admin_name: str = "Admin display name." diff --git a/tests/test_k8s_networking.py b/tests/test_k8s_networking.py index f881f58c21..ade02756be 100644 --- a/tests/test_k8s_networking.py +++ b/tests/test_k8s_networking.py @@ -667,3 +667,26 @@ def test_configure_urls_saves_when_only_task_gateway_urls_change( ) assert "ai.tasks.analysis.api_base_url" in result.output assert "ai.tasks.chat.api_base_url" in result.output + + +def test_k8s_stack_help_names_every_valid_stack(cli: Any) -> None: + """The --stack option help names every value of VALID_STACKS (#2157).""" + from devops_cli.commands.k8s.networking import VALID_STACKS + from devops_cli.lang import HELP + + for stack in VALID_STACKS: + assert stack in HELP.k8s.stack + + commands_with_stack = ( + ("k8s", "deploy-stack"), + ("k8s", "teardown-stack"), + ("k8s", "port-forward"), + ("k8s", "configure-urls"), + ("k8s", "bootstrap"), + ("k8s", "enable-tls"), + ) + for cmd in commands_with_stack: + result = cli(*cmd, "--help") + assert result.exit_code == 0 + for stack in VALID_STACKS: + assert stack in result.output