mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Describe container volume mounts
This commit is contained in:
parent
2baf9b0f27
commit
7ba1e59d84
@ -887,7 +887,28 @@ func describeContainers(label string, containers []api.Container, containerStatu
|
|||||||
probe := DescribeProbe(container.ReadinessProbe)
|
probe := DescribeProbe(container.ReadinessProbe)
|
||||||
fmt.Fprintf(out, " Readiness:\t%s\n", probe)
|
fmt.Fprintf(out, " Readiness:\t%s\n", probe)
|
||||||
}
|
}
|
||||||
|
|
||||||
none := ""
|
none := ""
|
||||||
|
if len(container.VolumeMounts) == 0 {
|
||||||
|
none = "\t<none>"
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(out, " Volume Mounts:%s\n", none)
|
||||||
|
sort.Sort(SortableVolumeMounts(container.VolumeMounts))
|
||||||
|
for _, mount := range container.VolumeMounts {
|
||||||
|
flags := []string{}
|
||||||
|
switch {
|
||||||
|
case mount.ReadOnly:
|
||||||
|
flags = append(flags, "ro")
|
||||||
|
case !mount.ReadOnly:
|
||||||
|
flags = append(flags, "rw")
|
||||||
|
case len(mount.SubPath) > 0:
|
||||||
|
flags = append(flags, fmt.Sprintf("path=%q", mount.SubPath))
|
||||||
|
}
|
||||||
|
fmt.Fprintf(out, " %s from %s (%s)\n", mount.MountPath, mount.Name, strings.Join(flags, ","))
|
||||||
|
}
|
||||||
|
|
||||||
|
none = ""
|
||||||
if len(container.Env) == 0 {
|
if len(container.Env) == 0 {
|
||||||
none = "\t<none>"
|
none = "\t<none>"
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,20 @@ func (list SortableResourceQuotas) Less(i, j int) bool {
|
|||||||
return list[i].Name < list[j].Name
|
return list[i].Name < list[j].Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SortableVolumeMounts []api.VolumeMount
|
||||||
|
|
||||||
|
func (list SortableVolumeMounts) Len() int {
|
||||||
|
return len(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (list SortableVolumeMounts) Swap(i, j int) {
|
||||||
|
list[i], list[j] = list[j], list[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (list SortableVolumeMounts) Less(i, j int) bool {
|
||||||
|
return list[i].MountPath < list[j].MountPath
|
||||||
|
}
|
||||||
|
|
||||||
// SortedQoSResourceNames returns the sorted resource names of a QoS list.
|
// SortedQoSResourceNames returns the sorted resource names of a QoS list.
|
||||||
func SortedQoSResourceNames(list qos.QoSList) []api.ResourceName {
|
func SortedQoSResourceNames(list qos.QoSList) []api.ResourceName {
|
||||||
resources := make([]api.ResourceName, 0, len(list))
|
resources := make([]api.ResourceName, 0, len(list))
|
||||||
|
Loading…
Reference in New Issue
Block a user