Commit 320e853b authored by Seb Ospina's avatar Seb Ospina

Added List mode for Role, ClusterRole and Bindings

Kubernetes supports RoleList, RoleBindingList, ClusterRoleList and
ClusterRoleBindingList, in order for a Role to be bound, it must
already exist.
For the List reference, see: https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/rbac/types.goSigned-off-by: 's avatarSeb Ospina <kraige@gmail.com>
parent 55193089
......@@ -40,9 +40,13 @@ var InstallOrder SortOrder = []string{
"ServiceAccount",
"CustomResourceDefinition",
"ClusterRole",
"ClusterRoleList",
"ClusterRoleBinding",
"ClusterRoleBindingList",
"Role",
"RoleList",
"RoleBinding",
"RoleBindingList",
"Service",
"DaemonSet",
"Pod",
......@@ -71,9 +75,13 @@ var UninstallOrder SortOrder = []string{
"ReplicationController",
"Pod",
"DaemonSet",
"RoleBindingList",
"RoleBinding",
"RoleList",
"Role",
"ClusterRoleBindingList",
"ClusterRoleBinding",
"ClusterRoleList",
"ClusterRole",
"CustomResourceDefinition",
"ServiceAccount",
......
......@@ -29,10 +29,18 @@ func TestKindSorter(t *testing.T) {
Name: "i",
Head: &util.SimpleHead{Kind: "ClusterRole"},
},
{
Name: "I",
Head: &util.SimpleHead{Kind: "ClusterRoleList"},
},
{
Name: "j",
Head: &util.SimpleHead{Kind: "ClusterRoleBinding"},
},
{
Name: "J",
Head: &util.SimpleHead{Kind: "ClusterRoleBindingList"},
},
{
Name: "e",
Head: &util.SimpleHead{Kind: "ConfigMap"},
......@@ -105,10 +113,18 @@ func TestKindSorter(t *testing.T) {
Name: "k",
Head: &util.SimpleHead{Kind: "Role"},
},
{
Name: "K",
Head: &util.SimpleHead{Kind: "RoleList"},
},
{
Name: "l",
Head: &util.SimpleHead{Kind: "RoleBinding"},
},
{
Name: "L",
Head: &util.SimpleHead{Kind: "RoleBindingList"},
},
{
Name: "d",
Head: &util.SimpleHead{Kind: "Secret"},
......@@ -144,8 +160,8 @@ func TestKindSorter(t *testing.T) {
order SortOrder
expected string
}{
{"install", InstallOrder, "abc3zde1fgh2ijklmnopqrstuvw!"},
{"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edz3cba!"},
{"install", InstallOrder, "abc3zde1fgh2iIjJkKlLmnopqrstuvw!"},
{"uninstall", UninstallOrder, "wvmutsrqponLlKkJjIi2hgf1edz3cba!"},
} {
var buf bytes.Buffer
t.Run(test.description, func(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment