mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #94939 from tnqn/describe-pod-toleration
kubectl: add a space between effect and operator when printing tolerations
This commit is contained in:
commit
2f31a4ab0d
@ -4841,7 +4841,7 @@ func printTolerationsMultilineWithIndent(w PrefixWriter, initialIndent, title, i
|
|||||||
// - operator: "Exists"
|
// - operator: "Exists"
|
||||||
// is a special case which tolerates everything
|
// is a special case which tolerates everything
|
||||||
if toleration.Operator == corev1.TolerationOpExists && len(toleration.Value) == 0 {
|
if toleration.Operator == corev1.TolerationOpExists && len(toleration.Value) == 0 {
|
||||||
if len(toleration.Key) != 0 {
|
if len(toleration.Key) != 0 || len(toleration.Effect) != 0 {
|
||||||
w.Write(LEVEL_0, " op=Exists")
|
w.Write(LEVEL_0, " op=Exists")
|
||||||
} else {
|
} else {
|
||||||
w.Write(LEVEL_0, "op=Exists")
|
w.Write(LEVEL_0, "op=Exists")
|
||||||
|
@ -180,6 +180,7 @@ func TestDescribePodTolerations(t *testing.T) {
|
|||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Tolerations: []corev1.Toleration{
|
Tolerations: []corev1.Toleration{
|
||||||
{Operator: corev1.TolerationOpExists},
|
{Operator: corev1.TolerationOpExists},
|
||||||
|
{Effect: corev1.TaintEffectNoSchedule, Operator: corev1.TolerationOpExists},
|
||||||
{Key: "key0", Operator: corev1.TolerationOpExists},
|
{Key: "key0", Operator: corev1.TolerationOpExists},
|
||||||
{Key: "key1", Value: "value1"},
|
{Key: "key1", Value: "value1"},
|
||||||
{Key: "key2", Operator: corev1.TolerationOpEqual, Value: "value2", Effect: corev1.TaintEffectNoSchedule},
|
{Key: "key2", Operator: corev1.TolerationOpEqual, Value: "value2", Effect: corev1.TaintEffectNoSchedule},
|
||||||
@ -195,6 +196,7 @@ func TestDescribePodTolerations(t *testing.T) {
|
|||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(out, " op=Exists\n") ||
|
if !strings.Contains(out, " op=Exists\n") ||
|
||||||
|
!strings.Contains(out, ":NoSchedule op=Exists\n") ||
|
||||||
!strings.Contains(out, "key0 op=Exists\n") ||
|
!strings.Contains(out, "key0 op=Exists\n") ||
|
||||||
!strings.Contains(out, "key1=value1\n") ||
|
!strings.Contains(out, "key1=value1\n") ||
|
||||||
!strings.Contains(out, "key2=value2:NoSchedule\n") ||
|
!strings.Contains(out, "key2=value2:NoSchedule\n") ||
|
||||||
|
Loading…
Reference in New Issue
Block a user