Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create sets up a local kind development cluster with the configured components. This is the Go equivalent of hack/cluster.sh + hack/binaries.sh + hack/registry.sh.
func Delete ¶
Delete removes a single func-managed dev cluster. The shared registry container and the host's insecure-registries entry are removed only when the *last* func-managed cluster is being torn down — other surviving clusters keep using the shared registry.
Delete is safe when nothing is tracked (empty List / no kubeconfig): it still runs the empty-list shared-resource teardown and returns nil (idempotent, rm -f style). kind-delete failures are only warned when a kubeconfig was present — otherwise every empty-system delete would print a scary "failed to delete cluster" for a cluster that never existed.
func List ¶
func List() []string
List returns the names of func-managed clusters on this host — those with a kubeconfig under <config.Dir()>/clusters/<name>.local/. Kind clusters created outside func (e.g. via `kind create cluster` directly) are not included; this is intentional so that `func cluster delete foo` can't accidentally remove an unrelated kind cluster, and so the list reflects only what this tool manages.
No error return: a missing/unreadable clusters directory means "none", which is the correct answer for a fresh system.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct {
// Cluster identity
Name string // Cluster name (default: "func")
Domain string // DNS domain for services (default: "localtest.me")
// Component toggles
Serving bool // Install Knative Serving (default: true)
Eventing bool // Install Knative Eventing (default: true)
Tekton bool // Install Tekton + PAC (default: false)
Keda bool // Install KEDA + HTTP add-on (default: false)
// Operational
Retries int // Max allocation attempts (default: 1)
Namespace string // K8s namespace for RBAC bindings (default: "default")
// ContainerEngineOverride, when non-empty, is returned verbatim by
// ContainerEngine(). Empty means "auto-detect".
// The CLI wires --container-engine into this field.
ContainerEngineOverride string
// PAC
PacHost string // PAC controller hostname (default: "pac-ctr.localtest.me")
// Skip flags
SkipBinaries bool // Skip binary downloads
SkipRegistryConfig bool // Skip host registry configuration
NoCleanup bool // Don't delete cluster on failure
// Optional tool path overrides. When non-empty, the kubectl/kind
// accessors return the override verbatim; otherwise they resolve via
// BinDir then PATH. The CLI samples FUNC_TEST_<TOOL> env vars into
// these fields; the library itself never reads the environment.
KubectlOverride string
KindOverride string
// CI detection
GitHubActions bool // Auto-detected from GITHUB_ACTIONS env
}
ClusterConfig holds all configuration for cluster create/delete operations.
func (ClusterConfig) BinDir ¶
func (c ClusterConfig) BinDir() string
BinDir returns the directory where managed tool binaries live: <config.Dir()>/bin. Derived on-demand so callers that mutate Name don't need to remember to refresh anything.
func (ClusterConfig) ContainerEngine ¶
func (c ClusterConfig) ContainerEngine() string
ContainerEngine returns the container engine to use: the override if set, otherwise auto-detected. Called once per engine invocation rather than memoized because the auto-detect cost is trivial compared to the kind/kubectl work each call precedes.
Auto-detection mirrors hack/common.sh:
- If docker is on PATH, use it — but detect the podman-docker wrapper (`/usr/bin/docker` shimmed to exec podman) by inspecting `docker --version`; if it reports podman, switch to podman so downstream podman-specific workarounds fire.
- Otherwise, use podman if present.
- Otherwise, fall back to "docker" (callers will surface a clearer error when they try to exec it).
func (ClusterConfig) Kubeconfig ¶
func (c ClusterConfig) Kubeconfig() string
Kubeconfig returns the kubeconfig path for this cluster: <config.Dir()>/clusters/<Name>.local/kubeconfig.yaml.