Skip to content

Commit

Permalink
debug pr auto upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: ty-dc <[email protected]>
  • Loading branch information
ty-dc committed Jun 13, 2024
1 parent 7f02642 commit 4d8ae30
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 31 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/auto-upgrade-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,9 @@ jobs:
elif ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo "RUN_TAG=${{ github.sha }}" >> $GITHUB_ENV
echo "NEW_VERSION=${{ github.sha }}" >> $GITHUB_ENV
# for PR scenarios, the latest version of the main branch will be used as old-version
echo "OLD_VERSION=main" >> $GITHUB_ENV
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo "RUN_TAG=${{ github.sha }}" >> $GITHUB_ENV
echo "NEW_VERSION=${{ github.sha }}" >> $GITHUB_ENV
# for PR scenarios, the latest version of the main branch will be used as old-version
echo "OLD_VERSION=main" >> $GITHUB_ENV
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV
else
# schedule event
# use main sha for ci image tag
Expand Down Expand Up @@ -123,6 +115,19 @@ jobs:
run: |
ref=$( git show -s --format='format:%H')
echo "RUN_REF=${ref}" >> $GITHUB_ENV
if ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo "NEW_VERSION=${{ github.sha }}" >> $GITHUB_ENV
# for PR scenarios, the latest version of the main branch will be used as old-version
echo "OLD_VERSION=main" >> $GITHUB_ENV
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo "NEW_VERSION=${{ github.sha }}" >> $GITHUB_ENV
# for PR scenarios, the latest version of the main branch will be used as old-version
echo "OLD_VERSION=main" >> $GITHUB_ENV
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV
fi
call_build_ci_image:
needs: [get_ref]
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipam/pool_selections.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (i *ipam) getPoolCandidates(ctx context.Context, addArgs *models.IpamAddArg
} else {
hasSubnetsAnnotation := applicationinformers.HasSubnetsAnnotation(pod.Annotations)
if hasSubnetsAnnotation {
return nil, fmt.Errorf("it's invalid to use '%s' or '%s' annotation when Auto-Pool feature is disabled", constant.AnnoSpiderSubnets, constant.AnnoSpiderSubnet)
return nil, fmt.Errorf("'%s' or '%s' annotation when Auto-Pool feature is disabled", constant.AnnoSpiderSubnets, constant.AnnoSpiderSubnet)
}
}
}
Expand Down
44 changes: 23 additions & 21 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -409,32 +409,34 @@ helm_upgrade_spiderpool:
HELM_OPTION+=" --set multus.multusCNI.defaultCniCRName=$(MULTUS_DEFAULT_CNI_VLAN0) " ; \
fi ; \
HELM_OPTION+=" --set spiderpoolAgent.image.registry="" \
--set spiderpoolAgent.image.repository=$(SPIDERPOOL_AGENT_IMAGE_NAME) \
--set spiderpoolAgent.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set spiderpoolController.image.registry="" \
--set spiderpoolController.image.repository=$(SPIDERPOOL_CONTROLLER_IMAGE_NAME) \
--set spiderpoolController.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set spiderpoolInit.image.registry="" \
--set spiderpoolInit.image.repository=$(SPIDERPOOL_CONTROLLER_IMAGE_NAME) \
--set spiderpoolInit.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set multus.multusCNI.uninstall=false " \
ALL_IMAGES=`helm template $(RELEASE_NAME) $(ROOT_DIR)/charts/spiderpool $${HELM_OPTION} | grep ' image: ' | tr -d '"' | awk -F 'image: ' '{print $$2}' | sort | uniq | tr '\n' ' '` ; \
echo "ALL_IMAGES: $${ALL_IMAGES} " ; \
for IMAGE in $${ALL_IMAGES}; do \
if ! grep "$${IMAGE}" <<< `docker images | awk '{printf("%s:%s\n",$$1,$$2)}'`; then \
echo "==> $${IMAGE} no found, pulling...." ; \
docker pull $${IMAGE} ; \
fi ; \
kind load docker-image $${IMAGE} --name $(E2E_CLUSTER_NAME); \
done ; \
echo "upgrade spiderpool with image $(SPIDERPOOL_AGENT_IMAGE_NAME):$(E2E_SPIDERPOOL_TAG) and $(SPIDERPOOL_CONTROLLER_IMAGE_NAME):$(E2E_SPIDERPOOL_TAG) " ; \
set -x ; \
helm --kubeconfig $(E2E_KUBECONFIG) upgrade $(RELEASE_NAME) $(ROOT_DIR)/charts/spiderpool $${HELM_OPTION} \
--set spiderpoolAgent.image.repository=$(SPIDERPOOL_AGENT_IMAGE_NAME) \
--set spiderpoolAgent.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set spiderpoolController.image.registry="" \
--set spiderpoolController.image.repository=$(SPIDERPOOL_CONTROLLER_IMAGE_NAME) \
--set spiderpoolController.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set spiderpoolInit.image.registry="" \
--set spiderpoolInit.image.repository=$(SPIDERPOOL_CONTROLLER_IMAGE_NAME) \
--set spiderpoolInit.image.tag=$(E2E_SPIDERPOOL_TAG) \
--set multus.multusCNI.uninstall=false " \
ALL_IMAGES=`helm template $(RELEASE_NAME) $(ROOT_DIR)/charts/spiderpool $${HELM_OPTION} | grep ' image: ' | tr -d '"' | awk -F 'image: ' '{print $$2}' | sort | uniq | tr '\n' ' '` ; \
echo "ALL_IMAGES: $${ALL_IMAGES} " ; \
for IMAGE in $${ALL_IMAGES}; do \
if ! grep "$${IMAGE}" <<< `docker images | awk '{printf("%s:%s\n",$$1,$$2)}'`; then \
echo "==> $${IMAGE} no found, pulling...." ; \
docker pull $${IMAGE} ; \
fi ; \
kind load docker-image $${IMAGE} --name $(E2E_CLUSTER_NAME); \
done ; \
echo "upgrade spiderpool with image $(SPIDERPOOL_AGENT_IMAGE_NAME):$(E2E_SPIDERPOOL_TAG) and $(SPIDERPOOL_CONTROLLER_IMAGE_NAME):$(E2E_SPIDERPOOL_TAG) " ; \
set -x ; \
helm --kubeconfig $(E2E_KUBECONFIG) upgrade $(RELEASE_NAME) $(ROOT_DIR)/charts/spiderpool \
$${HELM_OPTION} \
-n $(RELEASE_NAMESPACE) --debug --reuse-values ; \
cd $(ROOT_DIR)/charts/spiderpool/crds ; \
ls | grep '\.yaml$$' | xargs -I {} kubectl apply -f {} --kubeconfig $(E2E_KUBECONFIG) ; \
kubectl wait --for=condition=ready -l app.kubernetes.io/instance=spiderpool --timeout=300s pod -n $(RELEASE_NAMESPACE) --kubeconfig $(E2E_KUBECONFIG) || true; \
kubectl scale deploy -n $(RELEASE_NAMESPACE) -l app.kubernetes.io/component=spiderpool-controller --replicas=2 --kubeconfig $(E2E_KUBECONFIG); \
kubectl get po -n $(RELEASE_NAMESPACE) -l app.kubernetes.io/instance=spiderpool -oyaml --kubeconfig $(E2E_KUBECONFIG) | grep image ; \
kubectl wait --for=condition=ready -l app.kubernetes.io/component=spiderpool-controller --timeout=300s pod -n $(RELEASE_NAMESPACE) --kubeconfig $(E2E_KUBECONFIG) || true; \
helm --kubeconfig $(E2E_KUBECONFIG) list -A ; \

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/reliability/reliability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func checkMetrics(ctx context.Context, metricsPort string) error {

nodeList, err := frame.GetNodeList()
if err != nil {
return fmt.Errorf("failed to get node information")
return fmt.Errorf("Failed to get node information")
}

var metricsHealthyCheck string
Expand Down

0 comments on commit 4d8ae30

Please sign in to comment.