Fix apiversion slash

This commit is contained in:
jregan
2020-12-17 07:56:27 -08:00
parent 0aa250c6e2
commit bd27d5f8bb
7 changed files with 163 additions and 33 deletions

View File

@@ -80,6 +80,14 @@ func (x Gvk) String() string {
return strings.Join([]string{g, v, k}, fieldSep)
}
// ApiVersion returns the combination of Group and Version
func (x Gvk) ApiVersion() string {
if x.Group == "" {
return x.Version
}
return x.Group + "/" + x.Version
}
// StringWoEmptyField returns a string representation of the GVK. Non-exist
// fields will be omitted.
func (x Gvk) StringWoEmptyField() string {