Skip to content

Commit

Permalink
fix the issue that the node cannot be removed after ECS is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
chengxiangdong committed Aug 19, 2024
1 parent d602479 commit 4a582c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: run e2e
run: |
export ARTIFACTS_PATH=${{ github.workspace }}/e2e-logs
sh hack/run-e2e.sh
./hack/run-e2e.sh
- name: upload logs
if: always()
uses: actions/upload-artifact@v3
Expand Down
18 changes: 11 additions & 7 deletions hack/pre-run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ export REGISTRY_SERVER_ADDRESS=swr.ap-southeast-1.myhuaweicloud.com
export REGISTRY=${REGISTRY_SERVER_ADDRESS}/cloud-native
export VERSION=v$(echo $RANDOM | sha1sum |cut -c 1-5)

echo -e "\nCheck KUBECONFIG"
echo "KUBECONFIG="$KUBECONFIG

echo -e "\nCheck cloud-config secret"
kubectl get -n kube-system secret
count=$(kubectl get -n kube-system secret | grep cloud-config | wc -l)
if [[ "$count" -ne 1 ]]; then
echo "Please create the cloud-config secret."
exit 1
fi

echo -e "\nBuild images"
# todo: Maybe we need load the image to target cluster node.
make image-huawei-cloud-controller-manager
Expand All @@ -35,13 +46,6 @@ if [[ -x ${is_containerd} ]]; then
rm -rf ${tmpPath}/huawei-cloud-controller-manager.tar
fi

echo -e "\nCheck cloud-config secret"
count=`kubectl get -n kube-system secret cloud-config | grep cloud-config | wc -l`
if [[ "$count" -ne 1 ]]; then
echo "Please create the cloud-config secret."
exit 1
fi

# Remove the existing provider if it exists.
kubectl delete -n kube-system deployment --ignore-not-found=true huawei-cloud-controller-manager

Expand Down
3 changes: 2 additions & 1 deletion pkg/cloudprovider/huaweicloud/wrapper/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ func (e *EcsClient) GetByNodeName(name string) (*model.ServerDetail, error) {
return nil, err
}

notFound := fmt.Errorf("not found any ECS, node: %s, PrivateIP: %s", name, privateIP)
notFound := status.Errorf(codes.NotFound, "not found any ECS, node: %s, PrivateIP: %s", name, privateIP)
if rsp.Servers == nil || len(*rsp.Servers) == 0 {
klog.Errorf("not found any ECS, node: %s, PrivateIP: %s", name, privateIP)
return nil, notFound
}

Expand Down

0 comments on commit 4a582c5

Please sign in to comment.