kube

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBootstrapTokenNotFound = errors.New("bootstrap token not found")

ErrBootstrapTokenNotFound is returned by GetBootstrapToken when no matching bootstrap token secret exists in the cluster.

Functions

func ApplyBootstrapToken

func ApplyBootstrapToken(ctx context.Context, kubeCli kubernetes.Interface, fieldManager string, token *BootstrapToken) error

func ApplyManifests

func ApplyManifests(ctx context.Context, logger *slog.Logger, k8sClient client.Client, fieldManager string, data []byte) error

ApplyManifests decodes one or more YAML/JSON resources from data and applies each one to the cluster using server-side apply.

func ApplyManifestsInDirectory

func ApplyManifestsInDirectory(ctx context.Context, logger *slog.Logger, k8sClient client.Client, fieldManager, manifestDir string, skipPaths []string) error

ApplyManifestsInDirectory walks manifestDir recursively and applies every .yaml/.yml file it finds using server-side apply via the controller-runtime client. Any file whose path relative to manifestDir appears in skipPaths is skipped.

func CheckKubectlAvailable

func CheckKubectlAvailable() error

func ClientAndConfigFromFile

func ClientAndConfigFromFile(filePath string) (*kubernetes.Clientset, *rest.Config, error)

func KubectlCmd

func KubectlCmd(ctx context.Context, logger *slog.Logger, kubectl KubectlFunc, args ...string) error

func SanitizeK8sName

func SanitizeK8sName(raw string) string

SanitizeK8sName converts a raw string into a valid Kubernetes object name. Kubernetes names must be lowercase RFC-1123 subdomains: lowercase alphanumeric characters, '-' or '.', must start and end with an alphanumeric character, and be at most 253 characters.

Types

type BootstrapToken

type BootstrapToken struct {
	ID     string
	Secret string
	Labels map[string]string
}

func GetBootstrapTokenForSite

func GetBootstrapTokenForSite(ctx context.Context, kubeCli kubernetes.Interface, siteName string) (*BootstrapToken, error)

func NewBootstrapToken

func NewBootstrapToken() (*BootstrapToken, error)

func (*BootstrapToken) String

func (t *BootstrapToken) String() string

func (*BootstrapToken) WithLabel

func (t *BootstrapToken) WithLabel(key, value string) *BootstrapToken

type KubectlFunc

type KubectlFunc func(context.Context) *exec.Cmd

func Kubectl

func Kubectl(env []string, kubeconfig string) KubectlFunc

Jump to

Keyboard shortcuts

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