Skip to content

Commit b6b1f30

Browse files
committed
feat(chart): install gpu-sharing as OCI dependency
Signed-off-by: davidLif <davidshani12@gmail.com>
1 parent 1e38875 commit b6b1f30

14 files changed

Lines changed: 187 additions & 7 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Added
2+
body: |-
3+
Install gpu-sharing as an OCI subchart

.github/workflows/on-pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ jobs:
233233
234234
- name: Build helm chart
235235
run: |
236+
helm dependency build ./deployments/kai-scheduler
236237
helm package ./deployments/kai-scheduler -d ./charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION
237238
cp charts/kai-scheduler-$PACKAGE_VERSION.tgz /mnt/images/
238239

.github/workflows/on-release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
- name: Build helm chart
6464
run: |
6565
sed -i 's#registry/local/kai-scheduler#${{ env.DOCKER_REGISTRY }}#' deployments/kai-scheduler/values.yaml
66+
helm dependency build ./deployments/kai-scheduler
6667
helm package ./deployments/kai-scheduler -d ./charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION
6768
cp charts/kai-scheduler-$PACKAGE_VERSION.tgz /mnt/images/
6869

.github/workflows/push-artifacts.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- name: Build helm chart
6060
run: |
6161
sed -i 's#registry/local/kai-scheduler#${{ env.DOCKER_REGISTRY }}#' deployments/kai-scheduler/values.yaml
62+
helm dependency build ./deployments/kai-scheduler
6263
helm package ./deployments/kai-scheduler -d ./charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION
6364
6465
- name: Push Helm Chart

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ K8S_COPYRIGHTED_MANIFEST_FILES := deployments/kai-scheduler/crds/kai.scheduler_t
2727
lint: fmt-go vet-go lint-go
2828
.PHONY: lint
2929

30+
.PHONY: chart-deps
31+
chart-deps:
32+
@echo "Fetching Helm chart dependencies: kai-scheduler"
33+
helm dependency build ./deployments/kai-scheduler
34+
3035
.PHONY: test-chart
31-
test-chart:
36+
test-chart: chart-deps
3237
@echo "Running tests for Helm chart: kai-scheduler"
3338
docker run -t --rm -v ./deployments/kai-scheduler:/apps helmunittest/helm-unittest:3.17.2-0.8.1 . -f 'tests/**/*_test.yaml'
3439

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: gpu-sharing
3+
repository: oci://ghcr.io/kai-scheduler/gpu-sharing
4+
version: v0.1.0-alpha.1
5+
digest: sha256:c3d7f76c6d2b2fd7b256b7450fb435a82693e8acef1265d10a8d5270fcb028db
6+
generated: "2026-08-02T20:53:54.374149+03:00"

deployments/kai-scheduler/Chart.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ name: kai-scheduler
66
description: KAI Scheduler by NVIDIA
77
type: application
88
version: 0.0.0
9-
appVersion: 0.0.0
9+
appVersion: 0.0.0
10+
11+
dependencies:
12+
- name: gpu-sharing
13+
version: v0.1.0-alpha.1
14+
repository: oci://ghcr.io/kai-scheduler/gpu-sharing
15+
condition: global.nvFractions.set

