# install Helm
sudo snap install helm --classic

# add nvidia Helm charts repo
helm repo add nvidia https://mellanox.github.io/network-operator
helm repo update

# install NVidia Network Operator
cat > network-operator-values.yaml <<EOF
nfd:
  enabled: true

# NicClusterPolicy CR values:
deployCR: true
ofedDriver:
  deploy: false

rdmaSharedDevicePlugin:
  deploy: true
  resources:
    - name: rdma_shared_device_a
      drivers: ["mlx5_core"]

nvPeerDriver:
  deploy: false

secondaryNetwork:
  deploy: true
  cniPlugins:
    deploy: true
  multus:
    deploy: true
  ipamPlugin:
    deploy: true

# to remove node affinity in multus ds
nodeAffinity:
  preferredDuringSchedulingIgnoredDuringExecution:
  - weight: 1
    preference:
      matchExpressions:
      - key: node-role.kubernetes.io/master
        operator: DoesNotExist
      - key: node-role.kubernetes.io/control-plane
        operator: DoesNotExist
EOF

helm install -n network-operator --create-namespace \
  -f network-operator-values.yaml --wait --version 1.4.0 \
  network-operator nvidia/network-operator

# check network operator pods
kubectl -n network-operator get pods
