Skip to content

Commit 2f31a4a

Browse files
authored
Merge pull request kubernetes#94939 from tnqn/describe-pod-toleration
kubectl: add a space between effect and operator when printing tolerations
2 parents 56833a6 + 04185f4 commit 2f31a4a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

staging/src/k8s.io/kubectl/pkg/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4841,7 +4841,7 @@ func printTolerationsMultilineWithIndent(w PrefixWriter, initialIndent, title, i
48414841
// - operator: "Exists"
48424842
// is a special case which tolerates everything
48434843
if toleration.Operator == corev1.TolerationOpExists && len(toleration.Value) == 0 {
4844-
if len(toleration.Key) != 0 {
4844+
if len(toleration.Key) != 0 || len(toleration.Effect) != 0 {
48454845
w.Write(LEVEL_0, " op=Exists")
48464846
} else {
48474847
w.Write(LEVEL_0, "op=Exists")

staging/src/k8s.io/kubectl/pkg/describe/describe_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ func TestDescribePodTolerations(t *testing.T) {
180180
Spec: corev1.PodSpec{
181181
Tolerations: []corev1.Toleration{
182182
{Operator: corev1.TolerationOpExists},
183+
{Effect: corev1.TaintEffectNoSchedule, Operator: corev1.TolerationOpExists},
183184
{Key: "key0", Operator: corev1.TolerationOpExists},
184185
{Key: "key1", Value: "value1"},
185186
{Key: "key2", Operator: corev1.TolerationOpEqual, Value: "value2", Effect: corev1.TaintEffectNoSchedule},
@@ -195,6 +196,7 @@ func TestDescribePodTolerations(t *testing.T) {
195196
t.Errorf("unexpected error: %v", err)
196197
}
197198
if !strings.Contains(out, " op=Exists\n") ||
199+
!strings.Contains(out, ":NoSchedule op=Exists\n") ||
198200
!strings.Contains(out, "key0 op=Exists\n") ||
199201
!strings.Contains(out, "key1=value1\n") ||
200202
!strings.Contains(out, "key2=value2:NoSchedule\n") ||

0 commit comments

Comments
 (0)