envtest

package
v1.105.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 44 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatorConfig

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

AggregatorConfig is able to configure the kube-aggregator (kube-apiserver aggregation layer) by provisioning the front-proxy certs and setting the corresponding flags on the kube-apiserver.

func (AggregatorConfig) ConfigureAPIServerArgs

func (a AggregatorConfig) ConfigureAPIServerArgs(certDir string, args *envtest.Arguments) error

ConfigureAPIServerArgs generates the needed certs, writes them to the given directory and configures args to point to the generated certs.

type GardenerAPIServer

type GardenerAPIServer struct {
	// EtcdURL is the etcd URL that the APIServer should connect to (defaults to the URL of the envtest etcd).
	EtcdURL *url.URL
	// CertDir is a path to a directory containing whatever certificates the APIServer needs.
	// If left unspecified, then Start will create a temporary directory and generate the needed
	// certs and Stop will clean it up.
	CertDir string
	// Path is the path to the gardener-apiserver binary, can be set via TEST_ASSET_GARDENER_APISERVER.
	// If Path is unset, gardener-apiserver will be started in-process.
	Path string
	// SecurePort is the secure port that the APIServer should listen on.
	// If this is not specified, we default to a random free port on localhost.
	SecurePort int
	// Args is a list of arguments which will passed to the APIServer binary.
	// If not specified, the minimal set of arguments to run the APIServer will
	// be used.
	Args []string
	// StartTimeout, StopTimeout specify the time the APIServer is allowed to
	// take when starting and stoppping before an error is emitted.
	// If not specified, these default to 20 seconds.
	StartTimeout time.Duration
	StopTimeout  time.Duration
	// Out, Err specify where APIServer should write its StdOut, StdErr to.
	// If not specified, the output will be discarded.
	Out io.Writer
	Err io.Writer
	// HealthCheckEndpoint is the path of the healthcheck endpoint (defaults to "/healthz").
	// It will be polled until receiving http.StatusOK (or StartTimeout occurs), before
	// returning from Start.
	HealthCheckEndpoint string
	// contains filtered or unexported fields
}

GardenerAPIServer knows how to start, register and stop a temporary gardener-apiserver instance.

func (*GardenerAPIServer) Start

func (g *GardenerAPIServer) Start() error

Start brings up the GardenerAPIServer, waits for it to be healthy and registers Gardener's APIs.

func (*GardenerAPIServer) Stop

func (g *GardenerAPIServer) Stop() error

Stop stops this GardenerAPIServer and cleans its temporary resources.

type GardenerTestEnvironment

type GardenerTestEnvironment struct {
	*envtest.Environment

	// UseExistingGardener specifies whether to run the test against an existing gardener control plane.
	// If it is set to true, Start will skip starting a temporary control plane and gardener-apiserver, and connect to the
	// cluster targeted by $KUBECONFIG instead.
	// If it is unset, setting the USE_EXISTING_GARDENER env var to `true` will have the same effects.
	UseExistingGardener *bool

	// GardenerAPIServer knows how to start, register and stop a temporary gardener-apiserver instance.
	GardenerAPIServer *GardenerAPIServer
	// contains filtered or unexported fields
}

GardenerTestEnvironment wraps envtest.Environment and additionally starts, registers and stops an instance of gardener-apiserver in order to work with gardener resources in the test.

func (*GardenerTestEnvironment) Start

func (e *GardenerTestEnvironment) Start() (*rest.Config, error)

Start starts the underlying envtest.Environment and the GardenerAPIServer.

func (*GardenerTestEnvironment) Stop

func (e *GardenerTestEnvironment) Stop() error

Stop stops the underlying envtest.Environment and the GardenerAPIServer.

Jump to

Keyboard shortcuts

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