operations

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionExists = "exists"
	ActionCreate = "create"
	ActionDelete = "delete"
)

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 added in v0.9.0

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 added in v0.9.0

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

func JobLabels

func JobLabels(key string, parts ...string) map[string]string

JobLabels creates a label to find a job again. keys is recommended to be (name, kind, action)

func MakePodTemplate

func MakePodTemplate(image string, UID, action string, secret corev1.SecretKeySelector, extEnv ...corev1.EnvVar) *corev1.PodTemplateSpec

MakePodTemplate creates a pod template for a Job.

Types

type OpsJobStatus

type OpsJobStatus string
const (
	OpsJobGetFailed          OpsJobStatus = "JOB_GET_FAILED"
	OpsJobCreated            OpsJobStatus = "JOB_CREATED"
	OpsJobCreateFailed       OpsJobStatus = "JOB_CREATE_FAILED"
	OpsJobCompleteSuccessful OpsJobStatus = "JOB_SUCCESSFUL"
	OpsJobCompleteFailed     OpsJobStatus = "JOB_FAILED"
	OpsJobOngoing            OpsJobStatus = "JOB_ONGOING"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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