-
Notifications
You must be signed in to change notification settings - Fork 2
/
install-local-chart.sh
34 lines (28 loc) · 1.15 KB
/
install-local-chart.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
#!/bin/bash
# For more information, see https://docs.nvidia.com/datacenter/cloud-native/kubernetes/dcgme2e.html
# Also look at https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/etc/dcgm-exporter/default-counters.csv for metrics
namespace="dcgm-exporter"
chartName="./dcgm-exporter"
releaseName="dcgm-exporter"
# check if namespace exists in the cluster
result=$(kubectl get ns -o jsonpath="{.items[?(@.metadata.name=='$namespace')].metadata.name}")
if [[ -n $result ]]; then
echo "$namespace namespace already exists in the cluster"
else
echo "$namespace namespace does not exist in the cluster"
echo "creating $namespace namespace in the cluster..."
kubectl create namespace $namespace
fi
# Install Helm chart
result=$(helm list -n $namespace | grep $releaseName | awk '{print $1}')
if [[ -n $result ]]; then
echo "[$releaseName] already exists in the [$namespace] namespace"
else
# Install the Helm chart
echo "Deploying [$releaseName] to the [$namespace] namespace..."
helm install $releaseName $chartName \
--namespace $namespace \
--values values.yaml
fi
# List pods
kubectl get pods -n $namespace -o wide