k8s

package
Version: v0.0.0-...-eb8e22c Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 34 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSecretVolume

func AppendSecretVolume(volumes *[]apiv1.Volume, mounts *[]apiv1.VolumeMount, name string, path string)

func AssertJob

func AssertJob(t *testing.T, job *batchv1.Job)

func CreateResourcesFromYAML

func CreateResourcesFromYAML(vanClient *client.VanClient, fileOrUrl string) error

CreateResourcesFromYAML creates all resources from the provided YAML file or URL using an initialized VanClient instance.

func CreateTestJob

func CreateTestJob(ns string, kubeClient kubernetes.Interface, name string, command []string) (*batchv1.Job, error)

func CreateTestJobWithSecret

func CreateTestJobWithSecret(ns string, kubeClient kubernetes.Interface, name string, command []string, secretname string) (*batchv1.Job, error)

func DeleteNamespaceAndWait

func DeleteNamespaceAndWait(kubeClient kubernetes.Interface, name string) error

func Execute

func Execute(kubeClient kubernetes.Interface, config *rest.Config, ns string, pod, container string, command []string) (bytes.Buffer, bytes.Buffer, error)

Execute helps executing commands on a given pod, using the k8s rest api returning stdout, stderr, err This function is nil safe and so stdout and stderr are always returned

func GetJobLogs

func GetJobLogs(ns string, kubeClient kubernetes.Interface, name string) (string, error)

func GetTestImage

func GetTestImage() string

func NewDeployment

func NewDeployment(name, namespace string, opts DeploymentOpts) (*v1.Deployment, error)

func NewJob

func NewJob(name, namespace string, opts JobOpts) *batchv1.Job

func WaitForJob

func WaitForJob(ns string, kubeClient kubernetes.Interface, jobName string, timeout time.Duration) (*batchv1.Job, error)

func WaitForServiceToBeAvailable

func WaitForServiceToBeAvailable(ns string, kubeClient kubernetes.Interface, name string, timeout time.Duration) (service *apiv1.Service, err error)

func WaitForServiceToBeAvailableDefaultTimeout

func WaitForServiceToBeAvailableDefaultTimeout(ns string, kubeClient kubernetes.Interface, name string) (service *apiv1.Service, err error)

func WaitForServiceToBeCreated

func WaitForServiceToBeCreated(ns string, kubeClient kubernetes.Interface, name string, retryFn func() (*apiv1.Service, error), backoff wait.Backoff) (*apiv1.Service, error)

func WaitForServiceToBeCreatedAndReadyToUse

func WaitForServiceToBeCreatedAndReadyToUse(ns string, kubeClient kubernetes.Interface, serviceName string, serviceReadyPeriod time.Duration) (*apiv1.Service, error)

func WaitForSkupperServiceToBeCreatedAndReadyToUse

func WaitForSkupperServiceToBeCreatedAndReadyToUse(ns string, kubeClient kubernetes.Interface, serviceName string) (*apiv1.Service, error)

Types

type DeploymentOpts

type DeploymentOpts struct {
	Image         string
	Labels        map[string]string
	RestartPolicy v12.RestartPolicy
	Command       []string
	Args          []string
	EnvVars       []v12.EnvVar
	ResourceReq   v12.ResourceRequirements
}

type JobOpts

type JobOpts struct {
	Image        string
	BackoffLimit int
	Restart      apiv1.RestartPolicy
	Env          map[string]string
	Labels       map[string]string
	Command      []string
	Args         []string
	ResourceReq  apiv1.ResourceRequirements
}

Jump to

Keyboard shortcuts

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