mirror of https://github.com/k3s-io/k3s
parent
f12db38d5c
commit
a5bf3d5424
|
@ -917,14 +917,16 @@ func describeContainers(label string, containers []api.Container, containerStatu
|
||||||
status, ok := statuses[container.Name]
|
status, ok := statuses[container.Name]
|
||||||
describeContainerBasicInfo(container, status, ok, space, w)
|
describeContainerBasicInfo(container, status, ok, space, w)
|
||||||
describeContainerCommand(container, w)
|
describeContainerCommand(container, w)
|
||||||
describeContainerResource(container, w)
|
|
||||||
if ok {
|
if ok {
|
||||||
describeContainerState(status, w)
|
describeContainerState(status, w)
|
||||||
}
|
}
|
||||||
|
describeContainerResource(container, w)
|
||||||
describeContainerProbe(container, w)
|
describeContainerProbe(container, w)
|
||||||
describeContainerVolumes(container, w)
|
if len(container.EnvFrom) > 0 {
|
||||||
describeContainerEnvFrom(container, resolverFn, w)
|
describeContainerEnvFrom(container, resolverFn, w)
|
||||||
|
}
|
||||||
describeContainerEnvVars(container, resolverFn, w)
|
describeContainerEnvVars(container, resolverFn, w)
|
||||||
|
describeContainerVolumes(container, w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2373,6 +2375,10 @@ func (dd *DeploymentDescriber) Describe(namespace, name string, describerSetting
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
internalDeployment := &extensions.Deployment{}
|
||||||
|
if err := api.Scheme.Convert(d, internalDeployment, extensions.SchemeGroupVersion); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
return tabbedString(func(out io.Writer) error {
|
return tabbedString(func(out io.Writer) error {
|
||||||
w := &PrefixWriter{out}
|
w := &PrefixWriter{out}
|
||||||
w.Write(LEVEL_0, "Name:\t%s\n", d.ObjectMeta.Name)
|
w.Write(LEVEL_0, "Name:\t%s\n", d.ObjectMeta.Name)
|
||||||
|
@ -2388,6 +2394,10 @@ func (dd *DeploymentDescriber) Describe(namespace, name string, describerSetting
|
||||||
ru := d.Spec.Strategy.RollingUpdate
|
ru := d.Spec.Strategy.RollingUpdate
|
||||||
w.Write(LEVEL_0, "RollingUpdateStrategy:\t%s max unavailable, %s max surge\n", ru.MaxUnavailable.String(), ru.MaxSurge.String())
|
w.Write(LEVEL_0, "RollingUpdateStrategy:\t%s max unavailable, %s max surge\n", ru.MaxUnavailable.String(), ru.MaxSurge.String())
|
||||||
}
|
}
|
||||||
|
if len(internalDeployment.Spec.Template.Spec.InitContainers) > 0 {
|
||||||
|
describeContainers("Init Containers", internalDeployment.Spec.Template.Spec.InitContainers, nil, nil, w, "")
|
||||||
|
}
|
||||||
|
describeContainers("Containers", internalDeployment.Spec.Template.Spec.Containers, nil, nil, w, "")
|
||||||
if len(d.Status.Conditions) > 0 {
|
if len(d.Status.Conditions) > 0 {
|
||||||
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\tReason\n")
|
w.Write(LEVEL_0, "Conditions:\n Type\tStatus\tReason\n")
|
||||||
w.Write(LEVEL_1, "----\t------\t------\n")
|
w.Write(LEVEL_1, "----\t------\t------\n")
|
||||||
|
|
|
@ -670,7 +670,13 @@ func TestDescribeDeployment(t *testing.T) {
|
||||||
Spec: v1beta1.DeploymentSpec{
|
Spec: v1beta1.DeploymentSpec{
|
||||||
Replicas: util.Int32Ptr(1),
|
Replicas: util.Int32Ptr(1),
|
||||||
Selector: &metav1.LabelSelector{},
|
Selector: &metav1.LabelSelector{},
|
||||||
Template: v1.PodTemplateSpec{},
|
Template: v1.PodTemplateSpec{
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
Containers: []v1.Container{
|
||||||
|
{Image: "mytest-image:latest"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
d := DeploymentDescriber{fake, versionedFake}
|
d := DeploymentDescriber{fake, versionedFake}
|
||||||
|
@ -678,7 +684,7 @@ func TestDescribeDeployment(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") {
|
if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "Containers:") || !strings.Contains(out, "mytest-image:latest") {
|
||||||
t.Errorf("unexpected out: %s", out)
|
t.Errorf("unexpected out: %s", out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue