Skip to content

Commit 43a46c2

Browse files
committed
add mode
1 parent e7b23ba commit 43a46c2

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

internal/provider/adc/adc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func (d *adcClient) sync(ctx context.Context, task Task) error {
336336

337337
log.Debugw("syncing resources with multiple configs", zap.Any("configs", task.configs))
338338
for _, config := range task.configs {
339-
if err := d.executor.Execute(ctx, config, args); err != nil {
339+
if err := d.executor.Execute(ctx, d.BackendMode, config, args); err != nil {
340340
return err
341341
}
342342
}

internal/provider/adc/executor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ import (
2828
)
2929

3030
type ADCExecutor interface {
31-
Execute(ctx context.Context, config adcConfig, args []string) error
31+
Execute(ctx context.Context, mode string, config adcConfig, args []string) error
3232
}
3333

3434
type DefaultADCExecutor struct {
3535
sync.Mutex
3636
}
3737

38-
func (e *DefaultADCExecutor) Execute(ctx context.Context, config adcConfig, args []string) error {
38+
func (e *DefaultADCExecutor) Execute(ctx context.Context, mode string, config adcConfig, args []string) error {
3939
e.Lock()
4040
defer e.Unlock()
4141

42-
return e.unlockExecute(ctx, config, args)
42+
return e.unlockExecute(ctx, mode, config, args)
4343
}
4444

45-
func (e *DefaultADCExecutor) unlockExecute(ctx context.Context, config adcConfig, args []string) error {
45+
func (e *DefaultADCExecutor) unlockExecute(ctx context.Context, mode string, config adcConfig, args []string) error {
4646
ctxWithTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
4747
defer cancel()
4848

@@ -56,7 +56,7 @@ func (e *DefaultADCExecutor) unlockExecute(ctx context.Context, config adcConfig
5656
adcEnv := []string{
5757
"ADC_EXPERIMENTAL_FEATURE_FLAGS=remote-state-file,parallel-backend-request",
5858
"ADC_RUNNING_MODE=ingress",
59-
"ADC_BACKEND=apisix-standalone",
59+
"ADC_BACKEND=" + string(mode),
6060
"ADC_SERVER=" + serverAddr,
6161
"ADC_TOKEN=" + token,
6262
}

internal/types/map.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
113
package types
214

315
import (

internal/utils/k8s.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
113
package utils
214

315
import (

0 commit comments

Comments
 (0)