diff --git a/pkg/apis/common/v1/openapi_generated.go b/pkg/apis/common/v1/openapi_generated.go index d0af1676..a0419abb 100644 --- a/pkg/apis/common/v1/openapi_generated.go +++ b/pkg/apis/common/v1/openapi_generated.go @@ -509,6 +509,12 @@ func schema_pkg_apis_common_v1_RunPolicy(ref common.ReferenceCallback) common.Op Format: "", }, }, + "successPolicy": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, "ttlSecondsAfterFinished": { SchemaProps: spec.SchemaProps{ Description: "TTLSecondsAfterFinished is the TTL to clean up jobs. It may take extra ReconcilePeriod seconds for the cleanup, since reconcile gets called periodically. Default to infinite.", diff --git a/pkg/apis/common/v1/types.go b/pkg/apis/common/v1/types.go index e4eb7eb2..f3c4aff5 100644 --- a/pkg/apis/common/v1/types.go +++ b/pkg/apis/common/v1/types.go @@ -178,6 +178,8 @@ type RunPolicy struct { // Default to Running. CleanPodPolicy *CleanPodPolicy `json:"cleanPodPolicy,omitempty"` + SuccessPolicy *SuccessPolicy `json:"successPolicy,omitempty"` + // TTLSecondsAfterFinished is the TTL to clean up jobs. // It may take extra ReconcilePeriod seconds for the cleanup, since // reconcile gets called periodically. @@ -198,6 +200,13 @@ type RunPolicy struct { SchedulingPolicy *SchedulingPolicy `json:"schedulingPolicy,omitempty"` } +type SuccessPolicy string + +const ( + SuccessPolicyDefault SuccessPolicy = "" + SuccessPolicyAllWorkers SuccessPolicy = "AllWorkers" +) + // +k8s:openapi-gen=true // SchedulingPolicy encapsulates various scheduling policies of the distributed training // job, for example `minAvailable` for gang-scheduling. diff --git a/pkg/apis/common/v1/zz_generated.deepcopy.go b/pkg/apis/common/v1/zz_generated.deepcopy.go index d80060be..12b44af5 100644 --- a/pkg/apis/common/v1/zz_generated.deepcopy.go +++ b/pkg/apis/common/v1/zz_generated.deepcopy.go @@ -144,6 +144,11 @@ func (in *RunPolicy) DeepCopyInto(out *RunPolicy) { *out = new(CleanPodPolicy) **out = **in } + if in.SuccessPolicy != nil { + in, out := &in.SuccessPolicy, &out.SuccessPolicy + *out = new(SuccessPolicy) + **out = **in + } if in.TTLSecondsAfterFinished != nil { in, out := &in.TTLSecondsAfterFinished, &out.TTLSecondsAfterFinished *out = new(int32)