From cd95dd3ac1b7fc8bc0d87838a397fdb72d9bdfd5 Mon Sep 17 00:00:00 2001 From: Shubham Urkade Date: Wed, 22 Mar 2023 17:49:35 +0530 Subject: [PATCH] Make OnFailure as default restartPolicy for broadcastjob (#1149) Signed-off-by: Shubham Urkade Co-authored-by: Shubham Urkade --- apis/apps/defaults/v1alpha1.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apis/apps/defaults/v1alpha1.go b/apis/apps/defaults/v1alpha1.go index d8fd6d7db5..5b81d265fd 100644 --- a/apis/apps/defaults/v1alpha1.go +++ b/apis/apps/defaults/v1alpha1.go @@ -192,6 +192,11 @@ func SetDefaultsBroadcastJob(obj *v1alpha1.BroadcastJob, injectTemplateDefaults if obj.Spec.FailurePolicy.Type == "" { obj.Spec.FailurePolicy.Type = v1alpha1.FailurePolicyTypeFailFast } + + // Default to 'OnFailure' if no restartPolicy is specified + if obj.Spec.Template.Spec.RestartPolicy == "" { + obj.Spec.Template.Spec.RestartPolicy = corev1.RestartPolicyOnFailure + } } // SetDefaults_UnitedDeployment set default values for UnitedDeployment.