Change:
psp, err = f.ClientSet.ExtensionsV1beta1().PodSecurityPolicies().Create(psp) ExpectNoError(err, "Failed to create PSP %s", podSecurityPolicyPrivileged) <del> // Create the Role to bind it to the namespace. _, err = f.ClientSet.RbacV1beta1().ClusterRoles().Create(&rbacv1beta1.ClusterRole{ ObjectMeta: metav1.ObjectMeta{Name: podSecurityPolicyPrivileged}, Rules: []rbacv1beta1.PolicyRule{{ APIGroups:     []string{"extensions"}, Resources:     []string{"podsecuritypolicies"}, ResourceNames: []string{podSecurityPolicyPrivileged}, Verbs:         []string{"use"}, }}, }) ExpectNoError(err, "Failed to create PSP role") </del> <ins> if IsRBACEnabled(f) { // Create the Role to bind it to the namespace. _, err = f.ClientSet.RbacV1beta1().ClusterRoles().Create(&rbacv1beta1.ClusterRole{ ObjectMeta: metav1.ObjectMeta{Name: podSecurityPolicyPrivileged}, Rules: []rbacv1beta1.PolicyRule{{ APIGroups:     []string{"extensions"}, Resources:     []string{"podsecuritypolicies"}, ResourceNames: []string{podSecurityPolicyPrivileged}, Verbs:         []string{"use"}, }}, }) ExpectNoError(err, "Failed to create PSP role") } </ins> }) <del> By(fmt.Sprintf("Binding the %s PodSecurityPolicy to the default service account in %s", podSecurityPolicyPrivileged, namespace)) BindClusterRoleInNamespace(f.ClientSet.RbacV1beta1(), podSecurityPolicyPrivileged, namespace, rbacv1beta1.Subject{ Kind:      rbacv1beta1.ServiceAccountKind, Namespace: namespace, Name:      "default", }) ExpectNoError(WaitForNamedAuthorizationUpdate(f.ClientSet.AuthorizationV1beta1(), serviceaccount.MakeUsername(namespace, "default"), namespace, "use", podSecurityPolicyPrivileged, schema.GroupResource{Group: "extensions", Resource: "podsecuritypolicies"}, true)) </del> <ins> if IsRBACEnabled(f) { By(fmt.Sprintf("Binding the %s PodSecurityPolicy to the default service account in %s", podSecurityPolicyPrivileged, namespace)) BindClusterRoleInNamespace(f.ClientSet.RbacV1beta1(), podSecurityPolicyPrivileged, namespace, rbacv1beta1.Subject{ Kind:      rbacv1beta1.ServiceAccountKind, Namespace: namespace, Name:      "default", }) ExpectNoError(WaitForNamedAuthorizationUpdate(f.ClientSet.AuthorizationV1beta1(), serviceaccount.MakeUsername(namespace, "default"), namespace, "use", podSecurityPolicyPrivileged, schema.GroupResource{Group: "extensions", Resource: "podsecuritypolicies"}, true)) } </ins> }

Discussion:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . --Is this a BUG REPORT or FEATURE REQUEST?: /kind bug What happened: (This is to have an accompanying issue for the PR ) Creating privileged PSPs during e2e tests depends on RBAC being enabled in the target cluster. However it is possible to use PSPs without having RBAC enabled thus only enable creating PSPs during e2e tests if both PSP and RBAC is enabled. What you expected to happen: RBAC role binding should only be created when RBAC is enabled in the cluster being tested.
There are no sig labels on this issue. Please add a sig label. <detailsA sig label can be by either: a sig: e.g., to notify the contributor experience sig, OR the label manually: e.g., to apply the label Note: Method 1 will trigger an email to the group. See the . The in method 1 has to be replaced with one of these: bugs, feature-requests, pr-reviews, test-failures, proposals Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details