@@ -148,6 +148,7 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) {
148148 ForIngressGatewayGroup : true ,
149149 ServiceHTTPPort : 9080 ,
150150 ServiceHTTPSPort : 9443 ,
151+ Replicas : ptr .To (1 ),
151152 }
152153 if deployOpts .Namespace != "" {
153154 opts .Namespace = deployOpts .Namespace
@@ -164,13 +165,22 @@ func (s *API7Deployer) DeployDataplane(deployOpts DeployDataplaneOptions) {
164165 if deployOpts .Replicas != nil {
165166 opts .Replicas = deployOpts .Replicas
166167 }
168+ if opts .Replicas != nil && * opts .Replicas == 0 {
169+ deployOpts .SkipCreateTunnels = true
170+ }
167171
168- svc := s .DeployGateway (opts )
172+ for _ , close := range []func (){
173+ s .closeApisixHttpTunnel ,
174+ s .closeApisixHttpsTunnel ,
175+ } {
176+ close ()
177+ }
169178
179+ svc := s .DeployGateway (& opts )
170180 s .dataplaneService = svc
171181
172182 if ! deployOpts .SkipCreateTunnels {
173- err := s .newAPISIXTunnels ()
183+ err := s .newAPISIXTunnels (opts . ServiceName )
174184 Expect (err ).ToNot (HaveOccurred (), "creating apisix tunnels" )
175185 }
176186}
@@ -181,8 +191,7 @@ func (s *API7Deployer) ScaleDataplane(replicas int) {
181191 })
182192}
183193
184- func (s * API7Deployer ) newAPISIXTunnels () error {
185- serviceName := "api7ee3-apisix-gateway-mtls"
194+ func (s * API7Deployer ) newAPISIXTunnels (serviceName string ) error {
186195 httpTunnel , httpsTunnel , err := s .createDataplaneTunnels (s .dataplaneService , s .kubectlOptions , serviceName )
187196 if err != nil {
188197 return err
@@ -247,7 +256,7 @@ func (s *API7Deployer) CreateAdditionalGateway(namePrefix string) (string, *core
247256 serviceName := fmt .Sprintf ("api7ee3-apisix-gateway-%s" , namePrefix )
248257
249258 // Deploy dataplane for this gateway group
250- svc := s .DeployGateway (framework.API7DeployOptions {
259+ svc := s .DeployGateway (& framework.API7DeployOptions {
251260 GatewayGroupID : gatewayGroupID ,
252261 Namespace : additionalNS ,
253262 Name : serviceName ,
0 commit comments