From 9836a38b34be362bfd0a538ed71e01893017197e Mon Sep 17 00:00:00 2001 From: Shubham Urkade Date: Tue, 20 Dec 2022 12:50:29 +0530 Subject: [PATCH] Make OnFailure as default restartPolicy for broadcastjob Signed-off-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.