Documentation ¶
Index ¶
- Constants
- func GetFirstTerminationMessage(pod *corev1.Pod) string
- func GetJobPod(ctx context.Context, kubeClientset kubernetes.Interface, ...) (*corev1.Pod, error)
- func GetJobPodByJobName(ctx context.Context, kubeClientset kubernetes.Interface, ...) (*corev1.Pod, error)
- func GetOperationsResult(ctx context.Context, pod *corev1.Pod, result interface{}) error
- func IsJobComplete(job *batchv1.Job) bool
- func IsJobFailed(job *batchv1.Job) bool
- func IsJobSucceeded(job *batchv1.Job) bool
- func JobFailedMessage(job *batchv1.Job) string
- func JobLabels(key string, parts ...string) map[string]string
- func MakePodTemplate(image string, UID, action string, secret corev1.SecretKeySelector, ...) *corev1.PodTemplateSpec
- type OpsJobStatus
Constants ¶
const ( ActionExists = "exists" ActionCreate = "create" ActionDelete = "delete" )
Variables ¶
This section is empty.
Functions ¶
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 IsJobComplete ¶
func IsJobFailed ¶
func IsJobSucceeded ¶
func JobFailedMessage ¶
func JobLabels ¶
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" )