Skip to content

Commit

Permalink
fix: cannot uninstall spiderpool when sriovOperatorConfig is installed
Browse files Browse the repository at this point in the history
Signed-off-by: tao.yang <[email protected]>
  • Loading branch information
ty-dc committed Sep 6, 2024
1 parent a0a9f87 commit b67c078
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/auto-upgrade-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,17 @@ jobs:
id: upgrade
continue-on-error: true
run: |
RESULT=0
make upgrade_e2e_spiderpool -e E2E_CLUSTER_NAME=${{ env.E2E_CLUSTER_NAME }} \
-e E2E_SPIDERPOOL_TAG=${{ needs.call_build_new_ci_image.outputs.imageTag }} \
-e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \
-e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race
-e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race || RESULT=1
if ((RESULT==0)) ; then
echo "succeeded to upgrade spiderpool from ${{ needs.get_ref.outputs.old_version }} to ${{ needs.get_ref.outputs.new_version }}"
else
echo "failed to upgrade spiderpool from ${{ needs.get_ref.outputs.old_version }} to ${{ needs.get_ref.outputs.new_version }}"
exit 1
fi
- name: Run e2e Test on ${{ needs.get_ref.outputs.new_version }}
id: run_e2e
Expand Down
32 changes: 13 additions & 19 deletions .github/workflows/e2e-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ jobs:
with:
go-version: 1.21.4

# https://github.com/helm/kind-action
- name: Install Kind Bin
uses: helm/[email protected]
with:
install_only: true

- name: Install Tools
run: |
# install kind/p2ctl/helm/ginkgo
Expand Down Expand Up @@ -204,22 +198,10 @@ jobs:
path: e2ereport.json
retention-days: 1

- name: helm uninstalls spiderpool and cleans spiderpool CRD
id: clean
if: ${{ inputs.run_e2e == 'true' }}
run: |
RESULT=0
make clean_e2e_spiderpool || RESULT=1
if ((RESULT==0)) ; then
echo "CLEAN_E2E_PASS=true" >> $GITHUB_ENV
else
echo "CLEAN_E2E_PASS=false" >> $GITHUB_ENV
fi
- name: Show e2e Result
if: ${{ inputs.run_e2e == 'true' }}
run: |
if ${{ env.RUN_E2E_PASS == 'true' && env.CLEAN_E2E_PASS == 'true' }} ;then
if ${{ env.RUN_E2E_PASS == 'true' }} ;then
exit 0
else
exit 1
Expand Down Expand Up @@ -248,3 +230,15 @@ jobs:
label: performance
message: ${{ env.PERFORMANCE_RESULT }}
color: lightgrey

- name: helm uninstalls spiderpool and cleans spiderpool CRD
id: clean
if: ${{ inputs.run_e2e == 'true' }}
run: |
RESULT=0
make clean_e2e_spiderpool || RESULT=1
if ((RESULT==0)) ; then
echo "succeeded to uninstall spiderpool"
else
echo "failed to uninstall spiderpool"
fi
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ clean: clean_e2e

.PHONY: clean_e2e_spiderpool
clean_e2e_spiderpool:
-$(QUIET) make -C test uninstall_spiderpool
$(QUIET) make -C test uninstall_spiderpool

.PHONY: upgrade_e2e_spiderpool
upgrade_e2e_spiderpool:
-$(QUIET) make -C test upgrade_spiderpool
$(QUIET) make -C test upgrade_spiderpool

.PHONY: codegen
codegen:
Expand Down
1 change: 1 addition & 0 deletions charts/spiderpool/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ rules:
- cronjobs
- jobs
verbs:
- delete
- get
- list
- update
Expand Down
11 changes: 6 additions & 5 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ clean_spiderpool_crd:
@-$(QUIET) export KUBECONFIG=$(E2E_KUBECONFIG); $(ROOT_DIR)/tools/scripts/cleanCRD.sh
@ALL_CRD=`kubectl get crd -n $(RELEASE_NAMESPACE) --kubeconfig $(E2E_KUBECONFIG) | awk '{print $$1 } ' ` ; FAIL="false" ; \
for CRD in $$ALL_CRD ; do \
echo $${CRD} | grep -q 'spiderpool.spidernet.io' && FAIL="true" && echo "error, failed to clean spiderpool crd: $${CRD}" ; \
echo $${CRD} | grep -q -E 'spiderpool.spidernet.io|sriovnetwork.openshift.io' && FAIL="true" && echo "error, failed to clean spiderpool crd: $${CRD}" ; \
if [ "$$FAIL" == "true" ] ; then \
echo -e "\033[35m [===== describe crd: $${CRD} =====] \033[0m" ; \
kubectl describe crd $${CRD} --kubeconfig $(E2E_KUBECONFIG) ; \
Expand All @@ -379,20 +379,21 @@ clean_spiderpool_crd:
[ "$$FAIL" == "true" ] && echo "spiderpool crd cleanup failed" && exit 1 ; \
echo -e "\033[35m [done] all spiderpool crd cleaned up !!! \033[0m"

.PHONY: helm_uninstall_spiderpool
helm_uninstall_spiderpool:
.PHONY: uninstall_spiderpool
uninstall_spiderpool:
@echo -e "\033[35m [helm uninstall spiderpool] \033[0m"
helm uninstall $(RELEASE_NAME) --wait --debug -n $(RELEASE_NAMESPACE) \
--kubeconfig $(E2E_KUBECONFIG) || { KIND_CLUSTER_NAME=$(E2E_CLUSTER_NAME) ./scripts/debugEnv.sh $(E2E_KUBECONFIG) "detail" ; exit 1 ; } ; \
echo "Multus config has been cleanup successfully." ; \
for ((i=0; i<100; i++)); do \
if ! kubectl --kubeconfig=$(E2E_KUBECONFIG) get all --all-namespaces | grep -q "spiderpool" ; then \
echo "All resources successfully cleared." ; \
echo "All Spiderpool Pod successfully cleared." ; \
exit 0; \
fi ;\
echo "found spiderpool resources, waiting..." ; \
echo "found spiderpool pod, waiting..." ; \
sleep 1 ; \
done; \
make clean_spiderpool_crd ; \
echo "error: found spiderpool resources" ; exit 1 ;
@echo "check cni conf removed from nodes: $(POST_UNINSTALL_CHECK_CNI_CONF) " ; \
NODE_LIST=` docker ps | egrep "kindest/node.* $(E2E_CLUSTER_NAME)-(control|worker)" | awk '{print $$1 }' ` ; \
Expand Down
6 changes: 5 additions & 1 deletion test/scripts/debugEnv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ elif [ "$TYPE"x == "detail"x ] ; then
echo "${ERROR_POD}"
for LINE in ${ERROR_POD}; do
NS_NAME=${LINE//,/ }
echo "---------------error pod: ${NS_NAME}------------"
echo "---------------describe error pod: ${NS_NAME}------------"
kubectl describe pod -n ${NS_NAME} --kubeconfig ${E2E_KUBECONFIG}
echo "---------------logs error pod: ${NS_NAME}------------"
kubectl logs -n ${NS_NAME} --kubeconfig ${E2E_KUBECONFIG}
echo "---------------logs error pod: ${NS_NAME} --previous------------"
kubectl logs -n ${NS_NAME} --kubeconfig ${E2E_KUBECONFIG} --previous
done
fi

Expand Down

0 comments on commit b67c078

Please sign in to comment.