File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -172,3 +172,28 @@ apply_check_delete_workload_imex_chan_inject() {
172172 kubectl delete -f demo/specs/imex/channel-injection.yaml
173173 kubectl wait --for=delete pods imex-channel-injection --timeout=10s
174174}
175+
176+
177+ # Run cmd in nvidia-mig-manager pod because that one has highest privileges. I
178+ # use this for example to run `nvcnt gb-nvl-027-compute06 nvidia-smi`
179+ nvmm () {
180+ if [ -z " $1 " ]; then
181+ echo " Usage: nvcnt <node-name> [command...]"
182+ return 1
183+ fi
184+ local node=" $1 "
185+ shift # Remove first argument, leaving remaining args in $@
186+
187+ local pod
188+ pod=$( kubectl get pod -n gpu-operator -l app=nvidia-mig-manager \
189+ --field-selector spec.nodeName=" $node " \
190+ --no-headers -o custom-columns=" :metadata.name" )
191+
192+ if [ -z " $pod " ]; then
193+ echo " No pod found on node $node "
194+ return 1
195+ fi
196+
197+ echo " Executing on pod $pod (node: $node )..."
198+ kubectl -n gpu-operator exec -it " $pod " -- " $@ "
199+ }
You can’t perform that action at this time.
0 commit comments