Skip to content

Commit ee1fe05

Browse files
committed
fix up the delegation logic
1 parent 7f0815b commit ee1fe05

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

hack/local-up-master/kube-apiserver-manifests/01_role_binding_restriction_crd.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
singular: rolebindingrestriction
1212
subresources:
1313
status: {}
14-
scope: Cluster
14+
scope: Namespaced
1515
versions:
1616
- name: v1
1717
served: true
@@ -46,12 +46,14 @@ spec:
4646
items:
4747
type: string
4848
type: array
49+
nullable: true
4950
labels:
5051
description: Selectors specifies a list of label selectors over
5152
group labels.
5253
items:
5354
type: object
5455
type: array
56+
nullable: true
5557
type: object
5658
serviceaccountrestriction:
5759
description: ServiceAccountRestriction matches against service-account
@@ -90,12 +92,14 @@ spec:
9092
items:
9193
type: string
9294
type: array
95+
nullable: true
9396
labels:
9497
description: Selectors specifies a list of label selectors over
9598
user labels.
9699
items:
97100
type: object
98101
type: array
102+
nullable: true
99103
users:
100104
description: Users specifies a list of literal user names.
101105
items:

pkg/admission/customresourcevalidation/rolebindingrestriction/validate_rbr.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (roleBindingRestrictionV1) ValidateCreate(obj runtime.Object) field.ErrorLi
5656
return errs
5757
}
5858

59-
errs = append(errs, validation.ValidateObjectMeta(&roleBindingRestrictionObj.ObjectMeta, false, validation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
59+
errs = append(errs, validation.ValidateObjectMeta(&roleBindingRestrictionObj.ObjectMeta, true, validation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
6060
errs = append(errs, rbrvalidation.ValidateRoleBindingRestriction(roleBindingRestrictionObj)...)
6161

6262
return errs
@@ -72,7 +72,7 @@ func (roleBindingRestrictionV1) ValidateUpdate(obj runtime.Object, oldObj runtim
7272
return errs
7373
}
7474

75-
errs = append(errs, validation.ValidateObjectMeta(&roleBindingRestrictionObj.ObjectMeta, false, validation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
75+
errs = append(errs, validation.ValidateObjectMeta(&roleBindingRestrictionObj.ObjectMeta, true, validation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
7676
errs = append(errs, rbrvalidation.ValidateRoleBindingRestrictionUpdate(roleBindingRestrictionObj, roleBindingRestrictionOldObj)...)
7777

7878
return errs

pkg/cmd/openshift-kube-apiserver/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func RunOpenShiftKubeAPIServerServer(kubeAPIServerConfig *kubecontrolplanev1.Kub
2626
apiserver.AddAlwaysLocalDelegateForPrefix("/apis/quota.openshift.io/v1/clusterresourcequotas")
2727
apiserver.AddAlwaysLocalDelegateForPrefix("/apis/security.openshift.io/v1/securitycontextconstraints")
2828
apiserver.AddAlwaysLocalDelegateForPrefix("/apis/authorization.openshift.io/v1/rolebindingrestrictions")
29+
apiserver.AddAlwaysLocalDelegateGroupResource(schema.GroupResource{Group: "authorization.openshift.io", Resource: "rolebindingrestrictions"})
2930

3031
// This allows the CRD registration to avoid fighting with the APIService from the operator
3132
apiserver.AddOverlappingGroupVersion(schema.GroupVersion{Group: "authorization.openshift.io", Version: "v1"})

0 commit comments

Comments
 (0)