-
Notifications
You must be signed in to change notification settings - Fork 451
Adding autoKueue to helm chart #7368
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,131 @@ | ||||||
| # 1. ConfigMap containing Kueue resource definitions | ||||||
| # This resource will be created in the 'kueue-system' namespace. | ||||||
| {{- if .Values.enableAutoKueue }} | ||||||
| apiVersion: v1 | ||||||
| kind: ConfigMap | ||||||
| metadata: | ||||||
| name: {{ .Release.Name }}-kueue-resources | ||||||
| namespace: kueue-system | ||||||
| annotations: | ||||||
| "helm.sh/hook": post-install,post-upgrade | ||||||
| "helm.sh/hook-weight": "-5" | ||||||
| "helm.sh/hook-delete-policy": before-hook-creation | ||||||
| data: | ||||||
| resources.yaml: |- | ||||||
| apiVersion: kueue.x-k8s.io/v1beta1 | ||||||
|
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
nit I think it should already work and seems better to use new versions going forward. |
||||||
| kind: Topology | ||||||
| metadata: | ||||||
| name: "default" | ||||||
| spec: | ||||||
| levels: | ||||||
| {{- range .Values.autoKueue.tasLevels }} | ||||||
| - nodeLabel: {{ .name | quote }} | ||||||
| {{- end }} | ||||||
| --- | ||||||
| kind: ResourceFlavor | ||||||
| apiVersion: kueue.x-k8s.io/v1beta1 | ||||||
| metadata: | ||||||
| name: "tas-flavor" | ||||||
|
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
since we may need other flavors for other accelerators. |
||||||
| spec: | ||||||
| {{- with .Values.autoKueue.nodeLabel }} | ||||||
| nodeLabels: | ||||||
| {{- toYaml . | nindent 8 }} | ||||||
| {{- end }} | ||||||
| topologyName: "default" | ||||||
| tolerations: | ||||||
| - key: "nvidia.com/gpu" | ||||||
| operator: "Exists" | ||||||
| effect: NoSchedule | ||||||
| --- | ||||||
| apiVersion: kueue.x-k8s.io/v1beta1 | ||||||
| kind: ClusterQueue | ||||||
| metadata: | ||||||
| name: {{ .Values.autoKueue.clusterQueueName | quote }} | ||||||
| spec: | ||||||
| namespaceSelector: {} # match all. | ||||||
| resourceGroups: | ||||||
| - coveredResources: ["nvidia.com/gpu"] | ||||||
| flavors: | ||||||
| - name: "tas-flavor" | ||||||
| resources: | ||||||
| - name: "nvidia.com/gpu" | ||||||
| nominalQuota: 100000000 | ||||||
| --- | ||||||
| # 2. Service Account for the Job | ||||||
| # This resource will be created in the 'kueue-system' namespace. | ||||||
| apiVersion: v1 | ||||||
| kind: ServiceAccount | ||||||
| metadata: | ||||||
| name: {{ .Release.Name }}-kueue-hook-sa | ||||||
| namespace: kueue-system | ||||||
| annotations: | ||||||
| "helm.sh/hook": post-install,post-upgrade | ||||||
| "helm.sh/hook-delete-policy": before-hook-creation | ||||||
|
|
||||||
| --- | ||||||
| # 3. ClusterRole with required permissions | ||||||
| # This defines permissions to get resources and create Kueue resources. | ||||||
| apiVersion: rbac.authorization.k8s.io/v1 | ||||||
| kind: ClusterRole | ||||||
| metadata: | ||||||
| name: {{ .Release.Name }}-kueue-hook-clusterrole | ||||||
|
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
wdyt? |
||||||
| annotations: | ||||||
| "helm.sh/hook": post-install,post-upgrade | ||||||
| "helm.sh/hook-delete-policy": before-hook-creation | ||||||
| rules: | ||||||
| - apiGroups: ["kueue.x-k8s.io"] | ||||||
| resources: ["topologies", "resourceflavors", "clusterqueues", "localqueues"] | ||||||
| verbs: ["create", "get", "list", "patch", "update"] | ||||||
| - apiGroups: [""] # Core API group | ||||||
| resources: ["configmaps", "endpoints"] | ||||||
| verbs: ["get"] | ||||||
|
|
||||||
| --- | ||||||
| # 4. A ClusterRoleBinding to grant the permissions cluster-wide | ||||||
| # This is required for managing cluster-scoped resources like Topologies. | ||||||
| apiVersion: rbac.authorization.k8s.io/v1 | ||||||
| kind: ClusterRoleBinding | ||||||
| metadata: | ||||||
| name: {{ .Release.Name }}-kueue-hook-crb | ||||||
|
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
And the name for the role I would say |
||||||
| annotations: | ||||||
| "helm.sh/hook": post-install,post-upgrade | ||||||
| "helm.sh/hook-delete-policy": before-hook-creation | ||||||
| roleRef: | ||||||
| apiGroup: rbac.authorization.k8s.io | ||||||
| kind: ClusterRole | ||||||
| name: {{ .Release.Name }}-kueue-hook-clusterrole | ||||||
| subjects: | ||||||
| - kind: ServiceAccount | ||||||
| name: {{ .Release.Name }}-kueue-hook-sa | ||||||
| namespace: kueue-system # The namespace where the ServiceAccount lives | ||||||
| --- | ||||||
| # 5. The Job that waits and applies the resources | ||||||
| # This Job will be created and run in the 'kueue-system' namespace. | ||||||
| apiVersion: batch/v1 | ||||||
| kind: Job | ||||||
| metadata: | ||||||
| name: "{{ .Release.Name }}-create-kueue-resources-job" | ||||||
| namespace: kueue-system | ||||||
| annotations: | ||||||
| "helm.sh/hook": post-install,post-upgrade | ||||||
| "helm.sh/hook-weight": "5" | ||||||
| "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation | ||||||
| spec: | ||||||
| template: | ||||||
| spec: | ||||||
| serviceAccountName: {{ .Release.Name }}-kueue-hook-sa | ||||||
| containers: | ||||||
| - name: kubectl-apply | ||||||
| image: bitnami/kubectl:latest | ||||||
|
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. Can we use some image that is hosted by k8s registry? Please explore https://explore.ggcr.dev/?repo=registry.k8s.io there is |
||||||
| command: | ||||||
| - /bin/sh | ||||||
| - -c | ||||||
| - | | ||||||
| set -ex | ||||||
| kubectl get configmap {{ .Release.Name }}-kueue-resources -n kueue-system -o=jsonpath='{.data.resources\.yaml}' | kubectl apply -f - | ||||||
| echo "🚀 All Kueue resources applied successfully." | ||||||
| restartPolicy: Never | ||||||
| backoffLimit: 5 | ||||||
| {{- end }} | ||||||
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.
wdyt?