Skip to content

Commit 19e8e59

Browse files
authored
Merge pull request kubernetes#127333 from yuyabee/add-activeDeadlineSeconds-to-upgrade-health-check-job
Add activeDeadlineSeconds to kubeadm upgrade-health-check job
2 parents 8d402c9 + db66416 commit 19e8e59

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/kubeadm/app/phases/upgrade/health.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
9898
fieldSelector = "spec.unschedulable=false"
9999
ns = metav1.NamespaceSystem
100100
timeout = 15 * time.Second
101+
timeoutMargin = 5 * time.Second
101102
)
102103
var (
103104
err, lastError error
@@ -132,6 +133,9 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
132133
return nil
133134
}
134135

136+
// Adding a margin of error to the polling timeout.
137+
timeoutWithMargin := timeout.Seconds() + timeoutMargin.Seconds()
138+
135139
// Prepare Job
136140
job := &batchv1.Job{
137141
ObjectMeta: metav1.ObjectMeta{
@@ -140,7 +144,8 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
140144
},
141145
Spec: batchv1.JobSpec{
142146
BackoffLimit: ptr.To[int32](0),
143-
TTLSecondsAfterFinished: ptr.To[int32](int32(timeout.Seconds()) + 5), // Make sure it's more than 'timeout'.
147+
TTLSecondsAfterFinished: ptr.To[int32](int32(timeoutWithMargin)),
148+
ActiveDeadlineSeconds: ptr.To[int64](int64(timeoutWithMargin)),
144149
Template: v1.PodTemplateSpec{
145150
Spec: v1.PodSpec{
146151
RestartPolicy: v1.RestartPolicyNever,

0 commit comments

Comments
 (0)