Skip to content

Commit

Permalink
Fix ClusterRoleBinding namespace setting on kubectl-minio (#485)
Browse files Browse the repository at this point in the history
Since rbacv1.ClusterRoleBinding.Subjects is not a pointer, we have to
replace the array  instead of modifying the values
  • Loading branch information
cesnietor authored Feb 20, 2021
1 parent bc6d186 commit 9ab6c08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions kubectl-minio/cmd/resources/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@ func LoadConsoleUI(emfs http.FileSystem, decode func(data []byte, defaults *sche
}
case *rbacv1.ClusterRoleBinding:
if resourceObj, ok := obj.(*rbacv1.ClusterRoleBinding); ok {
updatedSubjects := []rbacv1.Subject{}
for _, sub := range resourceObj.Subjects {
sub.Namespace = opts.Namespace
// store modified subject
updatedSubjects = append(updatedSubjects, sub)
}
// update subjects with modified array
resourceObj.Subjects = updatedSubjects
}
default:
// fmt.Println("Unhandled kind:", obj.GetObjectKind())
Expand Down
2 changes: 0 additions & 2 deletions kubectl-minio/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,6 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/minio/cli v1.22.0/go.mod h1:bYxnK0uS629N3Bq+AOZZ+6lwF77Sodk4+UL9vNuXhOY=
github.com/minio/controller-tools v0.4.5/go.mod h1:xES4iNis9dGrLQuP6nquTZZNg2T0/EM8wduC4/GWfZ0=
github.com/minio/controller-tools v0.4.6/go.mod h1:xES4iNis9dGrLQuP6nquTZZNg2T0/EM8wduC4/GWfZ0=
github.com/minio/controller-tools v0.4.7/go.mod h1:xES4iNis9dGrLQuP6nquTZZNg2T0/EM8wduC4/GWfZ0=
github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
Expand Down

0 comments on commit 9ab6c08

Please sign in to comment.