deployments/kai-scheduler/templates/_helpers.tpl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ spec:
108108
{{- if .Values.podgrouper.queueLabelKey }}
109109
queueLabelKey: {{ .Values.podgrouper.queueLabelKey | quote }}
110110
{{- end }}
111-
{{- /* GpuSharingMode precedence: an explicit (non-empty) mode wins; otherwise a
112-
legacy gpuSharing value is passed through (operator derives the mode); when
113-
neither is set, default to NonMemoryEnforced. */}}
114-
{{- if .Values.global.gpuSharingMode }}
111+
{{- /* GpuSharingMode precedence: nvFractions.set forces NvFractions (validate.yaml has
112+
already rejected a conflicting explicit mode, so this only guards against a legacy
113+
gpuSharing value downgrading it); then an explicit (non-empty) mode; then a legacy
114+
gpuSharing value is passed through (operator derives the mode); when none is set,
115+
default to NonMemoryEnforced. */}}
116+
{{- if .Values.global.nvFractions.set }}
117+
gpuSharingMode: NvFractions
118+
{{- else if .Values.global.gpuSharingMode }}
115119
gpuSharingMode: {{ .Values.global.gpuSharingMode }}
116120
{{- else if not (hasKey .Values.global "gpuSharing") }}
117121
gpuSharingMode: NonMemoryEnforced
@@ -260,7 +264,7 @@ spec:
260264
maxUnavailable: {{ .Values.admission.podDisruptionBudget.maxUnavailable }}
261265
{{- end }}
262266
{{- end }}
263-
{{- if and (not .Values.global.gpuSharingMode) (hasKey .Values.global "gpuSharing") }}
267+
{{- if and (not .Values.global.nvFractions.set) (not .Values.global.gpuSharingMode) (hasKey .Values.global "gpuSharing") }}
264268
gpuSharing: {{ .Values.global.gpuSharing }}
265269
{{- end }}
266270
blockNvidiaVisibleDevices: {{ .Values.global.blockNvidiaVisibleDevices | default false }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{/*
2+
Copyright 2025 NVIDIA CORPORATION
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
{{- /* Renders no resource. Aborts the render when nvFractions.set asks for the gpu-sharing
6+
operator while gpuSharingMode explicitly selects a different mode. */}}
7+
{{- if and .Values.global.nvFractions.set .Values.global.gpuSharingMode (ne .Values.global.gpuSharingMode "NvFractions") }}
8+
{{- fail (printf "global.nvFractions.set=true requires global.gpuSharingMode to be empty or \"NvFractions\", got %q" .Values.global.gpuSharingMode) }}
9+
{{- end }}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Copyright 2025 NVIDIA CORPORATION
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
suite: test nvFractions subchart gating and validation
5+
6+
tests:
7+
- it: rejects nvFractions.set=true with a conflicting gpuSharingMode
8+
templates:
9+
- templates/validate.yaml
10+
set:
11+
global.nvFractions.set: true
12+
global.gpuSharingMode: HamiCore
13+
asserts:
14+
- failedTemplate:
15+
errorMessage: 'global.nvFractions.set=true requires global.gpuSharingMode to be empty or "NvFractions", got "HamiCore"'
16+
17+
- it: allows nvFractions.set=true with an explicit NvFractions mode
18+
templates:
19+
- templates/validate.yaml
20+
set:
21+
global.nvFractions.set: true
22+
global.gpuSharingMode: NvFractions
23+
asserts:
24+
- notFailedTemplate: {}
25+
26+
- it: allows nvFractions.set=true with an empty gpuSharingMode
27+
templates:
28+
- templates/validate.yaml
29+
set:
30+
global.nvFractions.set: true
31+
asserts:
32+
- notFailedTemplate: {}
33+
34+
- it: allows gpuSharingMode NvFractions while the subchart is disabled
35+
templates:
36+
- templates/validate.yaml
37+
set:
38+
global.gpuSharingMode: NvFractions
39+
asserts:
40+
- notFailedTemplate: {}
41+
42+
- it: nvFractions.set=true selects NvFractions and omits legacy gpuSharing
43+
templates:
44+
- kai-config.yaml
45+
set:
46+
kaiConfigDeployer.enabled: false
47+
kaiConfig.render: true
48+
global.nvFractions.set: true
49+
asserts:
50+
- equal:
51+
path: spec.global.gpuSharingMode
52+
value: NvFractions
53+
- notExists:
54+
path: spec.admission.gpuSharing
55+
56+
- it: nvFractions.set=true is not downgraded by a legacy gpuSharing value
57+
templates:
58+
- kai-config.yaml
59+
set:
60+
kaiConfigDeployer.enabled: false
61+
kaiConfig.render: true
62+
global.nvFractions.set: true
63+
global.gpuSharing: false
64+
asserts:
65+
- equal:
66+
path: spec.global.gpuSharingMode
67+
value: NvFractions
68+
- notExists:
69+
path: spec.admission.gpuSharing
70+
71+
- it: nvFractions.set=true with an explicit NvFractions mode agrees
72+
templates:
73+
- kai-config.yaml
74+
set:
75+
kaiConfigDeployer.enabled: false
76+
kaiConfig.render: true
77+
global.nvFractions.set: true
78+
global.gpuSharingMode: NvFractions
79+
asserts:
80+
- equal:
81+
path: spec.global.gpuSharingMode
82+
value: NvFractions
83+
84+
- it: default is unchanged when nvFractions.set is false
85+
templates:
86+
- kai-config.yaml
87+
set:
88+
kaiConfigDeployer.enabled: false
89+
kaiConfig.render: true
90+
asserts:
91+
- equal:
92+
path: spec.global.gpuSharingMode
93+
value: NonMemoryEnforced
94+
95+
# No mirror-image test asserting the deployment is absent when nvFractions.set is false:
96+
# helm-unittest treats a conditioned-out subchart template as "not exists or not selected"
97+
# and errors instead of rendering zero documents. The off state is covered by Helm's
98+
# condition: semantics and by the NonMemoryEnforced default asserted above.
99+
- it: renders the gpu-sharing operator deployment when nvFractions.set is true
100+
templates:
101+
- charts/gpu-sharing/templates/deployment.yaml
102+
set:
103+
global.nvFractions.set: true
104+
asserts:
105+
- hasDocuments:
106+
count: 1
107+
- isKind:
108+
of: Deployment

0 commit comments

Comments
 (0)