Commit c179f38f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42162 from kevin-wangzefeng/kubectl-tolerationseconds

Automatic merge from submit-queue fix kubectl describe pod, show tolerationSeconds **What this PR does / why we need it**: tolerationSeconds is now not shown in kubectl describe resutl, this PR is to fix it. With this fix, pod toleration with tolerationSeconds would like below: ```yaml Name: bar Namespace: foo Node: / Labels: <none> Status: IP: Controllers: <none> Containers: <none> No volumes. QoS Class: Node-Selectors: <none> Tolerations: key1=value1 key2=value2:NoSchedule key3=value3:NoExecute for 300s ``` **Which issue this PR fixes** : Related issue: #1574 Related PR: #39469 **Special notes for your reviewer**: **Release note**: ```release-note make kubectl describe pod show tolerationSeconds ```
parents cda109d2 49072c81
......@@ -2917,6 +2917,9 @@ func printTolerationsMultilineWithIndent(w *PrefixWriter, initialIndent, title,
if len(toleration.Effect) != 0 {
w.Write(LEVEL_0, ":%s", toleration.Effect)
}
if toleration.TolerationSeconds != nil {
w.Write(LEVEL_0, " for %ds", *toleration.TolerationSeconds)
}
w.Write(LEVEL_0, "\n")
i++
}
......
......@@ -78,7 +78,7 @@ func TestDescribePodTolerations(t *testing.T) {
Spec: api.PodSpec{
Tolerations: []api.Toleration{
{Key: "key1", Value: "value1"},
{Key: "key2", Value: "value2"},
{Key: "key2", Value: "value2", Effect: api.TaintEffectNoExecute, TolerationSeconds: &[]int64{300}[0]},
},
},
})
......@@ -88,7 +88,7 @@ func TestDescribePodTolerations(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !strings.Contains(out, "key1=value1") || !strings.Contains(out, "key2=value2") || !strings.Contains(out, "Tolerations:") {
if !strings.Contains(out, "key1=value1") || !strings.Contains(out, "key2=value2:NoExecute for 300s") || !strings.Contains(out, "Tolerations:") {
t.Errorf("unexpected out: %s", out)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment