@@ -15,12 +15,12 @@ package adc
1515import (
1616 "context"
1717 "encoding/json"
18- "errors"
1918 "os"
2019 "sync"
2120 "time"
2221
2322 "github.com/api7/gopkg/pkg/log"
23+ "github.com/pkg/errors"
2424 "go.uber.org/zap"
2525 networkingv1 "k8s.io/api/networking/v1"
2626 "sigs.k8s.io/controller-runtime/pkg/client"
@@ -48,6 +48,7 @@ type BackendMode string
4848const (
4949 BackendModeAPISIXStandalone string = "apisix-standalone"
5050 BackendModeAPI7EE string = "api7ee"
51+ BackendModeAPISIX string = "apisix"
5152)
5253
5354type adcClient struct {
@@ -185,11 +186,21 @@ func (d *adcClient) Update(ctx context.Context, tctx *provider.TranslateContext,
185186 }
186187 }
187188
188- // This mode is full synchronization,
189- // which only needs to be saved in cache
190- // and triggered by a timer for synchronization
191- if d .BackendMode == BackendModeAPISIXStandalone || apiv2 .Is (obj ) {
189+ switch d .BackendMode {
190+ case BackendModeAPISIXStandalone :
191+ // This mode is full synchronization,
192+ // which only needs to be saved in cache
193+ // and triggered by a timer for synchronization
192194 return nil
195+ case BackendModeAPISIX :
196+ // sync by apisix admin api
197+ case BackendModeAPI7EE :
198+ // apiv2 is not support on api7ee mode
199+ if apiv2 .Is (obj ) {
200+ return nil
201+ }
202+ default :
203+ return errors .Errorf ("unknown backend mode: %s" , d .BackendMode )
193204 }
194205
195206 return d .sync (ctx , Task {
0 commit comments