[clean] only install istiod when kmesh run e2e test#1524
[clean] only install istiod when kmesh run e2e test#1524kmesh-bot merged 3 commits intokmesh-net:mainfrom
Conversation
Summary of ChangesHello @LiZhenCheng9527, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Istio installation process within the Kmesh end-to-end test suite. The primary goal is to streamline the test environment setup by transitioning from Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Helm charts now deploy, Istiod waits, running free, Tests run smooth and fast. Footnotes
|
d869bd1 to
31aacdf
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the Istio installation in the e2e test script to use Helm instead of istioctl. The changes are a good cleanup, but I've found a couple of critical issues in the new implementation that could cause the script to fail or hang. My review includes suggestions to make the script more robust and idempotent.
| helm repo add istio https://istio-release.storage.googleapis.com/charts | ||
| helm repo update |
There was a problem hiding this comment.
The kubectl create namespace command will fail if the istio-system namespace already exists, as set -e is enabled at the top of the script. This will cause the script to exit prematurely. Instead of creating the namespace manually, you can use the --create-namespace flag with helm install, which will create the namespace if it doesn't exist and do nothing if it does. This is a more idempotent and robust approach.
| helm repo add istio https://istio-release.storage.googleapis.com/charts | |
| helm repo update | |
| helm install istio-base istio/base -n istio-system --create-namespace |
test/e2e/run_test.sh
Outdated
| helm install istiod istio/istiod --namespace istio-system --version $ISTIO_VERSION --set pilot.env.PILOT_ENABLE_AMBIENT=true | ||
|
|
||
| while true; do | ||
| pod_info=$(kubectl get pods -n istio-system -l app=istiod -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.phase}{"\n"}{end}') | ||
|
|
||
| if [ -z "$pod_info" ]; then | ||
| echo "No istiod pod found yet, waiting..." | ||
| sleep 1 | ||
| continue | ||
| fi | ||
|
|
||
| read -r pod_name pod_status <<< "$pod_info"; | ||
| if [ "$pod_status" = "Running" ]; then | ||
| echo "Istiod pod $pod_name is in Running state." | ||
| break | ||
| fi | ||
|
|
||
| istioctl install --set profile=ambient --set meshConfig.accessLogFile="/dev/stdout" --set components.ingressGateways[0].enabled=true --set components.ingressGateways[0].name=istio-ingressgateway --skip-confirmation | ||
| echo "Waiting for pods of Kmesh daemon to enter Running state..." |
There was a problem hiding this comment.
This while loop has a few issues:
- No Timeout: It could loop indefinitely if the
istiodpod fails to start, causing the script to hang. It's crucial to have a timeout. - Incorrect State Check: It checks for the
Runningstatus, but a pod can beRunningwithout being ready to serve traffic (e.g., if readiness probes are failing). It's more reliable to wait for theReadycondition. - Misleading Log Message: The log message on line 141 is incorrect. It refers to
Kmesh daemoninstead ofistiod.
Using kubectl wait is a much more robust and idiomatic way to wait for a pod to be ready. It addresses all these points.
| helm install istiod istio/istiod --namespace istio-system --version $ISTIO_VERSION --set pilot.env.PILOT_ENABLE_AMBIENT=true | |
| while true; do | |
| pod_info=$(kubectl get pods -n istio-system -l app=istiod -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.phase}{"\n"}{end}') | |
| if [ -z "$pod_info" ]; then | |
| echo "No istiod pod found yet, waiting..." | |
| sleep 1 | |
| continue | |
| fi | |
| read -r pod_name pod_status <<< "$pod_info"; | |
| if [ "$pod_status" = "Running" ]; then | |
| echo "Istiod pod $pod_name is in Running state." | |
| break | |
| fi | |
| istioctl install --set profile=ambient --set meshConfig.accessLogFile="/dev/stdout" --set components.ingressGateways[0].enabled=true --set components.ingressGateways[0].name=istio-ingressgateway --skip-confirmation | |
| echo "Waiting for pods of Kmesh daemon to enter Running state..." | |
| if ! kubectl wait pod --for=condition=Ready -l app=istiod -n istio-system --timeout=5m; then | |
| echo "Error: istiod pod failed to become ready in time." | |
| kubectl logs -n istio-system -l app=istiod | |
| exit 1 | |
| fi | |
| echo "Istiod pod is ready." |
31aacdf to
4d76bf9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
3849bc0 to
2a48064
Compare
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
4a330e1 to
b298bb6
Compare
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
b298bb6 to
a3d2f92
Compare
fe941b3 to
8c7b076
Compare
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
8c7b076 to
902e737
Compare
|
Our document should also be updated |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: