mirror of https://github.com/k3s-io/k3s
Merge pull request #21671 from kargakis/add-exposed-ports-in-pod-desc
Auto commit by PR queue botpull/6/head
commit
cc19c9fdfa
|
@ -774,6 +774,12 @@ func DescribeContainers(containers []api.Container, containerStatuses []api.Cont
|
||||||
if ok {
|
if ok {
|
||||||
fmt.Fprintf(out, " Image ID:\t%s\n", status.ImageID)
|
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 {
|
if len(container.Command) > 0 {
|
||||||
fmt.Fprintf(out, " Command:\n")
|
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
|
// DescribeProbe is exported for consumers in other API groups that have probes
|
||||||
func DescribeProbe(probe *api.Probe) string {
|
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)
|
attrs := fmt.Sprintf("delay=%ds timeout=%ds period=%ds #success=%d #failure=%d", probe.InitialDelaySeconds, probe.TimeoutSeconds, probe.PeriodSeconds, probe.SuccessThreshold, probe.FailureThreshold)
|
||||||
|
|
Loading…
Reference in New Issue