Skip to content

Commit 9ed3758

Browse files
committed
resolve comments
1 parent e9df775 commit 9ed3758

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

internal/controller/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ func (c *Config) Validate() error {
113113

114114
func validateProvider(config ProviderConfig) error {
115115
switch config.Type {
116-
case ProviderTypeStandalone:
116+
case ProviderTypeStandalone, ProviderTypeAPISIX:
117117
if config.SyncPeriod.Duration <= 0 {
118118
return fmt.Errorf("sync_period must be greater than 0 for standalone provider")
119119
}
120120
return nil
121-
case ProviderTypeAPI7EE, ProviderTypeAPISIX:
121+
case ProviderTypeAPI7EE:
122122
return nil
123123
default:
124124
return fmt.Errorf("unsupported provider type: %s", config.Type)

internal/provider/adc/adc.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,11 @@ func (d *adcClient) Update(ctx context.Context, tctx *provider.TranslateContext,
186186
}
187187
}
188188

189-
switch d.BackendMode {
190-
case BackendModeAPI7EE:
191-
if apiv2.Is(obj) {
192-
return nil
193-
}
194-
case BackendModeAPISIX:
195-
// do nothing
196-
case BackendModeAPISIXStandalone:
197-
// This mode is full synchronization,
198-
// which only needs to be saved in cache
199-
// and triggered by a timer for synchronization
189+
// This mode is full synchronization,
190+
// which only needs to be saved in cache
191+
// and triggered by a timer for synchronization
192+
if d.BackendMode == BackendModeAPISIXStandalone || d.BackendMode == BackendModeAPISIX || apiv2.Is(obj) {
200193
return nil
201-
default:
202-
return errors.Errorf("unknown backend mode: %s", d.BackendMode)
203-
204194
}
205195

206196
return d.sync(ctx, Task{
@@ -260,7 +250,7 @@ func (d *adcClient) Delete(ctx context.Context, obj client.Object) error {
260250
log.Debugw("successfully deleted resources from store", zap.Any("object", obj))
261251

262252
switch d.BackendMode {
263-
case BackendModeAPISIXStandalone:
253+
case BackendModeAPISIXStandalone, BackendModeAPISIX:
264254
// Full synchronization is performed on a gateway by gateway basis
265255
// and it is not possible to perform scheduled synchronization
266256
// on deleted gateway level resources
@@ -271,7 +261,7 @@ func (d *adcClient) Delete(ctx context.Context, obj client.Object) error {
271261
})
272262
}
273263
return nil
274-
case BackendModeAPI7EE, BackendModeAPISIX:
264+
case BackendModeAPI7EE:
275265
return d.sync(ctx, Task{
276266
Name: obj.GetName(),
277267
Labels: labels,

0 commit comments

Comments
 (0)