k8s

package
v0.0.0-...-25adb8f Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 36 Imported by: 4

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 CreateTestJobWithEnv

func CreateTestJobWithEnv(ns string, kubeClient kubernetes.Interface, name string, command []string, env []apiv1.EnvVar) (*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 GetJobsLogs

func GetJobsLogs(ns string, kubeClient kubernetes.Interface, name string, all bool) (string, error)

Returns the logs of the pods related to a given job. If 'all' is true, all runs will be returned; failures to get individual logs will be reported on the output, but not cause the function to fail.

If 'all' is false, only the last run's logs will be returned.

func GetTestImage

func GetTestImage() string

func GetTestImagePullPolicy

func GetTestImagePullPolicy() apiv1.PullPolicy

Allows to control when Skupper test images (quay.io/skupper/skupper-tests) will be pulled. The variable is TEST_IMAGE_PULL_POLICY, and the accepted values are PullIfNotPresent, PullNever and PullAlways (the default, if none set). If an invalid value is provided, it is passed as-is to K8S, which may refuse it.

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
	SecretMounts  []SecretMount
}

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
}

type SecretMount

type SecretMount struct {
	Name      string
	Secret    string
	MountPath string
}

Jump to

Keyboard shortcuts

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