Skip to content

Commit

Permalink
Add priority class to kind sorter
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Dohnal <stepan.dohnal@datamole.cz>
(cherry picked from commit f46eaf2)
  • Loading branch information
stepandohnal authored and joejulian committed Aug 9, 2023
1 parent 1e210a2 commit fb74155
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/releaseutil/kind_sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type KindSortOrder []string
//
// Those occurring earlier in the list get installed before those occurring later in the list.
var InstallOrder KindSortOrder = []string{
"PriorityClass",
"Namespace",
"NetworkPolicy",
"ResourceQuota",
Expand Down Expand Up @@ -105,6 +106,7 @@ var UninstallOrder KindSortOrder = []string{
"ResourceQuota",
"NetworkPolicy",
"Namespace",
"PriorityClass",
}

// sort manifests by kind.
Expand Down
8 changes: 6 additions & 2 deletions pkg/releaseutil/kind_sorter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,19 @@ func TestKindSorter(t *testing.T) {
Name: "x",
Head: &SimpleHead{Kind: "HorizontalPodAutoscaler"},
},
{
Name: "F",
Head: &SimpleHead{Kind: "PriorityClass"},
},
}

for _, test := range []struct {
description string
order KindSortOrder
expected string
}{
{"install", InstallOrder, "aAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvw!"},
{"uninstall", UninstallOrder, "wvUmutsxrqponLlKkJjIi2hg1fEed3CcbAa!"},
{"install", InstallOrder, "FaAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvw!"},
{"uninstall", UninstallOrder, "wvUmutsxrqponLlKkJjIi2hg1fEed3CcbAaF!"},
} {
var buf bytes.Buffer
t.Run(test.description, func(t *testing.T) {
Expand Down

0 comments on commit fb74155

Please sign in to comment.