add fallback for GVK comparison

only return comparison of 'Kind' indices if they do not match
otherwise fall back to GVK string comparison
this reduces output instability
This commit is contained in:
Andrew Lavery
2018-11-01 12:22:21 -07:00
parent d718fe3ee1
commit 9d82d54c5b
2 changed files with 16 additions and 1 deletions

View File

@@ -97,7 +97,9 @@ func (x Gvk) IsLessThan(o Gvk) bool {
indexI, foundI := typeOrders[x.Kind]
indexJ, foundJ := typeOrders[o.Kind]
if foundI && foundJ {
return indexI < indexJ
if indexI != indexJ {
return indexI < indexJ
}
}
if foundI && !foundJ {
return true