-
Notifications
You must be signed in to change notification settings - Fork 5
/
kubevirt.sh
36 lines (31 loc) · 1.4 KB
/
kubevirt.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
#!/bin/bash
kubectl create namespace kubevirt
echo "Activate DataVolumes feature gate"
cat <<EOF | kubectl create -f -
apiVersion: v1
data:
feature-gates: DataVolumes
kind: ConfigMap
metadata:
name: kubevirt-config
namespace: kubevirt
EOF
echo "Deploy kubevirt"
export KUBEVIRT_RELEASE=$(curl --silent "https://api.github.com/repos/kubevirt/kubevirt/releases/latest" | grep '"tag_name":'| sed -E 's/.*"([^"]+)".*/\1/')
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/$KUBEVIRT_RELEASE/kubevirt-operator.yaml
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/$KUBEVIRT_RELEASE/kubevirt-cr.yaml
#kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_RELEASE}/kubevirt.yaml
curl -s -Lo virtctl \
https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_RELEASE}/virtctl-${KUBEVIRT_RELEASE}-linux-amd64
chmod +x virtctl
sudo mv virtctl /usr/local/bin/
# wait until kubevirt is stated
echo "wait for kubevirt to be started"
#operator
kubectl wait --timeout=300s --for=condition=Ready -n kubevirt pod -l kubevirt.io=virt-operator
#api
kubectl wait --timeout=300s --for=condition=Ready -n kubevirt pod -l kubevirt.io=virt-api
#handler
kubectl wait --timeout=300s --for=condition=Ready -n kubevirt pod -l kubevirt.io=virt-handler
#controller
kubectl wait --timeout=300s --for=condition=Ready -n kubevirt pod -l kubevirt.io=virt-controller