Skip to content

Commit 8e4e8c4

Browse files
committed
refactor: helm chart testing
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 5829fd5 commit 8e4e8c4

5 files changed

Lines changed: 47 additions & 28 deletions

File tree

.github/workflows/ci-chart.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# This workflow lints and tests the Helm chart on pull requests that touch
2-
# chart-related files, and publishes it to the gh-pages Helm repository on
3-
# version tags.
1+
# This workflow lints and tests the Helm chart on pull requests/pushes that
2+
# touch chart-related files, and publishes it to the gh-pages Helm repository
3+
# on version tags.
44

55
name: ci-chart
66

@@ -34,7 +34,6 @@ on:
3434

3535
jobs:
3636
lint-test:
37-
if: ${{ github.event_name == 'pull_request' }}
3837
timeout-minutes: 60
3938
runs-on: ubuntu-24.04
4039
steps:
@@ -58,11 +57,11 @@ jobs:
5857
key: chart-toolbox-${{ runner.os }}
5958
path: |-
6059
${{ github.workspace }}/.sbin
61-
# - name: Setup Kind
62-
# uses: helm/kind-action@v1
63-
# with:
64-
# config: .github/configs/kind-config.yaml
65-
# version: v0.32.0
60+
- name: Setup Kind
61+
uses: helm/kind-action@v1
62+
with:
63+
config: .github/configs/kind-config.yaml
64+
version: v0.32.0
6665
- name: Generate
6766
run: make generate chart
6867
- name: Verify Generated
@@ -81,15 +80,17 @@ jobs:
8180
fi
8281
- name: Lint
8382
run: make lint chart
84-
# # NB(thxCode): the worker installs Node Feature Discovery, Kueue and the CSI
85-
# # drivers at runtime in this phase, so the test needs network egress and the
86-
# # released operator image; the device-manager DaemonSets stay at 0 desired
87-
# # on the GPU-less kind nodes.
88-
# - name: Test
89-
# run: make test chart
83+
# NB(thxCode): the worker installs Node Feature Discovery, Kueue and the CSI
84+
# drivers at runtime in this phase, so the test needs network egress and the
85+
# released operator image; the device-manager DaemonSets stay at 0 desired
86+
# on the GPU-less kind nodes.
87+
- name: Test
88+
run: make test chart
9089

9190
pack:
9291
if: ${{ startsWith(github.ref, 'refs/tags/') }}
92+
needs:
93+
- lint-test
9394
timeout-minutes: 30
9495
runs-on: ubuntu-24.04
9596
permissions:

deploy/gpustack-operator/chart/templates/device-manager/daemonset.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ spec:
144144
mountPath: /dev
145145
- name: sys-dir
146146
mountPath: /sys
147+
- name: tmp-dir
148+
mountPath: /tmp
149+
- name: containerd-run-dir
150+
mountPath: /run/containerd
151+
- name: docker-run-dir
152+
mountPath: /run/docker
147153
- name: gpustack-data-dir
148154
mountPath: /var/lib/gpustack
149155
- name: cdi-dir
@@ -181,10 +187,6 @@ spec:
181187
mountPath: /usr/local/corex
182188
readOnly: true
183189
{{- end }}
184-
{{- if eq $manu "nvidia" }}
185-
- name: gpustack-nvidia-vgpulock-dir
186-
mountPath: /tmp/vgpulock
187-
{{- end }}
188190
{{- if eq $manu "metax" }}
189191
- name: gpustack-metax-driver
190192
mountPath: /opt/mxdriver
@@ -207,6 +209,17 @@ spec:
207209
hostPath:
208210
path: /sys
209211
type: Directory
212+
- name: tmp-dir
213+
hostPath:
214+
path: /tmp
215+
- name: containerd-run-dir
216+
hostPath:
217+
path: /run/containerd
218+
type: DirectoryOrCreate
219+
- name: docker-run-dir
220+
hostPath:
221+
path: /run/docker
222+
type: DirectoryOrCreate
210223
- name: gpustack-data-dir
211224
hostPath:
212225
path: /var/lib/gpustack
@@ -257,12 +270,6 @@ spec:
257270
path: /usr/local/corex
258271
type: DirectoryOrCreate
259272
{{- end }}
260-
{{- if eq $manu "nvidia" }}
261-
- name: gpustack-nvidia-vgpulock-dir
262-
hostPath:
263-
path: /tmp/vgpulock
264-
type: Directory
265-
{{- end }}
266273
{{- if eq $manu "metax" }}
267274
- name: gpustack-metax-driver
268275
hostPath:

hack/lib/helm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,5 @@ function gpustack::helm::test() {
240240
ct install \
241241
--charts "${target#"${ROOT_DIR}/"}" \
242242
--chart-repos "${chart_repos}" \
243-
--helm-extra-args "--timeout 600s"
243+
--helm-extra-args "--timeout 600s --wait"
244244
}

pkg/worker/webhooks/worker/nodefeature.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ import (
2424
// when the node's Devices CR is available) counts exceeding the card's hardware
2525
// MaxPartitions. Other NodeFeature objects are not validated.
2626
//
27+
// The webhook is scoped by an objectSelector to the worker-owned NodeFeatures
28+
// (label "app.kubernetes.io/part-of=gpustack-operator-worker") so that the
29+
// NFD worker's per-node NodeFeature publishing is never gated on this
30+
// FailurePolicy=Fail webhook's backend being reachable.
31+
//
2732
// nolint: lll
2833
// +k8s:webhook-gen:validating:group="nfd.k8s-sigs.io",version="v1alpha1",resource="nodefeatures",scope="Namespaced"
2934
// +k8s:webhook-gen:validating:operations=["CREATE","UPDATE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10
35+
// +k8s:webhook-gen:validating:objectSelector={"matchLabels":{"app.kubernetes.io/part-of":"gpustack-operator-worker"}}
3036
type NodeFeatureWebhook struct {
3137
Client ctrlcli.Client
3238
APIReader ctrlcli.Reader

pkg/worker/webhooks/worker/zz_generated.webhooks.go

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)