Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/common/oidc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ type RoleBindings struct {
RoleRefs []RoleRef `json:"roleRefs"`
}

// +kubebuilder:validation:XValidation:rule="self.kind == 'Role' && has(self.namespace) && self.namespace != ”", message="namespace must be set if kind is 'Role'"
// +kubebuilder:validation:XValidation:rule="self.kind == 'ClusterRole' && (!has(self.namespace) || self.namespace == ”)", message="namespace must not be set if kind is 'ClusterRole'"
// RoleRef defines a reference to a (cluster) role that should be bound to the subjects.
// TODO: Validate that Namespace is set if Kind is 'Role' and not set if Kind is 'ClusterRole'.
type RoleRef struct {
// Name is the name of the role or cluster role to bind to the subjects.
// +kubebuilder:validation:MinLength=1
Expand Down
9 changes: 2 additions & 7 deletions api/crds/manifests/clusters.openmcp.cloud_accessrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ spec:
RoleRefs is a list of (cluster) role references that the subjects should be bound to.
Note that existence of the roles is not checked and missing (cluster) roles will result in ineffective (cluster) role bindings.
items:
description: RoleRef defines a reference to a (cluster)
role that should be bound to the subjects.
properties:
kind:
description: |-
Expand All @@ -139,13 +141,6 @@ spec:
- kind
- name
type: object
x-kubernetes-validations:
- message: namespace must be set if kind is 'Role'
rule: self.kind == 'Role' && has(self.namespace) &&
self.namespace != ”
- message: namespace must not be set if kind is 'ClusterRole'
rule: self.kind == 'ClusterRole' && (!has(self.namespace)
|| self.namespace == ”)
type: array
subjects:
description: |-
Expand Down
19 changes: 4 additions & 15 deletions api/crds/manifests/core.openmcp.cloud_managedcontrolplanev2s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ spec:
RoleRefs is a list of (cluster) role references that the subjects should be bound to.
Note that existence of the roles is not checked and missing (cluster) roles will result in ineffective (cluster) role bindings.
items:
description: RoleRef defines a reference to a (cluster)
role that should be bound to the subjects.
properties:
kind:
description: |-
Expand All @@ -123,14 +125,6 @@ spec:
- kind
- name
type: object
x-kubernetes-validations:
- message: namespace must be set if kind is 'Role'
rule: self.kind == 'Role' && has(self.namespace)
&& self.namespace != ”
- message: namespace must not be set if kind is
'ClusterRole'
rule: self.kind == 'ClusterRole' && (!has(self.namespace)
|| self.namespace == ”)
type: array
subjects:
description: |-
Expand Down Expand Up @@ -209,6 +203,8 @@ spec:
RoleRefs is a list of (cluster) role references that the subjects should be bound to.
Note that existence of the roles is not checked and missing (cluster) roles will result in ineffective (cluster) role bindings.
items:
description: RoleRef defines a reference to a (cluster)
role that should be bound to the subjects.
properties:
kind:
description: |-
Expand All @@ -232,13 +228,6 @@ spec:
- kind
- name
type: object
x-kubernetes-validations:
- message: namespace must be set if kind is 'Role'
rule: self.kind == 'Role' && has(self.namespace) &&
self.namespace != ”
- message: namespace must not be set if kind is 'ClusterRole'
rule: self.kind == 'ClusterRole' && (!has(self.namespace)
|| self.namespace == ”)
type: array
subjects:
description: |-
Expand Down