Merge pull request #21671 from kargakis/add-exposed-ports-in-pod-desc

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2016-03-02 06:40:28 -08:00
commit cc19c9fdfa
1 changed files with 14 additions and 0 deletions

View File

@ -774,6 +774,12 @@ func DescribeContainers(containers []api.Container, containerStatuses []api.Cont
if ok {
fmt.Fprintf(out, " Image ID:\t%s\n", status.ImageID)
}
portString := describeContainerPorts(container.Ports)
if strings.Contains(portString, ",") {
fmt.Fprintf(out, " Ports:\t%s\n", portString)
} else {
fmt.Fprintf(out, " Port:\t%s\n", portString)
}
if len(container.Command) > 0 {
fmt.Fprintf(out, " Command:\n")
@ -842,6 +848,14 @@ func DescribeContainers(containers []api.Container, containerStatuses []api.Cont
}
}
func describeContainerPorts(cPorts []api.ContainerPort) string {
ports := []string{}
for _, cPort := range cPorts {
ports = append(ports, fmt.Sprintf("%d/%s", cPort.ContainerPort, cPort.Protocol))
}
return strings.Join(ports, ", ")
}
// DescribeProbe is exported for consumers in other API groups that have probes
func DescribeProbe(probe *api.Probe) string {
attrs := fmt.Sprintf("delay=%ds timeout=%ds period=%ds #success=%d #failure=%d", probe.InitialDelaySeconds, probe.TimeoutSeconds, probe.PeriodSeconds, probe.SuccessThreshold, probe.FailureThreshold)