From 29c3b5276f0290d21d43ef45ad0230e45b460b27 Mon Sep 17 00:00:00 2001 From: Taylor Thomas <thomastaylor312@gmail.com> Date: Mon, 9 Oct 2017 18:38:06 -0700 Subject: [PATCH] fix(tiller): Adds CRD ordering This adds CRD ordering into the explicit kind sorter list Closes #2925 --- pkg/tiller/kind_sorter.go | 2 ++ pkg/tiller/kind_sorter_test.go | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 964c01549..f367e65c8 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -36,6 +36,7 @@ var InstallOrder SortOrder = []string{ "PersistentVolume", "PersistentVolumeClaim", "ServiceAccount", + "CustomResourceDefinition", "ClusterRole", "ClusterRoleBinding", "Role", @@ -72,6 +73,7 @@ var UninstallOrder SortOrder = []string{ "Role", "ClusterRoleBinding", "ClusterRole", + "CustomResourceDefinition", "ServiceAccount", "PersistentVolumeClaim", "PersistentVolume", diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index 975db0563..ef7296e89 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -41,6 +41,10 @@ func TestKindSorter(t *testing.T) { Name: "u", Head: &util.SimpleHead{Kind: "CronJob"}, }, + { + Name: "2", + Head: &util.SimpleHead{Kind: "CustomResourceDefinition"}, + }, { Name: "n", Head: &util.SimpleHead{Kind: "DaemonSet"}, @@ -49,10 +53,6 @@ func TestKindSorter(t *testing.T) { Name: "r", Head: &util.SimpleHead{Kind: "Deployment"}, }, - { - Name: "1", - Head: &util.SimpleHead{Kind: "StorageClass"}, - }, { Name: "!", Head: &util.SimpleHead{Kind: "HonkyTonkSet"}, @@ -121,6 +121,10 @@ func TestKindSorter(t *testing.T) { Name: "s", Head: &util.SimpleHead{Kind: "StatefulSet"}, }, + { + Name: "1", + Head: &util.SimpleHead{Kind: "StorageClass"}, + }, { Name: "w", Head: &util.SimpleHead{Kind: "APIService"}, @@ -132,8 +136,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abcde1fghijklmnopqrstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsrqponlkjihgf1edcba!"}, + {"install", InstallOrder, "abcde1fgh2ijklmnopqrstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edcba!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) { -- GitLab