File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
cmd/kubeadm/app/phases/upgrade Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
98
98
fieldSelector = "spec.unschedulable=false"
99
99
ns = metav1 .NamespaceSystem
100
100
timeout = 15 * time .Second
101
+ timeoutMargin = 5 * time .Second
101
102
)
102
103
var (
103
104
err , lastError error
@@ -132,6 +133,9 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
132
133
return nil
133
134
}
134
135
136
+ // Adding a margin of error to the polling timeout.
137
+ timeoutWithMargin := timeout .Seconds () + timeoutMargin .Seconds ()
138
+
135
139
// Prepare Job
136
140
job := & batchv1.Job {
137
141
ObjectMeta : metav1.ObjectMeta {
@@ -140,7 +144,8 @@ func createJob(client clientset.Interface, cfg *kubeadmapi.ClusterConfiguration)
140
144
},
141
145
Spec : batchv1.JobSpec {
142
146
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 )),
144
149
Template : v1.PodTemplateSpec {
145
150
Spec : v1.PodSpec {
146
151
RestartPolicy : v1 .RestartPolicyNever ,
You can’t perform that action at this time.
0 commit comments