INNER CODE UNIT · Go
func
airwallex/k8s-pod-restart-info-collector · helpers.go:354
func (o byLastTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
func (o byLastTimestamp) Less(i, j int) bool {
if o[i].LastTimestamp.Equal(&o[j].LastTimestamp) {
return o[i].InvolvedObject.Name < o[j].InvolvedObject.Name
}
return o[i].LastTimestamp.Before(&o[j].LastTimestamp)
}
func getContainerResource(container v1.Container) (string, error) {
return tabbedString(func(out io.Writer) error {
w := describe.NewPrefixWriter(out)
resources := container.Resources
if len(resources.Limits) > 0 {
w.Write(describe.LEVEL_1, "Limits:\n")
}
for _, name := range SortedResourceNames(resources.Limits) {
quantity := resources.Limits[name]