@@ -25,6 +25,7 @@ import (
2525 corev1 "k8s.io/api/core/v1"
2626 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
28+ "github.com/apache/apisix-ingress-controller/internal/provider/adc"
2829 "github.com/apache/apisix-ingress-controller/pkg/utils"
2930 "github.com/apache/apisix-ingress-controller/test/e2e/framework"
3031)
@@ -37,6 +38,8 @@ type APISIXDeployOptions struct {
3738 ServiceType string
3839 ServiceHTTPPort int
3940 ServiceHTTPSPort int
41+
42+ ConfigProvider string
4043}
4144
4245type APISIXDeployer struct {
@@ -187,12 +190,24 @@ func (s *APISIXDeployer) deployDataplane(opts *APISIXDeployOptions) *corev1.Serv
187190 if opts .ServiceHTTPSPort == 0 {
188191 opts .ServiceHTTPSPort = 443
189192 }
193+ opts .ConfigProvider = "yaml"
194+
195+ kubectlOpts := k8s .NewKubectlOptions ("" , "" , opts .Namespace )
196+
197+ if os .Getenv (framework .EnvKeyProviderType ) == adc .BackendModeAPISIX {
198+ // deploy etcd
199+ opts .ConfigProvider = "etcd"
200+ k8s .KubectlApplyFromString (s .GinkgoT , kubectlOpts , framework .EtcdSpec )
201+ err := framework .WaitPodsAvailable (s .GinkgoT , kubectlOpts , metav1.ListOptions {
202+ LabelSelector : "app=etcd" ,
203+ })
204+ Expect (err ).ToNot (HaveOccurred (), "waiting for etcd pod ready" )
205+ }
190206
191207 buf := bytes .NewBuffer (nil )
192208 err := framework .APISIXStandaloneTpl .Execute (buf , opts )
193209 Expect (err ).ToNot (HaveOccurred (), "executing template" )
194210
195- kubectlOpts := k8s .NewKubectlOptions ("" , "" , opts .Namespace )
196211 k8s .KubectlApplyFromString (s .GinkgoT , kubectlOpts , buf .String ())
197212
198213 err = framework .WaitPodsAvailable (s .GinkgoT , kubectlOpts , metav1.ListOptions {
@@ -220,7 +235,7 @@ func (s *APISIXDeployer) deployDataplane(opts *APISIXDeployOptions) *corev1.Serv
220235func (s * APISIXDeployer ) DeployIngress () {
221236 s .Framework .DeployIngress (framework.IngressDeployOpts {
222237 ControllerName : s .opts .ControllerName ,
223- ProviderType : cmp .Or (os .Getenv ("PROVIDER_TYPE" ), "apisix-standalone" ),
238+ ProviderType : cmp .Or (os .Getenv (framework . EnvKeyProviderType ), "apisix-standalone" ),
224239 ProviderSyncPeriod : 200 * time .Millisecond ,
225240 Namespace : s .namespace ,
226241 Replicas : 1 ,
@@ -230,7 +245,7 @@ func (s *APISIXDeployer) DeployIngress() {
230245func (s * APISIXDeployer ) ScaleIngress (replicas int ) {
231246 s .Framework .DeployIngress (framework.IngressDeployOpts {
232247 ControllerName : s .opts .ControllerName ,
233- ProviderType : cmp .Or (os .Getenv ("PROVIDER_TYPE" ), "apisix-standalone" ),
248+ ProviderType : cmp .Or (os .Getenv (framework . EnvKeyProviderType ), "apisix-standalone" ),
234249 ProviderSyncPeriod : 200 * time .Millisecond ,
235250 Namespace : s .namespace ,
236251 Replicas : replicas ,
0 commit comments