1717 - describe :
1818 apiVersion : v1
1919 kind : Service
20+
2021 - name : Check that loadbalancer ip is assigned
2122 try :
2223 - assert :
9596 echo "Error: No reserved ip found in configmap"
9697 fi
9798
99+ nb_id=$(kubectl get configmap nb-config -o=jsonpath='{.data.NB_ID}' -n $NAMESPACE)
100+ if [ -z "$nb_id" ]; then
101+ echo "Error: No nb id found in configmap"
102+ fi
103+
98104 delete_rip=$(curl -s --request DELETE \
99105 -H "Authorization: Bearer $LINODE_TOKEN" \
100106 -H "Content-Type: application/json" \
@@ -106,6 +112,17 @@ spec:
106112 echo "Unable to delete reserved ip: $reserved_ip. Error: $delete_rip"
107113 fi
108114
115+ del_nb=$(curl -s --request DELETE \
116+ -H "Authorization: Bearer $LINODE_TOKEN" \
117+ -H "Content-Type: application/json" \
118+ "${LINODE_URL}/v4beta/nodebalancers/$nb_id" )
119+
120+ if [[ "$del_nb" == "{}" ]]; then
121+ echo "NB $nb_id deleted successfully"
122+ else
123+ echo "Unable to delete NB: $nb_id. Error: $del_nb"
124+ fi
125+
109126 delete_cm=$(kubectl delete configmap nb-config -n $NAMESPACE)
110127 if [[ "$delete_cm" == "configmap \"nb-config\" deleted" ]]; then
111128 echo "Configmap deleted successfully"
@@ -117,6 +134,8 @@ spec:
117134 (contains($stdout, 'No reserved ip found in configmap')) : false
118135 (contains($stdout, 'Unable to delete the configmap')) : false
119136 (contains($stdout, 'Unable to delete reserved ip')) : false
137+ (contains($stdout, 'No nb id found in configmap')) : false
138+ (contains($stdout, 'Unable to delete NB')) : false
120139 - name : Check that loadbalancer ip is assigned
121140 try :
122141 - assert :
0 commit comments