k8s

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertJobSucceeds

func AssertJobSucceeds(t *testing.T, ctx context.Context, jobClient JobClient, jobSpec *apiv1.Job, optFns ...AssertJobSucceedsOptsFunc)

AssertJobSucceeds will start a Kubernetes Job using the provided client and spec, then after it completes will either fail the passed test (if the job fails) or pass the test if the job succeeds. It should be passed a JobClient object and a Job object.

func GetClientsetE

func GetClientsetE(ctx context.Context, optFns ...GetClientsetEOptionsFunc) (clientset *k8s.Clientset, err error)

GetClientsetE returns a Kuberenets client-go Clientset object with a friendly interface.

Types

type AssertJobSucceedsOptions

type AssertJobSucceedsOptions struct {
	// The job to run.
	JobSpec apiv1.Job
	// The CreateOptions used when creating the job.
	CreateOptions metav1.CreateOptions
	// The GetOptions used when retrieving the job for subsequent checks.
	GetOptions metav1.GetOptions
}

AssertJobSucceedsOptions is a struct used for functional options for the AssertJobSucceeds method.

type AssertJobSucceedsOptsFunc

type AssertJobSucceedsOptsFunc func(AssertJobSucceedsOptions) error

type GetClientsetEOptionsFunc

type GetClientsetEOptionsFunc func(*GetClientsetOptionsE) error

GetClientsetEOptionsFunc is the type for the functional options arguments for the GetClientsetE method.

func WithGetClientsetEHost

func WithGetClientsetEHost(host string) (f GetClientsetEOptionsFunc)

WithGetClientsetEHost sets a host name when invoking the GetClientsetE method.

func WithGetClientsetEKubeconfigPath

func WithGetClientsetEKubeconfigPath(path string) (f GetClientsetEOptionsFunc)

WithGetClientsetEKubeconfigPath sets the GetClientsetE method to configure from a Kubeconfig file at a particular path. This should almost always be called only by itself, not with other `WithGetClientsetE` methods.

func WithGetClientsetETLSCAData

func WithGetClientsetETLSCAData(caData []byte) (f GetClientsetEOptionsFunc)

WithGetClientsetETLSCAData sets the expected CA certificate data when invoking the GetClientsetE method.

func WithGetClientsetEToken

func WithGetClientsetEToken(token string) (f GetClientsetEOptionsFunc)

WithGetClientsetEToken sets a token when invoking the GetClientsetE method.

type GetClientsetOptionsE

type GetClientsetOptionsE struct {
	// The method used to get the clientset object. Generally this should only be specified in the context of tests.
	NewForConfig func(*rest.Config) (*k8s.Clientset, error)
	// The input object passed to the NewForConfig method when generating the clientset.
	RESTConfig rest.Config
}

GetClientsetOptionsE is used for passing functional options to the GetEKSClientset method.

type JobClient

type JobClient interface {
	Create(context.Context, *apiv1.Job, metav1.CreateOptions) (*apiv1.Job, error)
	Get(context.Context, string, metav1.GetOptions) (*apiv1.Job, error)
}

JobClient is an interface that partially implements the [JobInterface object](https://pkg.go.dev/k8s.io/client-go@v0.23.1/kubernetes/typed/batch/v1#JobInterface).

Jump to

Keyboard shortcuts

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