From 6619697970470daaf7050f678440fc3891129f92 Mon Sep 17 00:00:00 2001 From: Patrick Hemmer Date: Thu, 8 Mar 2018 23:16:29 -0500 Subject: [PATCH] fix manifest sorting with Namespace & Unknown --- pkg/tiller/kind_sorter.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index f367e65c8..94512c724 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -120,6 +120,13 @@ func (k *kindSorter) Less(i, j int) bool { b := k.manifests[j] first, aok := k.ordering[a.Head.Kind] second, bok := k.ordering[b.Head.Kind] + // unknown kind is last + if aok && !bok { + return true + } + if bok && !aok { + return false + } // if same kind (including unknown) sub sort alphanumeric if first == second { // if both are unknown and of different kind sort by kind alphabetically @@ -128,13 +135,6 @@ func (k *kindSorter) Less(i, j int) bool { } return a.Name < b.Name } - // unknown kind is last - if !aok { - return false - } - if !bok { - return true - } // sort different kinds return first < second }