lifecycle

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstTerminationMessage

func GetFirstTerminationMessage(pod *corev1.Pod) string

func GetJobPod

func GetJobPod(ctx context.Context, kubeClientset kubernetes.Interface, namespace, uid, operation string) (*corev1.Pod, error)

GetJobProd will find the Pod that belongs to the resource that created it. Uses label ""controller-uid as the label selector. So, your job should tag the job with that label as the UID of the resource that's needing it. For example, if you create a storage object that requires us to create a notification for it, the controller should set the label on the Job responsible for creating the Notification for it with the label "controller-uid" set to the uid of the storage CR.

func GetJobPodByJobName

func GetJobPodByJobName(ctx context.Context, kubeClientset kubernetes.Interface, namespace, jobName string) (*corev1.Pod, error)

GetJobPodByJobName will find the Pods that belong to that job. Each pod for a given job will have label called: "job-name" set to the job that it belongs to, so just filter by that.

func GetOperationsResult

func GetOperationsResult(ctx context.Context, pod *corev1.Pod, result interface{}) error

func IsJobComplete

func IsJobComplete(job *batchv1.Job) bool

func IsJobFailed

func IsJobFailed(job *batchv1.Job) bool

func IsJobSucceeded

func IsJobSucceeded(job *batchv1.Job) bool

func JobFailedMessage

func JobFailedMessage(job *batchv1.Job) string

Types

type Client

type Client struct {
	Kube      *kntest.KubeClient
	Dynamic   dynamic.Interface
	Namespace string
	// contains filtered or unexported fields
}

Client holds instances of interfaces for making requests to Kubernetes.

func NewClient

func NewClient(configPath string, clusterName string, namespace string) (*Client, error)

NewClient instantiates and returns clientsets required for making request to the cluster specified by the combination of clusterName and configPath.

func (*Client) CreateNamespaceIfNeeded

func (c *Client) CreateNamespaceIfNeeded() error

CreateNamespaceIfNeeded creates a new namespace if it does not exist.

func (*Client) DeleteNamespaceIfNeeded

func (c *Client) DeleteNamespaceIfNeeded() error

func (*Client) DuplicateSecret

func (c *Client) DuplicateSecret(t *testing.T, name, namespace string)

DuplicateSecret duplicates a secret from a namespace to a new namespace.

func (*Client) LogsFor

func (c *Client) LogsFor(namespace, name string, gvr schema.GroupVersionResource) (string, error)

func (*Client) WaitForResourceReady

func (c *Client) WaitForResourceReady(namespace, name string, gvr schema.GroupVersionResource, timeout time.Duration) error

WaitForResourceReady waits until the specified resource in the given namespace are ready.

func (*Client) WaitUntilJobDone

func (c *Client) WaitUntilJobDone(namespace, name string, timeout time.Duration) (string, error)

WaitForResourceReady waits until the specified resource in the given namespace are ready.

Jump to

Keyboard shortcuts

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