mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
add description for pod readiness gate
This commit is contained in:
parent
c987e95282
commit
55d88c5d0b
@ -679,6 +679,21 @@ func describePod(pod *api.Pod, events *api.EventList) (string, error) {
|
|||||||
describeContainers("Init Containers", pod.Spec.InitContainers, pod.Status.InitContainerStatuses, EnvValueRetriever(pod), w, "")
|
describeContainers("Init Containers", pod.Spec.InitContainers, pod.Status.InitContainerStatuses, EnvValueRetriever(pod), w, "")
|
||||||
}
|
}
|
||||||
describeContainers("Containers", pod.Spec.Containers, pod.Status.ContainerStatuses, EnvValueRetriever(pod), w, "")
|
describeContainers("Containers", pod.Spec.Containers, pod.Status.ContainerStatuses, EnvValueRetriever(pod), w, "")
|
||||||
|
if len(pod.Spec.ReadinessGates) > 0 {
|
||||||
|
w.Write(LEVEL_0, "Readiness Gates:\n Type\tStatus\n")
|
||||||
|
for _, g := range pod.Spec.ReadinessGates {
|
||||||
|
status := "<none>"
|
||||||
|
for _, c := range pod.Status.Conditions {
|
||||||
|
if c.Type == g.ConditionType {
|
||||||
|
status = fmt.Sprintf("%v", c.Status)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(LEVEL_1, "%v \t%v \n",
|
||||||
|
g.ConditionType,
|
||||||
|
status)
|
||||||
|
}
|
||||||
|
}
|
||||||
if len(pod.Status.Conditions) > 0 {
|
if len(pod.Status.Conditions) > 0 {
|
||||||
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\n")
|
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\n")
|
||||||
for _, c := range pod.Status.Conditions {
|
for _, c := range pod.Status.Conditions {
|
||||||
|
@ -55,6 +55,8 @@ type describeClient struct {
|
|||||||
func TestDescribePod(t *testing.T) {
|
func TestDescribePod(t *testing.T) {
|
||||||
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(10, 0, 0)}
|
deletionTimestamp := metav1.Time{Time: time.Now().UTC().AddDate(10, 0, 0)}
|
||||||
gracePeriod := int64(1234)
|
gracePeriod := int64(1234)
|
||||||
|
condition1 := api.PodConditionType("condition1")
|
||||||
|
condition2 := api.PodConditionType("condition2")
|
||||||
fake := fake.NewSimpleClientset(&api.Pod{
|
fake := fake.NewSimpleClientset(&api.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
@ -62,6 +64,24 @@ func TestDescribePod(t *testing.T) {
|
|||||||
DeletionTimestamp: &deletionTimestamp,
|
DeletionTimestamp: &deletionTimestamp,
|
||||||
DeletionGracePeriodSeconds: &gracePeriod,
|
DeletionGracePeriodSeconds: &gracePeriod,
|
||||||
},
|
},
|
||||||
|
Spec: api.PodSpec{
|
||||||
|
ReadinessGates: []api.PodReadinessGate{
|
||||||
|
{
|
||||||
|
ConditionType: condition1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ConditionType: condition2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Status: api.PodStatus{
|
||||||
|
Conditions: []api.PodCondition{
|
||||||
|
{
|
||||||
|
Type: condition1,
|
||||||
|
Status: api.ConditionTrue,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
c := &describeClient{T: t, Namespace: "foo", Interface: fake}
|
c := &describeClient{T: t, Namespace: "foo", Interface: fake}
|
||||||
d := PodDescriber{c}
|
d := PodDescriber{c}
|
||||||
|
Loading…
Reference in New Issue
Block a user