From 147c8217c7843b53e98528f6df12890d64c696be Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 12 Oct 2018 13:49:45 -0600 Subject: [PATCH] fix(tiller): correctly sort PodDisruptionBudget objects before pods that might use them (#4769) Signed-off-by: Matt Tucker --- pkg/tiller/kind_sorter.go | 2 ++ pkg/tiller/kind_sorter_test.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 65e3f478d..8aff4e6c1 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -31,6 +31,7 @@ var InstallOrder SortOrder = []string{ "ResourceQuota", "LimitRange", "PodSecurityPolicy", + "PodDisruptionBudget", "Secret", "ConfigMap", "StorageClass", @@ -81,6 +82,7 @@ var UninstallOrder SortOrder = []string{ "StorageClass", "ConfigMap", "Secret", + "PodDisruptionBudget", "PodSecurityPolicy", "LimitRange", "ResourceQuota", diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index fb3e8ad57..1c187e90d 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -133,6 +133,10 @@ func TestKindSorter(t *testing.T) { Name: "w", Head: &util.SimpleHead{Kind: "APIService"}, }, + { + Name: "z", + Head: &util.SimpleHead{Kind: "PodDisruptionBudget"}, + }, } for _, test := range []struct { @@ -140,8 +144,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abc3de1fgh2ijklmnopqrstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1ed3cba!"}, + {"install", InstallOrder, "abc3zde1fgh2ijklmnopqrstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edz3cba!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) {