|
7 | 7 |
|
8 | 8 | g "github.com/onsi/ginkgo/v2" |
9 | 9 | o "github.com/onsi/gomega" |
| 10 | + apierrors "k8s.io/apimachinery/pkg/api/errors" |
10 | 11 |
|
11 | 12 | corev1 "k8s.io/api/core/v1" |
12 | 13 | rbacv1 "k8s.io/api/rbac/v1" |
@@ -125,6 +126,8 @@ var ( |
125 | 126 | rbacv1helpers.NewRule("list", "watch").Groups(projectGroup, legacyProjectGroup).Resources("projects").RuleOrDie(), |
126 | 127 |
|
127 | 128 | rbacv1helpers.NewRule("use").Groups(security.GroupName).Resources("securitycontextconstraints").Names("restricted-v2").RuleOrDie(), |
| 129 | + // TODO: Uncomment this once https://github.com/openshift/cluster-kube-apiserver-operator/pull/1944 is merged. |
| 130 | + // rbacv1helpers.NewRule("use").Groups(security.GroupName).Resources("securitycontextconstraints").Names("restricted-v3").RuleOrDie(), |
128 | 131 |
|
129 | 132 | // TODO: remove when openshift-apiserver has removed these |
130 | 133 | rbacv1helpers.NewRule("get").URLs( |
@@ -243,6 +246,18 @@ var _ = g.Describe("[sig-auth][Feature:OpenShiftAuthorization] The default clust |
243 | 246 | exutil.FatalErr("failed to sync RBAC cache") |
244 | 247 | } |
245 | 248 |
|
| 249 | + // Temporary fix for https://github.com/openshift/cluster-kube-apiserver-operator/pull/1944 |
| 250 | + // Add a rule for restricted-v3 to the list in case the associated ClusterRoleBinding exists. |
| 251 | + // TODO: Remove the following block once merged. |
| 252 | + if _, err := kubeInformers.Rbac().V1().ClusterRoleBindings().Lister().Get("system:openshift:scc:restricted-v3"); err != nil { |
| 253 | + if !apierrors.IsNotFound(err) { |
| 254 | + e2e.Failf("Failed to get ClusterRoleBindings %q: %v", "system:openshift:scc:restricted-v3", err) |
| 255 | + } |
| 256 | + } else { |
| 257 | + allAuthenticatedRules = append(allAuthenticatedRules, |
| 258 | + rbacv1helpers.NewRule("use").Groups(security.GroupName).Resources("securitycontextconstraints").Names("restricted-v3").RuleOrDie()) |
| 259 | + } |
| 260 | + |
246 | 261 | namespaces, err := oc.AdminKubeClient().CoreV1().Namespaces().List(ctx, metav1.ListOptions{}) |
247 | 262 | if err != nil { |
248 | 263 | exutil.FatalErr(err) |
|
0 commit comments