kind

package
v5.41.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package kind provides configuration management for Kind clusters.

This package contains the core Manager implementation for loading Kind v1alpha4.Cluster configurations from files, with support for environment variable overrides and Viper-based configuration management.

Index

Constants

View Source
const DefaultClusterName = "kind"

DefaultClusterName is the default cluster name for Kind clusters.

View Source
const DefaultMirrorsDir = "kind/mirrors"

DefaultMirrorsDir is the default directory name for Kind containerd host mirror configuration.

View Source
const DefaultNetworkName = "kind"

DefaultNetworkName is the Docker network name used by Kind clusters.

View Source
const KubeletCertRotationPatch = `kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
serverTLSBootstrap: true`

KubeletCertRotationPatch is a kubeadm patch to enable kubelet serving certificate rotation. This allows the kubelet to request a proper TLS certificate via CSR, which kubelet-csr-approver will then approve, enabling secure TLS communication with metrics-server.

Variables

View Source
var DefaultKindNodeImage = kindNodeImage()

DefaultKindNodeImage is the default Kind node container image. This value is read from the Dockerfile in this package which is updated by Dependabot.

Functions

func ApplyKubeletCertRotationPatches

func ApplyKubeletCertRotationPatches(kindConfig *kindv1alpha4.Cluster)

ApplyKubeletCertRotationPatches adds kubeadm patches to all nodes to enable kubelet cert rotation. This is required for secure TLS communication between metrics-server and kubelets.

func NewKindCluster

func NewKindCluster(name, apiVersion, kind string) *v1alpha4.Cluster

NewKindCluster creates a new v1alpha4.Cluster with the specified name and TypeMeta. This function provides a canonical way to create Kind clusters with proper field initialization. Use empty string for name to create a cluster without a specific name.

func ResolveClusterName

func ResolveClusterName(
	clusterCfg *v1alpha1.Cluster,
	kindConfig *kindv1alpha4.Cluster,
) string

ResolveClusterName returns the effective cluster name from Kind config or cluster config. Priority: kindConfig.Name > clusterCfg.Spec.Cluster.Connection.Context > "kind" (default). When using Connection.Context, strips the "kind-" prefix that ContextName adds, making the ContextName/ResolveClusterName mapping bidirectional (matching Talos's "admin@" prefix stripping pattern). Returns "kind" if both configs are nil or have empty names.

func ResolveMirrorsDir

func ResolveMirrorsDir(clusterCfg *v1alpha1.Cluster) string

ResolveMirrorsDir returns the configured mirrors directory or the default. It extracts the mirrors directory from the cluster configuration if set, otherwise returns DefaultMirrorsDir.

Types

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

ConfigManager implements configuration management for Kind cluster configurations. It provides file-based configuration loading without Viper dependency.

func NewConfigManager

func NewConfigManager(configPath string) *ConfigManager

NewConfigManager creates a new configuration manager for Kind cluster configurations. configPath specifies the path to the Kind configuration file to load.

func (*ConfigManager) Load

Load loads the Kind configuration from the specified file. Returns the loaded config, either freshly loaded or previously cached. If the file doesn't exist, returns a default Kind cluster configuration. Validates the configuration after loading and returns an error if validation fails. The opts parameter is accepted for interface compliance but not currently used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL