20 lines
443 B
Go
20 lines
443 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
)
|
|
|
|
func FormatResourceList(resources v1.ResourceList) string {
|
|
resourceStrings := make([]string, 0, len(resources))
|
|
for key, value := range resources {
|
|
resourceStrings = append(resourceStrings, fmt.Sprintf("%v=%v", key, value.String()))
|
|
}
|
|
// sort the results for consistent log output
|
|
sort.Strings(resourceStrings)
|
|
return strings.Join(resourceStrings, ",")
|
|
}
|