cluster

package
v0.0.0-...-8540621 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context stores the config and clients to connect with a particular kubernetes cluster.

func NewContextFromConfig

func NewContextFromConfig(kubeconfig []byte) (*Context, error)

NewContextFromConfig writes the given kubeconfig to a file, and the returns NewContextFromPath for that file.

func NewContextFromPath

func NewContextFromPath(kubeconfigPath string) (*Context, error)

NewContextFromPath creates a new Context for the cluster specified in the given kubeconfig file.

func (*Context) AddEnv

func (ctx *Context) AddEnv(cmd *exec.Cmd)

AddEnv adds the necessary environment variables to a exec.Cmd, such that the command will use the k8s cluster specified by this context.

func (*Context) Clientset

func (ctx *Context) Clientset() *kubernetes.Clientset

Clientset returns the kubernetes Clientset for this cluster.

func (*Context) Close

func (ctx *Context) Close() error

Close the context, removing the temp file if it exists.

func (*Context) RestConfig

func (ctx *Context) RestConfig() *rest.Config

RestConfig returns the kubernetes client config for this cluster.

type Provider

type Provider interface {
	// GetCluster returns the Context for a cluster matching the given spec, a cleanup function for tearing down the cluster, or an error on failure.
	// The caller is responsible for calling Context.Close
	GetCluster(context.Context, *experimentpb.ClusterSpec) (*Context, func(), error)
	// Close cleanups the provider.
	Close() error
}

Provider is an interface for implementations that can provide a cluster conforming to a given ClusterSpec.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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