Skip to content

Commit b5184bc

Browse files
only install istiod when kmesh run e2e test
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
1 parent 18ccbeb commit b5184bc

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

test/e2e/baseline_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,27 +754,27 @@ func TestBookinfo(t *testing.T) {
754754
framework.NewTest(t).Run(func(t framework.TestContext) {
755755
namespace := apps.Namespace.Name()
756756
// Install bookinfo.
757-
if _, err := shell.Execute(true, fmt.Sprintf("kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.22/samples/bookinfo/platform/kube/bookinfo.yaml -n %s", namespace)); err != nil {
757+
if _, err := shell.Execute(true, fmt.Sprintf("kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/bookinfo/platform/kube/bookinfo.yaml -n %s", namespace)); err != nil {
758758
t.Fatalf("failed to install bookinfo: %v", err)
759759
}
760760
t.Cleanup(func() {
761-
if _, err := shell.Execute(true, fmt.Sprintf("kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.22/samples/bookinfo/platform/kube/bookinfo.yaml -n %s", namespace)); err != nil {
761+
if _, err := shell.Execute(true, fmt.Sprintf("kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/bookinfo/platform/kube/bookinfo.yaml -n %s", namespace)); err != nil {
762762
t.Fatalf("failed to delete bookinfo: %v", err)
763763
}
764764
})
765765

766766
// Install sleep as client.
767-
if _, err := shell.Execute(true, fmt.Sprintf("kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.22/samples/sleep/sleep.yaml -n %s", namespace)); err != nil {
767+
if _, err := shell.Execute(true, fmt.Sprintf("kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/sleep/sleep.yaml -n %s", namespace)); err != nil {
768768
t.Fatalf("failed to install sleep as client of bookinfo: %v", err)
769769
}
770770
t.Cleanup(func() {
771-
if _, err := shell.Execute(true, fmt.Sprintf("kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.22/samples/sleep/sleep.yaml -n %s", namespace)); err != nil {
771+
if _, err := shell.Execute(true, fmt.Sprintf("kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/sleep/sleep.yaml -n %s", namespace)); err != nil {
772772
t.Fatalf("failed to delete sleep as client of bookinfo: %v", err)
773773
}
774774
})
775775

776776
fetchFn := testKube.NewSinglePodFetch(t.Clusters().Default(), namespace)
777-
if _, err := testKube.WaitUntilPodsAreReady(fetchFn); err != nil {
777+
if _, err := testKube.WaitUntilPodsAreReady(fetchFn, retry.Timeout(15*time.Minute), retry.Delay(5*time.Second)); err != nil {
778778
t.Fatalf("failed to wait bookinfo pods to be ready: %v", err)
779779
}
780780

@@ -797,7 +797,7 @@ func TestBookinfo(t *testing.T) {
797797
return true
798798
}
799799

800-
if err := retry.Until(checkBookinfo, retry.Timeout(600*time.Second), retry.Delay(1*time.Second)); err != nil {
800+
if err := retry.Until(checkBookinfo, retry.Timeout(900*time.Second), retry.BackoffDelay(3*time.Second)); err != nil {
801801
t.Fatal("failed to access bookinfo correctly: %v", err)
802802
}
803803

@@ -815,7 +815,7 @@ func TestBookinfo(t *testing.T) {
815815
UnsetWaypoint(t, namespace, "", Namespace)
816816
})
817817

818-
if err := retry.Until(checkBookinfo, retry.Timeout(600*time.Second), retry.Delay(1*time.Second)); err != nil {
818+
if err := retry.Until(checkBookinfo, retry.Timeout(900*time.Second), retry.BackoffDelay(3*time.Second)); err != nil {
819819
t.Fatal("failed to access bookinfo correctly when there is a namespace waypoint: %v", err)
820820
}
821821
})

test/e2e/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,5 @@ func deleteWaypointProxy(ctx resource.Context, ns namespace.Instance, name strin
370370
}
371371

372372
return nil
373-
}, retry.Timeout(time.Minute*10), retry.BackoffDelay(time.Millisecond*200))
373+
}, retry.Timeout(time.Minute*10), retry.BackoffDelay(time.Second*1))
374374
}

test/e2e/run_test.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,44 @@ data:
105105
EOF
106106
}
107107

108+
# function setup_istio() {
109+
# echo "install istio $ISTIO_VERSION"
110+
# kubectl get crd gateways.gateway.networking.k8s.io &>/dev/null ||
111+
# { kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.1.0" | kubectl apply -f -; }
112+
113+
# 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
114+
# }
115+
108116
function setup_istio() {
109117
echo "install istio $ISTIO_VERSION"
110118
kubectl get crd gateways.gateway.networking.k8s.io &>/dev/null ||
111119
{ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.1.0" | kubectl apply -f -; }
120+
# install istio CRD
121+
helm repo add istio https://istio-release.storage.googleapis.com/charts
122+
helm repo update
123+
kubectl create namespace istio-system
124+
helm install istio-base istio/base -n istio-system
125+
126+
helm install istiod istio/istiod --namespace istio-system --version $ISTIO_VERSION --set pilot.env.PILOT_ENABLE_AMBIENT=true
127+
128+
while true; do
129+
pod_info=$(kubectl get pods -n istio-system -l app=istiod -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.phase}{"\n"}{end}')
130+
131+
if [ -z "$pod_info" ]; then
132+
echo "No istiod pod found yet, waiting..."
133+
sleep 1
134+
continue
135+
fi
136+
137+
read -r pod_name pod_status <<<"$pod_info"
138+
if [ "$pod_status" = "Running" ]; then
139+
echo "Istiod pod $pod_name is in Running state."
140+
break
141+
fi
112142

113-
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
143+
echo "Waiting for pods of Kmesh daemon to enter Running state..."
144+
sleep 1
145+
done
114146
}
115147

116148
function setup_kmesh() {

0 commit comments

Comments
 (0)