-
Notifications
You must be signed in to change notification settings - Fork 822
[Feature] [history server] Support token auth in the history server collector #5078
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
CheyuWu
wants to merge
22
commits into
ray-project:master
Choose a base branch
from
CheyuWu:feat/i/5056
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5e8ff25
feat: add auth env to operator
CheyuWu dd4bc4b
chore: bump ray-operator to v1.6.2
CheyuWu 5926232
feat: collect support ray auth token
CheyuWu 34c11ba
test: add e2e test
CheyuWu 4e22807
chore: update yaml file
CheyuWu 11d57ae
Merge remote-tracking branch 'upstream/master' into feat/i/5056
CheyuWu 6baf3e6
chore: refactor the code and add auth.go unit test
CheyuWu 3725470
feat: add example for k8s auth yaml
CheyuWu 2d6add6
Merge remote-tracking branch 'upstream/master' into feat/i/5056
CheyuWu aa57c32
chore: update yaml file and update readme
CheyuWu b164f05
chore: update the auth.go func name
CheyuWu 4c0191f
fix: remove duplicate and unused test code
CheyuWu 4af2e32
chore: use enum
CheyuWu cee1e00
Merge remote-tracking branch 'upstream/master' into feat/i/5056
CheyuWu 1539672
chore: update kubernetes-auth.yaml
CheyuWu 96c8b86
fix: Auth config errors still retry
CheyuWu 701aad2
chore: update env var
CheyuWu 10112f4
fix: bad testing type
CheyuWu 23f7c34
fix: enum problem and unrelated comment
CheyuWu c5a9d0e
fix: wrong ray version
CheyuWu 083e8c4
chore: update the historyServerOptions yaml config
CheyuWu 36269c0
Revert "chore: update the historyServerOptions yaml config"
CheyuWu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,10 @@ metadata: | |||||
| name: raycluster-historyserver | ||||||
| namespace: default | ||||||
| spec: | ||||||
| # Enable Ray token authentication. Requires Ray 2.52.0+ | ||||||
| # rayVersion: "2.52.0" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ditto |
||||||
| # authOptions: | ||||||
| # mode: token | ||||||
| headGroupSpec: | ||||||
| rayStartParams: | ||||||
| dashboard-host: 0.0.0.0 | ||||||
|
|
@@ -93,6 +97,13 @@ spec: | |||||
| value: "gcs" | ||||||
| - name: EVENTS_PORT | ||||||
| value: "8084" | ||||||
| # Uncomment when the RayCluster sets `spec.authOptions.mode: token`; the collector | ||||||
| # needs the token to call the Dashboard. | ||||||
| # - name: RAY_AUTH_TOKEN | ||||||
| # valueFrom: | ||||||
| # secretKeyRef: | ||||||
| # name: ${RAY_CLUSTER} # defaults to the RayCluster name | ||||||
| # key: auth_token | ||||||
| volumeMounts: | ||||||
| - name: historyserver | ||||||
| mountPath: *rayTmpRoot | ||||||
|
|
@@ -165,6 +176,13 @@ spec: | |||||
| value: "gcs" | ||||||
| - name: EVENTS_PORT | ||||||
| value: "8084" | ||||||
| # Uncomment when the RayCluster sets `spec.authOptions.mode: token`; the collector | ||||||
| # needs the token to call the Dashboard. | ||||||
| # - name: RAY_AUTH_TOKEN | ||||||
| # valueFrom: | ||||||
| # secretKeyRef: | ||||||
| # name: ${RAY_CLUSTER} # defaults to the RayCluster name | ||||||
| # key: auth_token | ||||||
| volumeMounts: | ||||||
| - name: historyserver | ||||||
| mountPath: *rayTmpRoot | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,262 @@ | ||
| apiVersion: ray.io/v1 | ||
| kind: RayCluster | ||
| metadata: | ||
| labels: | ||
| ray.io/cluster: raycluster-historyserver-kubernetes-auth | ||
| name: raycluster-historyserver-kubernetes-auth | ||
| spec: | ||
| # enableK8sTokenAuth requires Ray 2.55.0+. authOptions.secretName must NOT be | ||
| # set at the same time. | ||
| rayVersion: '2.55.0' | ||
| authOptions: | ||
| mode: 'token' | ||
| enableK8sTokenAuth: true | ||
| headGroupSpec: | ||
| rayStartParams: | ||
| dashboard-host: 0.0.0.0 | ||
| num-cpus: "0" | ||
| template: | ||
| spec: | ||
| serviceAccountName: raycluster-historyserver-kubernetes-auth | ||
| containers: | ||
| - name: ray-head | ||
| imagePullPolicy: IfNotPresent | ||
| image: rayproject/ray:2.55.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use ray 2.56.0 |
||
| env: | ||
| - name: RAY_TMP_ROOT | ||
| value: &rayTmpRoot /tmp/ray | ||
| - name: RAY_enable_ray_event | ||
| value: "true" | ||
| - name: RAY_enable_core_worker_ray_event_to_aggregator | ||
| value: "true" | ||
| - name: RAY_DASHBOARD_AGGREGATOR_AGENT_EVENTS_EXPORT_ADDR | ||
| value: "http://localhost:8084/v1/events" | ||
| - name: RAY_DASHBOARD_AGGREGATOR_AGENT_PUBLISHER_HTTP_ENDPOINT_EXPOSABLE_EVENT_TYPES | ||
| value: &eventTypes "TASK_DEFINITION_EVENT,TASK_LIFECYCLE_EVENT,ACTOR_TASK_DEFINITION_EVENT, | ||
| TASK_PROFILE_EVENT,DRIVER_JOB_DEFINITION_EVENT,DRIVER_JOB_LIFECYCLE_EVENT, | ||
| ACTOR_DEFINITION_EVENT,ACTOR_LIFECYCLE_EVENT,NODE_DEFINITION_EVENT,NODE_LIFECYCLE_EVENT" | ||
| resources: | ||
| limits: | ||
| cpu: "5" | ||
| memory: "10Gi" | ||
| requests: | ||
| cpu: "50m" | ||
| memory: "1Gi" | ||
| ports: | ||
| - containerPort: 6379 | ||
| name: gcs-server | ||
| - containerPort: 8265 | ||
| name: dashboard | ||
| - containerPort: 10001 | ||
| name: client | ||
| volumeMounts: | ||
| - name: historyserver | ||
| mountPath: *rayTmpRoot | ||
| - name: collector | ||
| image: collector:v0.1.0 | ||
| imagePullPolicy: IfNotPresent | ||
| env: | ||
| - name: POD_IP | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: status.podIP | ||
| - name: FQ_RAY_IP | ||
| value: raycluster-historyserver-kubernetes-auth-head-svc.default.svc.cluster.local | ||
| - name: RAY_TMP_ROOT | ||
| value: *rayTmpRoot | ||
| # RAY_DASHBOARD_ADDRESS is used by the head collector to fetch endpoints' results | ||
| # (e.g., /api/v0/cluster_metadata) from the Ray Dashboard running in the same pod. | ||
| # Only the head collector uses this; worker collectors do not need it. | ||
| - name: RAY_DASHBOARD_ADDRESS | ||
| value: "http://localhost:8265" | ||
| - name: RAY_AUTH_MODE | ||
| value: "token" | ||
| - name: RAY_ENABLE_K8S_TOKEN_AUTH | ||
| value: "true" | ||
| - name: AWS_ACCESS_KEY_ID | ||
| value: minioadmin | ||
| - name: AWS_SECRET_ACCESS_KEY | ||
| value: minioadmin | ||
| - name: AWS_SESSION_TOKEN | ||
| value: "" | ||
| - name: S3_BUCKET | ||
| value: "ray-historyserver" | ||
| - name: S3_ENDPOINT | ||
| value: "minio-service.minio-dev:9000" | ||
| - name: S3_REGION | ||
| value: "test" | ||
| - name: S3FORCE_PATH_STYLE | ||
| value: "true" | ||
| - name: S3DISABLE_SSL | ||
| value: "true" | ||
| command: | ||
| - collector | ||
| - --role=Head | ||
| - --runtime-class-name=s3 | ||
| - --ray-cluster-name=raycluster-historyserver-kubernetes-auth | ||
| - --ray-root-dir=log | ||
| - --events-port=8084 | ||
| resources: | ||
| limits: | ||
| cpu: "200m" | ||
| memory: "256Mi" | ||
| requests: | ||
| cpu: "50m" | ||
| memory: "64Mi" | ||
| volumeMounts: | ||
| - name: historyserver | ||
| mountPath: *rayTmpRoot | ||
| - name: ray-token | ||
| mountPath: /var/run/secrets/ray.io/serviceaccount | ||
| readOnly: true | ||
| volumes: | ||
| - name: historyserver | ||
| emptyDir: {} | ||
| workerGroupSpecs: | ||
| - replicas: 1 | ||
| minReplicas: 1 | ||
| maxReplicas: 5 | ||
| groupName: workergroup | ||
| rayStartParams: {} | ||
| template: | ||
| spec: | ||
| serviceAccountName: raycluster-historyserver-kubernetes-auth | ||
| containers: | ||
| - name: ray-worker | ||
| imagePullPolicy: IfNotPresent | ||
| image: rayproject/ray:2.55.0 | ||
| env: | ||
| - name: RAY_TMP_ROOT | ||
| value: *rayTmpRoot | ||
| - name: RAY_enable_ray_event | ||
| value: "true" | ||
| - name: RAY_enable_core_worker_ray_event_to_aggregator | ||
| value: "true" | ||
| - name: RAY_DASHBOARD_AGGREGATOR_AGENT_EVENTS_EXPORT_ADDR | ||
| value: "http://localhost:8084/v1/events" | ||
| - name: RAY_DASHBOARD_AGGREGATOR_AGENT_PUBLISHER_HTTP_ENDPOINT_EXPOSABLE_EVENT_TYPES | ||
| value: *eventTypes | ||
| resources: | ||
| limits: | ||
| cpu: "2" | ||
| memory: "2Gi" | ||
| requests: | ||
| cpu: "50m" | ||
| memory: "1Gi" | ||
| volumeMounts: | ||
| - name: historyserver | ||
| mountPath: *rayTmpRoot | ||
| - name: collector | ||
| image: collector:v0.1.0 | ||
| imagePullPolicy: IfNotPresent | ||
| env: | ||
| - name: POD_IP | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: status.podIP | ||
| - name: FQ_RAY_IP | ||
| value: raycluster-historyserver-kubernetes-auth-head-svc.default.svc.cluster.local | ||
| - name: RAY_TMP_ROOT | ||
| value: *rayTmpRoot | ||
| - name: RAY_AUTH_MODE | ||
| value: "token" | ||
| - name: RAY_ENABLE_K8S_TOKEN_AUTH | ||
| value: "true" | ||
| - name: AWS_ACCESS_KEY_ID | ||
| value: minioadmin | ||
| - name: AWS_SECRET_ACCESS_KEY | ||
| value: minioadmin | ||
| - name: AWS_SESSION_TOKEN | ||
| value: "" | ||
| - name: S3_BUCKET | ||
| value: "ray-historyserver" | ||
| - name: S3_ENDPOINT | ||
| value: "minio-service.minio-dev:9000" | ||
| - name: S3_REGION | ||
| value: "test" | ||
| - name: S3FORCE_PATH_STYLE | ||
| value: "true" | ||
| - name: S3DISABLE_SSL | ||
| value: "true" | ||
| command: | ||
| - collector | ||
| - --role=Worker | ||
| - --runtime-class-name=s3 | ||
| - --ray-cluster-name=raycluster-historyserver-kubernetes-auth | ||
| - --ray-root-dir=log | ||
| - --events-port=8084 | ||
| resources: | ||
| limits: | ||
| cpu: "200m" | ||
| memory: "256Mi" | ||
| requests: | ||
| cpu: "50m" | ||
| memory: "64Mi" | ||
| volumeMounts: | ||
| - name: historyserver | ||
| mountPath: *rayTmpRoot | ||
| - name: ray-token | ||
| mountPath: /var/run/secrets/ray.io/serviceaccount | ||
| readOnly: true | ||
| volumes: | ||
| - name: historyserver | ||
| emptyDir: {} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: raycluster-historyserver-kubernetes-auth | ||
| --- | ||
| # The Ray Dashboard runs TokenReview/SubjectAccessReview to validate incoming | ||
| # tokens, so the cluster's ServiceAccount needs permission to create them. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: ray-authenticator | ||
| rules: | ||
| - apiGroups: ["authentication.k8s.io"] | ||
| resources: | ||
| - 'tokenreviews' | ||
| verbs: ["create"] | ||
| - apiGroups: ["authorization.k8s.io"] | ||
| resources: | ||
| - 'subjectaccessreviews' | ||
| verbs: ["create"] | ||
| --- | ||
| # Grants the caller ray:write on rayclusters, which is what the Dashboard | ||
| # authorizes the presented token against. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: ray-writer | ||
| rules: | ||
| - apiGroups: ["ray.io"] | ||
| resources: | ||
| - 'rayclusters' | ||
| verbs: ["ray:write"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: ray-authenticator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: ray-authenticator | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: raycluster-historyserver-kubernetes-auth | ||
| namespace: default | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: raycluster-historyserver-kubernetes-auth | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: ray-writer | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: raycluster-historyserver-kubernetes-auth | ||
| namespace: default | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the ray image that we use.