Skip to content

Commit

Permalink
Merge pull request kubernetes#127347 from yuyabee/automated-cherry-pi…
Browse files Browse the repository at this point in the history
…ck-of-#127333-upstream-release-1.31

Automated cherry pick of kubernetes#127333: Add activeDeadlineSeconds to kubeadm upgrade-health-check job
  • Loading branch information
k8s-ci-robot authored Sep 24, 2024
2 parents e3be752 + ebc460e commit c75e833
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/kubeadm/app/phases/upgrade/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
fieldSelector = "spec.unschedulable=false"
ns = metav1.NamespaceSystem
timeout = 15 * time.Second
timeoutMargin = 5 * time.Second
)
var (
err, lastError error
Expand Down Expand Up @@ -132,6 +133,9 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
return nil
}

// Adding a margin of error to the polling timeout.
timeoutWithMargin := timeout.Seconds() + timeoutMargin.Seconds()

// Prepare Job
job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -140,7 +144,8 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
},
Spec: batchv1.JobSpec{
BackoffLimit: ptr.To[int32](0),
TTLSecondsAfterFinished: ptr.To[int32](int32(timeout.Seconds()) + 5), // Make sure it's more than 'timeout'.
TTLSecondsAfterFinished: ptr.To[int32](int32(timeoutWithMargin)),
ActiveDeadlineSeconds: ptr.To[int64](int64(timeoutWithMargin)),
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
RestartPolicy: v1.RestartPolicyNever,
Expand Down

0 comments on commit c75e833

Please sign in to comment.