@@ -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,6 @@ 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 ())
64
62
verb := "get"
65
63
resource := "nodes"
66
64
@@ -74,11 +72,11 @@ func runKubeletAuthzTest(ctx context.Context, f *framework.Framework, endpoint,
74
72
}, metav1.CreateOptions {})
75
73
framework .ExpectNoError (err )
76
74
77
- ginkgo .By (fmt .Sprintf ("Creating ClusterRole %s with for %s/%s" , crName , resource , authzSubresource ))
75
+ ginkgo .By (fmt .Sprintf ("Creating ClusterRole with prefix %s with for %s/%s" , authzSubresource , resource , authzSubresource ))
78
76
79
- _ , err = f .ClientSet .RbacV1 ().ClusterRoles ().Create (ctx , & rbacv1.ClusterRole {
77
+ clusterRole , err : = f .ClientSet .RbacV1 ().ClusterRoles ().Create (ctx , & rbacv1.ClusterRole {
80
78
ObjectMeta : metav1.ObjectMeta {
81
- Name : crName ,
79
+ GenerateName : authzSubresource + "-" ,
82
80
},
83
81
Rules : []rbacv1.PolicyRule {
84
82
{
@@ -96,9 +94,9 @@ func runKubeletAuthzTest(ctx context.Context, f *framework.Framework, endpoint,
96
94
Name : saName ,
97
95
}
98
96
99
- ginkgo .By (fmt .Sprintf ("Creating ClusterRoleBinding with ClusterRole %s with subject %s/%s" , crName , ns , saName ))
97
+ ginkgo .By (fmt .Sprintf ("Creating ClusterRoleBinding with ClusterRole %s with subject %s/%s" , clusterRole . Name , ns , saName ))
100
98
101
- err = e2eauth .BindClusterRole (ctx , f .ClientSet .RbacV1 (), crName , ns , subject )
99
+ err = e2eauth .BindClusterRole (ctx , f .ClientSet .RbacV1 (), clusterRole . Name , ns , subject )
102
100
framework .ExpectNoError (err )
103
101
104
102
ginkgo .By ("Waiting for Authorization Update." )
0 commit comments