kube

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package kube contains some tools to setup and use a Kind cluster

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteExistingManifestFile added in v1.6.0

func DeleteExistingManifestFile(cfg *envconf.Config, manifest string) error

func DeployManifestFile added in v1.6.0

func DeployManifestFile(cfg *envconf.Config, manifest string) error

Types

type Kind

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

Kind cluster deployed by each TestMain function, prepared to run a given test scenario.

func NewKind

func NewKind(kindClusterName string, options ...Option) *Kind

NewKind creates a kind cluster given a name and set of Option instances.

func (*Kind) Run

func (k *Kind) Run(m *testing.M)

Run the Kind cluster for the later execution of tests.

func (*Kind) TestEnv

func (k *Kind) TestEnv() env.Environment

TestEnv returns the env.Environment object, useful for unit tests that need to interact with the Kubernetes API.

type Option

type Option func(k *Kind)

Option that can be passed to the NewKind function in order to change the configuration of the test cluster

func Deploy

func Deploy(manifest string) Option

Deploy can be passed to NewKind to deploy extra components, in addition to the base deployment.

func ExportLogs

func ExportLogs(folder string) Option

ExportLogs can be passed to NewKind to specify the folder where the kubernetes logs will be exported after the tests.

func KindConfig

func KindConfig(filePath string) Option

KindConfig can be passed to NewKind to override the default Kind cluster configuration.

func LocalImage

func LocalImage(nameTag string) Option

LocalImage is passed to NewKind to allow loading a local Docker image into the cluster

func Timeout

func Timeout(t time.Duration) Option

Timeout for long-running operations (e.g. deployments, readiness probes...)

type Template

type Template[T any] struct {
	TemplateFile string
	Data         T
	// contains filtered or unexported fields
}

Template allows creating and deploying a K8s manifest from a Go template

func (*Template[T]) Delete

func (tm *Template[T]) Delete() features.Func

func (*Template[T]) Deploy

func (tm *Template[T]) Deploy() features.Func

Jump to

Keyboard shortcuts

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