Skip to content

Commit

Permalink
update clusterroles and clusterrolebindings to v1 (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh-11 authored Aug 5, 2022
1 parent 35fe9a5 commit d7e3c5d
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: machine-controller-manager-control
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/deployment/in-tree/control-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: machine-controller-manager-control
Expand Down Expand Up @@ -53,6 +53,7 @@ rules:
- leases
resourceNames:
- machine-controller-manager
- machine-controller
verbs:
- get
- watch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: machine-controller-manager-target
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/deployment/in-tree/target-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: machine-controller-manager-target
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: machine-controller-manager-control
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/deployment/out-of-tree/control-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: machine-controller-manager-control
Expand Down Expand Up @@ -58,6 +58,7 @@ rules:
- leases
resourceNames:
- machine-controller-manager
- machine-controller
verbs:
- get
- watch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: machine-controller-manager-target
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/deployment/out-of-tree/target-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: machine-controller-manager-target
Expand Down
14 changes: 7 additions & 7 deletions pkg/test/integration/common/helpers/handling_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
mcmscheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
v1 "k8s.io/api/apps/v1"
rbacv1bata1 "k8s.io/api/rbac/v1beta1"
rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextensionsscheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -150,20 +150,20 @@ func (c *Cluster) applyFile(filePath string, namespace string) error {
return err
}
case "ClusterRoleBinding":
resource := obj.(*rbacv1bata1.ClusterRoleBinding)
resource := obj.(*rbacv1.ClusterRoleBinding)
for i := range resource.Subjects {
resource.Subjects[i].Namespace = namespace
}

if _, err := c.Clientset.RbacV1beta1().
if _, err := c.Clientset.RbacV1().
ClusterRoleBindings().
Create(ctx, resource, metav1.CreateOptions{}); err != nil {
return err
}
case "ClusterRole":
resource := obj.(*rbacv1bata1.ClusterRole)
resource := obj.(*rbacv1.ClusterRole)

if _, err := c.Clientset.RbacV1beta1().
if _, err := c.Clientset.RbacV1().
ClusterRoles().
Create(ctx, resource, metav1.CreateOptions{}); err != nil {
return err
Expand Down Expand Up @@ -306,7 +306,7 @@ func (c *Cluster) deleteResource(filePath string, namespace string) error {
return err
}
case "ClusterRoleBinding":
resource := obj.(*rbacv1bata1.ClusterRoleBinding)
resource := obj.(*rbacv1.ClusterRoleBinding)
for i := range resource.Subjects {
resource.Subjects[i].Namespace = namespace
}
Expand All @@ -320,7 +320,7 @@ func (c *Cluster) deleteResource(filePath string, namespace string) error {
return err
}
case "ClusterRole":
resource := obj.(*rbacv1bata1.ClusterRole)
resource := obj.(*rbacv1.ClusterRole)
if err := c.Clientset.RbacV1beta1().
ClusterRoles().
Delete(
Expand Down

0 comments on commit d7e3c5d

Please sign in to comment.