kube

package
v1.10.0-alloy Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 33 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

func DumpMetrics

func DumpMetrics(out io.Writer, promHostPort string) error

func DumpTraces

func DumpTraces(out io.Writer, jaegerHostPort 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 ExportJaeger

func ExportJaeger(hostPort string) Option

ExportJaeger overrides a jaeger host:port, where all the stored traces will be collected from before the Kind cluster is shut down. Default: localhost:36686

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. Default: k8s.KindLogs

func ExportPrometheus

func ExportPrometheus(hostPort string) Option

ExportPrometheus overrides the prometheus host:port, where all the stored metrics will be collected from before the Kind cluster is shut down. Default: localhost:39090

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