mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
add unchedule information to kubectl describe node
This commit is contained in:
parent
551f73d324
commit
df4586b775
@ -2588,8 +2588,9 @@ func describeNode(node *api.Node, nodeNonTerminatedPodsList *api.PodList, events
|
|||||||
}
|
}
|
||||||
printLabelsMultiline(w, "Labels", node.Labels)
|
printLabelsMultiline(w, "Labels", node.Labels)
|
||||||
printAnnotationsMultiline(w, "Annotations", node.Annotations)
|
printAnnotationsMultiline(w, "Annotations", node.Annotations)
|
||||||
printNodeTaintsMultiline(w, "Taints", node.Spec.Taints)
|
|
||||||
w.Write(LEVEL_0, "CreationTimestamp:\t%s\n", node.CreationTimestamp.Time.Format(time.RFC1123Z))
|
w.Write(LEVEL_0, "CreationTimestamp:\t%s\n", node.CreationTimestamp.Time.Format(time.RFC1123Z))
|
||||||
|
printNodeTaintsMultiline(w, "Taints", node.Spec.Taints)
|
||||||
|
w.Write(LEVEL_0, "Unschedulable:\t%v\n", node.Spec.Unschedulable)
|
||||||
if len(node.Status.Conditions) > 0 {
|
if len(node.Status.Conditions) > 0 {
|
||||||
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\tLastHeartbeatTime\tLastTransitionTime\tReason\tMessage\n")
|
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\tLastHeartbeatTime\tLastTransitionTime\tReason\tMessage\n")
|
||||||
w.Write(LEVEL_1, "----\t------\t-----------------\t------------------\t------\t-------\n")
|
w.Write(LEVEL_1, "----\t------\t-----------------\t------------------\t------\t-------\n")
|
||||||
|
@ -2108,6 +2108,32 @@ Events: <none>` + "\n"
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDescribeNode(t *testing.T) {
|
||||||
|
fake := fake.NewSimpleClientset(&api.Node{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "bar",
|
||||||
|
Namespace: "foo",
|
||||||
|
},
|
||||||
|
Spec: api.NodeSpec{
|
||||||
|
Unschedulable: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
c := &describeClient{T: t, Namespace: "foo", Interface: fake}
|
||||||
|
d := NodeDescriber{c}
|
||||||
|
out, err := d.Describe("foo", "bar", printers.DescriberSettings{ShowEvents: true})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
expectedOut := []string{"Unschedulable", "true"}
|
||||||
|
for _, expected := range expectedOut {
|
||||||
|
if !strings.Contains(out, expected) {
|
||||||
|
t.Errorf("expected to find %q in output: %q", expected, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// boolPtr returns a pointer to a bool
|
// boolPtr returns a pointer to a bool
|
||||||
func boolPtr(b bool) *bool {
|
func boolPtr(b bool) *bool {
|
||||||
o := b
|
o := b
|
||||||
|
Loading…
Reference in New Issue
Block a user