From 07628a2b1a4221d09c72d882762d5ec154bef8ba Mon Sep 17 00:00:00 2001 From: xuzhonghu Date: Mon, 8 Apr 2019 15:14:32 +0800 Subject: [PATCH 1/2] Api definition for exit code error handling --- pkg/apis/batch/v1alpha1/job.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/apis/batch/v1alpha1/job.go b/pkg/apis/batch/v1alpha1/job.go index ec31ea2124..15e0f0fb99 100644 --- a/pkg/apis/batch/v1alpha1/job.go +++ b/pkg/apis/batch/v1alpha1/job.go @@ -147,6 +147,12 @@ type LifecyclePolicy struct { // +optional Event Event `json:"event,omitempty" protobuf:"bytes,2,opt,name=event"` + // The exit code of the pod container, controller will take action + // according to this code. + // Note: only one of `Event` or `ExitCode` can be specified. + // +optional + ExitCode *int32 + // Timeout is the grace period for controller to take actions. // Default to nil (take action immediately). // +optional From 69fc43e5e1fe6ffd3edfaf51f0699939daead4e1 Mon Sep 17 00:00:00 2001 From: xuzhonghu Date: Mon, 8 Apr 2019 15:16:51 +0800 Subject: [PATCH 2/2] gen code --- pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go index 9259944ea4..6b844540fb 100644 --- a/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go @@ -185,6 +185,11 @@ func (in *JobStatus) DeepCopy() *JobStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LifecyclePolicy) DeepCopyInto(out *LifecyclePolicy) { *out = *in + if in.ExitCode != nil { + in, out := &in.ExitCode, &out.ExitCode + *out = new(int32) + **out = **in + } if in.Timeout != nil { in, out := &in.Timeout, &out.Timeout *out = new(v1.Duration)