mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
print priority and priorityClassName when describe pod
This commit is contained in:
parent
2ea306a854
commit
8808d505d6
@ -624,6 +624,10 @@ func describePod(pod *api.Pod, events *api.EventList) (string, error) {
|
||||
w := NewPrefixWriter(out)
|
||||
w.Write(LEVEL_0, "Name:\t%s\n", pod.Name)
|
||||
w.Write(LEVEL_0, "Namespace:\t%s\n", pod.Namespace)
|
||||
if pod.Spec.Priority != nil {
|
||||
w.Write(LEVEL_0, "Priority:\t%d\n", *pod.Spec.Priority)
|
||||
w.Write(LEVEL_0, "PriorityClassName:\t%s\n", stringOrNone(pod.Spec.PriorityClassName))
|
||||
}
|
||||
if pod.Spec.NodeName == "" {
|
||||
w.Write(LEVEL_0, "Node:\t<none>\n")
|
||||
} else {
|
||||
|
@ -144,6 +144,28 @@ func TestDescribeNamespace(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribePodPriority(t *testing.T) {
|
||||
priority := int32(1000)
|
||||
fake := fake.NewSimpleClientset(&api.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "bar",
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
PriorityClassName: "high-priority",
|
||||
Priority: &priority,
|
||||
},
|
||||
})
|
||||
c := &describeClient{T: t, Namespace: "", Interface: fake}
|
||||
d := PodDescriber{c}
|
||||
out, err := d.Describe("", "bar", printers.DescriberSettings{ShowEvents: true})
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if !strings.Contains(out, "high-priority") || !strings.Contains(out, "1000") {
|
||||
t.Errorf("unexpected out: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribeConfigMap(t *testing.T) {
|
||||
fake := fake.NewSimpleClientset(&api.ConfigMap{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
Loading…
Reference in New Issue
Block a user