@@ -26,7 +26,6 @@ import (
26
26
v1 "k8s.io/api/core/v1"
27
27
rbacv1 "k8s.io/api/rbac/v1"
28
28
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29
- "k8s.io/apimachinery/pkg/util/uuid"
30
29
"k8s.io/apiserver/pkg/authentication/serviceaccount"
31
30
"k8s.io/kubernetes/pkg/cluster/ports"
32
31
"k8s.io/kubernetes/pkg/features"
@@ -60,7 +59,7 @@ var _ = SIGDescribe(framework.WithFeatureGate(features.KubeletFineGrainedAuthz),
60
59
func runKubeletAuthzTest (ctx context.Context , f * framework.Framework , endpoint , authzSubresource string ) string {
61
60
ns := f .Namespace .Name
62
61
saName := authzSubresource
63
- crName := authzSubresource + string ( uuid . NewUUID ())
62
+ crName := authzSubresource
64
63
verb := "get"
65
64
resource := "nodes"
66
65
@@ -74,11 +73,11 @@ func runKubeletAuthzTest(ctx context.Context, f *framework.Framework, endpoint,
74
73
}, metav1.CreateOptions {})
75
74
framework .ExpectNoError (err )
76
75
77
- ginkgo .By (fmt .Sprintf ("Creating ClusterRole %s with for %s/%s" , crName , resource , authzSubresource ))
76
+ ginkgo .By (fmt .Sprintf ("Creating ClusterRole with suffix %s with for %s/%s" , crName , resource , authzSubresource ))
78
77
79
- _ , err = f .ClientSet .RbacV1 ().ClusterRoles ().Create (ctx , & rbacv1.ClusterRole {
78
+ clusterRole , err : = f .ClientSet .RbacV1 ().ClusterRoles ().Create (ctx , & rbacv1.ClusterRole {
80
79
ObjectMeta : metav1.ObjectMeta {
81
- Name : crName ,
80
+ GenerateName : crName + "-" ,
82
81
},
83
82
Rules : []rbacv1.PolicyRule {
84
83
{
@@ -96,9 +95,9 @@ func runKubeletAuthzTest(ctx context.Context, f *framework.Framework, endpoint,
96
95
Name : saName ,
97
96
}
98
97
99
- ginkgo .By (fmt .Sprintf ("Creating ClusterRoleBinding with ClusterRole %s with subject %s/%s" , crName , ns , saName ))
98
+ ginkgo .By (fmt .Sprintf ("Creating ClusterRoleBinding with ClusterRole %s with subject %s/%s" , clusterRole . Name , ns , saName ))
100
99
101
- err = e2eauth .BindClusterRole (ctx , f .ClientSet .RbacV1 (), crName , ns , subject )
100
+ err = e2eauth .BindClusterRole (ctx , f .ClientSet .RbacV1 (), clusterRole . Name , ns , subject )
102
101
framework .ExpectNoError (err )
103
102
104
103
ginkgo .By ("Waiting for Authorization Update." )
0 commit comments