kubectl

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package kubectl implements helper functions for managing kubernetes resources in e2e tests

This package borrows some code from https://github.com/grafana/xk6-kubernetes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client holds the state to access kubernetes

func NewForConfig

func NewForConfig(_ context.Context, config *rest.Config) (*Client, error)

NewForConfig returns a new Client using a rest.Config

func NewFromKubeconfig

func NewFromKubeconfig(ctx context.Context, kubeconfig string) (*Client, error)

NewFromKubeconfig returns a new Client using the kubeconfig pointed by the path provided

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, yaml string) error

Apply creates resources in a kubernetes cluster from a YAML manifest

func (*Client) ForwardPodPort added in v0.3.4

func (c *Client) ForwardPodPort(
	ctx context.Context,
	namespace string,
	pod string,
	port uint,
	opts ...PortForwardOption,
) (uint, error)

ForwardPodPort opens a local port for forwards requests to a pod's port. Returns the local port used for listening

type PortForwardOption added in v0.3.4

type PortForwardOption func(portForwardConfig) portForwardConfig

PortForwardOption defines a configuration option for port forwarding

func WithLocalPort added in v0.3.4

func WithLocalPort(port uint) PortForwardOption

WithLocalPort sets the local port to listen for request. Defaults to 0 (random local port)

func WithOutputStreams added in v0.3.4

func WithOutputStreams(stdout io.Writer, stderr io.Writer) PortForwardOption

WithOutputStreams sets the output streams for the port forwarder. Default to nil

Jump to

Keyboard shortcuts

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