-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnvidia-gpu-operator-setup.sh
executable file
·54 lines (40 loc) · 1.28 KB
/
nvidia-gpu-operator-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
source logging.sh
## uninstall gpu-operator
div
log_good "Removing existing NVIDIA GPU Operator..."
div
kubectl get namespace gpu-operator &>/dev/null || kubectl create namespace gpu-operator
helm uninstall nvidia-gpu-operator -n gpu-operator
if [[ "$?" -eq 0 ]]; then
div
log "Helm uninstallation of gpu-operator failed. See setup guide for more details."
fi
## Wait until no pods in the gpu-operator namespace
while true; do
# Get the output of kubectl get pods
output=$(kubectl get pods -n gpu-operator 2>&1)
# Check if the output contains "No resources"
if [[ $output == *"No resources"* ]]; then
div
log "No resources found in the gpu-operator namespace. Exiting loop."
break
else
div
log "Pods found in the gpu-operator namespace:"
log $output
log "Waiting 5s for termination..."
fi
# Wait for a short interval before checking again
sleep 5
done
div
log_good "Upgrading helm installation..."
div
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
div
log_good "Installing NVIDIA GPU Operator..."
div
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia &&
helm repo update &&
helm install -n gpu-operator --wait nvidia-gpu-operator nvidia/gpu-operator --version 'v24.3.0' -f gpu-operator-values.yaml