Skip to content

Commit a73ea72

Browse files
authored
added workaround to handle the faulted node deletion (#27)
* added sleep Signed-off-by: Marcel Bindseil <[email protected]> --------- Signed-off-by: Marcel Bindseil <[email protected]>
1 parent 4d2dcc6 commit a73ea72

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.github/workflows/build-vm.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,15 @@ jobs:
205205
--publisher Microsoft.Azure.Extensions \
206206
--force-update \
207207
--protected-settings "{\"commandToExecute\": \" \
208+
sudo chmod -R 777 /etc/rancher/k3s/k3s.yaml && \
208209
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && \
209210
kubectl config use-context default && \
210211
kubectl get pods -A -v6 && \
211212
az login --service-principal -u ${{ secrets.AZURE_SP_CLIENT_ID }} -p \"\"${{ secrets.AZURE_SP_CLIENT_SECRET }}\"\" --tenant $tenantId && \
212213
az extension add --name connectedk8s --yes && \
213214
az extension add --name azure-iot-ops --yes && \
215+
sleep 1m && \
216+
kubectl delete node \$(kubectl get nodes | grep NotReady | awk '{print \$1}') && \
214217
az connectedk8s connect --debug -n $clusterName -l $location -g $resourceGroup --subscription $subscriptionId && \
215218
az connectedk8s enable-features --debug -n $clusterName -g $resourceGroup --custom-locations-oid \"\"${{ secrets.CUSTOM_LOCATIONS_OBJECT_ID }}\"\" --features cluster-connect custom-locations && \
216219
saId=\$(az storage account create -n $saName -g $resourceGroup --enable-hierarchical-namespace -o tsv --query id) && \

vm.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
az vm extension set \
4+
--resource-group rg-arc-vmnext \
5+
--vm-name arc-vmnext \
6+
--name customScript \
7+
--publisher Microsoft.Azure.Extensions \
8+
--force-update \
9+
--protected-settings "{\"commandToExecute\": \" \
10+
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && \
11+
notReadyNotes=\$(kubectl get nodes | grep NotReady | awk '{print \$1}' 2>/dev/null) && \
12+
len=\${#notReadyNotes} && \
13+
echo \"\"not ready\$len\"\" && \
14+
if [[ -z \$notReadyNotes ]]; then echo \"\"xxxx\"\" && kubectl delete node \"\"\$notReadyNotes\"\"; fi && \
15+
kubectl config use-context default && \
16+
kubectl get pods -A -v6 \
17+
\"}"
18+

0 commit comments

Comments
 (0)