Skip to content

Conversation

@Jayclifford345
Copy link

@Jayclifford345 Jayclifford345 commented Aug 14, 2025

Add k8s-test: self-contained CLI for running Helm chart tests

Overview

Introduce a Go-based CLI (tools/k8s-test) to run chart tests without shell scripts on PATH. It embeds the existing tools/helm-test/manifests at build time, reusing the repo as the single source of truth.

Key features

  • Embedded manifests
    • make build copies tools/helm-test/manifests/** into the binary via go:embed.
    • No duplication; rebuild to pick up manifest changes.
  • Full command set
    • Main: k8s-test, k8s-test run
    • Cluster: cluster info|check|create|delete
    • Deps: deps list|deploy
    • Subject: subject info|deploy|upgrade|delete
    • Tests: test list|run [--phase deploy|upgrade|delete]
  • Test plan compatibility
    • Defaults subject.type to helm if omitted (no breaking change).
    • subject.path supports local source testing; remote charts still supported.
  • Flux integration
  • Kind ergonomics
    • --workers flag for run and cluster create (default 1). If no configFile, generates a minimal Kind config with 1 control-plane + N workers.
    • Reuses existing cluster if present.
    • --tidy flag to auto-delete the cluster after tests complete.

Usage

  • Build:
    • cd tools/k8s-test && make build
  • Run full local workflow:
    • k8s-test run -d <test-dir> [--workers N] [--tidy]
  • Step-by-step:
    • k8s-test cluster create -d <test-dir> [--workers N]
    • k8s-test deps deploy
    • k8s-test subject deploy -d <test-dir>
    • k8s-test test run -d <test-dir>

Requirements

  • Tools on PATH: kubectl, helm, flux, and kind (or minikube).
  • Rebuild the binary to pick up manifest changes.

Files added/updated

  • tools/k8s-test/ Go module, Cobra commands, embedded FS, Makefile, README
  • .gitignore: ignore tools/k8s-test/internal/helmtestfs/manifests/ and tools/k8s-test/bin/

Next steps (optional)

  • Add cloud providers (AKS/EKS/GKE/OpenShift).
  • Add a no-Flux mode (translate Flux HRs to helm upgrade --install).
  • Add GitHub release workflow for multi-platform binaries.

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