Skip to content

Commit 47446fb

Browse files
committed
fix: r
Signed-off-by: ashing <[email protected]>
1 parent 96bf53c commit 47446fb

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

config/samples/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ controller_name: apisix.apache.org/api7-ingress-controller # The controller nam
77
leader_election_id: "api7-ingress-controller-leader" # The leader election ID for the API7 Ingress Controller.
88
# The default value is "api7-ingress-controller-leader".
99
leader_election:
10-
lease_duration: 15s # lease_duration is the duration that non-leader candidates will wait
10+
lease_duration: 30s # lease_duration is the duration that non-leader candidates will wait
1111
# after observing a leadership renewal until attempting to acquire leadership of a
1212
# leader election.
13-
renew_deadline: 10s # renew_deadline is the time in seconds that the acting controller
13+
renew_deadline: 20s # renew_deadline is the time in seconds that the acting controller
1414
# will retry refreshing leadership before giving up.
1515
retry_period: 2s # retry_period is the time in seconds that the acting controller
1616
# will wait between tries of actions with the controller.

internal/controller/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func NewDefaultConfig() *Config {
3737

3838
func NewLeaderElection() *LeaderElection {
3939
return &LeaderElection{
40-
LeaseDuration: types.TimeDuration{Duration: 15 * time.Second},
41-
RenewDeadline: types.TimeDuration{Duration: 10 * time.Second},
40+
LeaseDuration: types.TimeDuration{Duration: 30 * time.Second},
41+
RenewDeadline: types.TimeDuration{Duration: 20 * time.Second},
4242
RetryPeriod: types.TimeDuration{Duration: 2 * time.Second},
4343
Disable: false,
4444
}

internal/controller/config/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ type ControlPlaneConfig struct {
5050
}
5151

5252
type LeaderElection struct {
53-
LeaseDuration types.TimeDuration `json:"leaseDuration,omitempty" yaml:"leaseDuration,omitempty"`
54-
RenewDeadline types.TimeDuration `json:"renewDeadline,omitempty" yaml:"renewDeadline,omitempty"`
55-
RetryPeriod types.TimeDuration `json:"retryPeriod,omitempty" yaml:"retryPeriod,omitempty"`
53+
LeaseDuration types.TimeDuration `json:"lease_duration,omitempty" yaml:"lease_duration,omitempty"`
54+
RenewDeadline types.TimeDuration `json:"renew_deadline,omitempty" yaml:"renew_deadline,omitempty"`
55+
RetryPeriod types.TimeDuration `json:"retry_period,omitempty" yaml:"retry_period,omitempty"`
5656
Disable bool `json:"disable,omitempty" yaml:"disable,omitempty"`
5757
}

internal/provider/adc/adc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type adcConfig struct {
3232
type adcClient struct {
3333
sync.Mutex
3434

35+
execLock sync.Mutex
36+
3537
translator *translator.Translator
3638
// gateway/ingressclass -> adcConfig
3739
configs map[provider.ResourceKind]adcConfig
@@ -227,6 +229,9 @@ func (d *adcClient) sync(ctx context.Context, task Task) error {
227229
}
228230

229231
func (d *adcClient) execADC(ctx context.Context, config adcConfig, args []string) error {
232+
d.execLock.Lock()
233+
defer d.execLock.Unlock()
234+
230235
ctxWithTimeout, cancel := context.WithTimeout(ctx, d.syncTimeout)
231236
defer cancel()
232237
// todo: use adc config

0 commit comments

Comments
 (0)