Skip to content

feat: add aggregated clusterrole #3193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion helm-chart/kuberay-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
description: A Helm chart for Kubernetes
name: kuberay-operator
version: 1.1.0
version: 1.1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this line needs to be changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chart has changed, if version not update, users cannot distinguish between new and old versions.

Copy link
Member

@MortalHappiness MortalHappiness Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @kevin85421 Do you consider this only a patch version change, or do you think it is better to update the version to 1.2.0 or 2.0.0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I wasn't aware that it's 1.1.0. We should change it to nightly instead. Typically, I only update version in the release branch. I don't know why I updated it before.

icon: https://github.com/ray-project/ray/raw/master/doc/source/images/ray_header_logo.png
type: application
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# permissions for end users to view rayjobs.
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: raycluster-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayclusters
verbs:
- create
- update
- delete
- patch
- deletecollection
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# permissions for end users to view rayjobs.
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: raycluster-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayclusters
- rayclusters/status
verbs:
- get
- list
- watch
{{- end }}
14 changes: 3 additions & 11 deletions helm-chart/kuberay-operator/templates/ray_rayjob_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# permissions for end users to edit rayjobs.
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels: {{ include "kuberay-operator.labels" . | nindent 4 }}
name: rayjob-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
Expand All @@ -14,15 +14,7 @@ rules:
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ray.io
resources:
- rayjobs/status
verbs:
- get
- deletecollection
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
# permissions for end users to view rayjobs.
# permissions for end users to edit rayjobs.
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels: {{ include "kuberay-operator.labels" . | nindent 4 }}
name: rayjob-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayjobs
- rayjobs/status
verbs:
Copy link
Member

@MortalHappiness MortalHappiness Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why grant additional list and watch permissions for rayjobs/status?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just refer to kubernetes default clusterrole system:aggregate-to-view https://github.com/kubernetes/kubernetes/blob/b4c6895d0b0a913e3461bdc78358aa9514604b8f/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go#L111, it grant */status to view clusterrole. If rayxxx/status is not appropriate to be here, I can remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @kevin85421 Do you think it is okay to grant those additional permissions to status? Personally, I think it is fine to grant them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine with me. I plan to revisit all RBAC permissions soon and can decide whether to remove it at that time. We can leave it as is for this PR.

- get
- list
- watch
- apiGroups:
- ray.io
resources:
- rayjobs/status
verbs:
- get
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# permissions for end users to edit rayservices.
# permissions for end users to view rayservices.
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: rayservice-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
Expand All @@ -12,15 +14,7 @@ rules:
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ray.io
resources:
- rayservices/status
verbs:
- get
- deletecollection
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: rayservice-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayservices
- rayservices/status
verbs:
- get
- list
- watch
- apiGroups:
- ray.io
resources:
- rayservices/status
verbs:
- get
{{- end }}
20 changes: 20 additions & 0 deletions ray-operator/config/rbac/ray_raycluster_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# Source: kuberay-operator/templates/ray_raycluster_editor_role.yaml
# permissions for end users to view rayjobs.
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: raycluster-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayclusters
verbs:
- create
- update
- delete
- patch
- deletecollection
19 changes: 19 additions & 0 deletions ray-operator/config/rbac/ray_raycluster_viewer_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Source: kuberay-operator/templates/ray_raycluster_viewer_role.yaml
# permissions for end users to view rayjobs.
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: raycluster-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayclusters
- rayclusters/status
verbs:
- get
- list
- watch
16 changes: 6 additions & 10 deletions ray-operator/config/rbac/ray_rayjob_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
# Source: kuberay-operator/templates/ray_rayjob_editor_role.yaml
# permissions for end users to edit rayjobs.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rayjob-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
Expand All @@ -11,14 +15,6 @@ rules:
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ray.io
resources:
- rayjobs/status
verbs:
- get
- deletecollection
15 changes: 7 additions & 8 deletions ray-operator/config/rbac/ray_rayjob_viewer_role.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# permissions for end users to view rayjobs.
apiVersion: rbac.authorization.k8s.io/v1
---
# Source: kuberay-operator/templates/ray_rayjob_viewer_role.yaml
# permissions for end users to edit rayjobs.
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: rayjob-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayjobs
- rayjobs/status
verbs:
- get
- list
- watch
- apiGroups:
- ray.io
resources:
- rayjobs/status
verbs:
- get
16 changes: 6 additions & 10 deletions ray-operator/config/rbac/ray_rayservice_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# permissions for end users to edit rayservices.
---
# Source: kuberay-operator/templates/ray_rayservice_editor_role.yaml
# permissions for end users to view rayservices.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: rayservice-editor-role
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- ray.io
Expand All @@ -11,14 +15,6 @@ rules:
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ray.io
resources:
- rayservices/status
verbs:
- get
- deletecollection
11 changes: 5 additions & 6 deletions ray-operator/config/rbac/ray_rayservice_viewer_role.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
---
# Source: kuberay-operator/templates/ray_rayservice_viewer_role.yaml
# permissions for end users to view rayservices.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: rayservice-viewer-role
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- ray.io
resources:
- rayservices
- rayservices/status
verbs:
- get
- list
- watch
- apiGroups:
- ray.io
resources:
- rayservices/status
verbs:
- get
2 changes: 1 addition & 1 deletion scripts/helm-render-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export CURRENT_PATH
export KUBERAY_HOME=${CURRENT_PATH}/..

cd "$KUBERAY_HOME"/helm-chart/kuberay-operator/ || exit 1
declare -a YAML_ARRAY=("role.yaml" "ray_rayjob_editor_role.yaml" "ray_rayjob_viewer_role.yaml" "leader_election_role.yaml" "ray_rayservice_editor_role.yaml" "ray_rayservice_viewer_role.yaml" )
declare -a YAML_ARRAY=("role.yaml" "ray_raycluster_viewer_role.yaml" "ray_raycluster_editor_role.yaml" "ray_rayjob_editor_role.yaml" "ray_rayjob_viewer_role.yaml" "leader_election_role.yaml" "ray_rayservice_editor_role.yaml" "ray_rayservice_viewer_role.yaml" )
mkdir -p "$KUBERAY_HOME"/scripts/tmp
for name in "${YAML_ARRAY[@]}"; do
helm template -s templates/"$name" . > "$CURRENT_PATH"/tmp/"$name"
Expand Down
Loading