Skip to content

Commit 13474fa

Browse files
lucacomerenovate[bot]
authored andcommitted
Update tags and sync time
1 parent 8b91d11 commit 13474fa

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ This also works when an instance is being terminated: the asg-sync will remove t
206206
> Because the asg-sync works on a polling-based model, there will be a delay between the instance going to a
207207
> terminating state and the asg-sync removing its IP from NGINX Plus. To guarantee that NGINX Plus doesn't send any
208208
> requests to a terminated instance, make sure the instance goes to the `Terminating:Wait` state for a period greater
209-
> than the interval `sync_interval_in_seconds`.
209+
> than the interval `sync_interval`.
210210
211211
## Configuration for Cloud Providers
212212

build/config.yaml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# cloud_provider: AWS
44
# region: us-west-2
55
# api_endpoint: http://127.0.0.1:8080/api
6-
# sync_interval_in_seconds: 5
6+
# sync_interval: 5s
77
# upstreams:
88
# - name: backend1
99
# autoscaling_group: backend-group-1
@@ -24,7 +24,7 @@
2424
# subscription_id: my_subscription_id
2525
# resource_group_name: my_resource_group
2626
# api_endpoint: http://127.0.0.1:8080/api
27-
# sync_interval_in_seconds: 5
27+
# sync_interval: 5s
2828
# upstreams:
2929
# - name: backend1
3030
# virtual_machine_scale_set: backend-group-1

cmd/sync/aws.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,20 @@ func prepareBatches(maxItems int, items []string) [][]string {
242242
// Configuration for AWS Cloud Provider
243243

244244
type awsConfig struct {
245-
Region string
246-
Upstreams []awsUpstream
245+
Region string `yaml:"region"`
246+
Upstreams []awsUpstream `yaml:"upstreams"`
247247
}
248248

249249
type awsUpstream struct {
250-
Name string
250+
Name string `yaml:"name"`
251251
AutoscalingGroup string `yaml:"autoscaling_group"`
252-
Kind string
252+
Kind string `yaml:"kind"`
253253
FailTimeout string `yaml:"fail_timeout"`
254254
SlowStart string `yaml:"slow_start"`
255-
Port int
256-
MaxConns int `yaml:"max_conns"`
257-
MaxFails int `yaml:"max_fails"`
258-
InService bool `yaml:"in_service"`
255+
Port int `yaml:"port"`
256+
MaxConns int `yaml:"max_conns"`
257+
MaxFails int `yaml:"max_fails"`
258+
InService bool `yaml:"in_service"`
259259
}
260260

261261
func validateAWSConfig(cfg *awsConfig) error {

cmd/sync/azure.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ func (client *AzureClient) GetUpstreams() []Upstream {
147147
}
148148

149149
type azureConfig struct {
150-
SubscriptionID string `yaml:"subscription_id"`
151-
ResourceGroupName string `yaml:"resource_group_name"`
152-
Upstreams []azureUpstream
150+
SubscriptionID string `yaml:"subscription_id"`
151+
ResourceGroupName string `yaml:"resource_group_name"`
152+
Upstreams []azureUpstream `yaml:"upstreams"`
153153
}
154154

155155
type azureUpstream struct {
156-
Name string
156+
Name string `yaml:"name"`
157157
VMScaleSet string `yaml:"virtual_machine_scale_set"`
158-
Kind string
158+
Kind string `yaml:"kind"`
159159
FailTimeout string `yaml:"fail_timeout"`
160160
SlowStart string `yaml:"slow_start"`
161-
Port int
162-
MaxConns int `yaml:"max_conns"`
163-
MaxFails int `yaml:"max_fails"`
161+
Port int `yaml:"port"`
162+
MaxConns int `yaml:"max_conns"`
163+
MaxFails int `yaml:"max_fails"`
164164
}
165165

166166
func validateAzureConfig(cfg *azureConfig) error {

cmd/sync/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
type commonConfig struct {
1313
APIEndpoint string `yaml:"api_endpoint"`
1414
CloudProvider string `yaml:"cloud_provider"`
15-
SyncInterval time.Duration `yaml:"sync_interval_in_seconds"`
15+
SyncInterval time.Duration `yaml:"sync_interval"`
1616
}
1717

1818
func parseCommonConfig(data []byte) (*commonConfig, error) {
@@ -35,7 +35,7 @@ func validateCommonConfig(cfg *commonConfig) error {
3535
return fmt.Errorf(errorMsgFormat, "api_endpoint")
3636
}
3737

38-
if cfg.SyncInterval == 0 {
38+
if cfg.SyncInterval <= 0 {
3939
return errors.New(intervalErrorMsg)
4040
}
4141

cmd/sync/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "testing"
55
var validYaml = []byte(`
66
cloud_provider: AWS
77
api_endpoint: http://127.0.0.1:8080/api
8-
sync_interval_in_seconds: 5
8+
sync_interval: 5s
99
`)
1010

1111
type testInputCommon struct {
@@ -29,7 +29,7 @@ func getInvalidCommonConfigInput() []*testInputCommon {
2929

3030
invalidSyncIntervalCfg := getValidCommonConfig()
3131
invalidSyncIntervalCfg.SyncInterval = 0
32-
input = append(input, &testInputCommon{invalidSyncIntervalCfg, "invalid sync_interval_in_seconds"})
32+
input = append(input, &testInputCommon{invalidSyncIntervalCfg, "invalid sync_interval"})
3333

3434
return input
3535
}

cmd/sync/errormessages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
const (
44
errorMsgFormat = "the mandatory field %v is either empty or missing in the config file"
5-
intervalErrorMsg = "the mandatory field sync_interval_in_seconds is either 0 or missing in the config file"
5+
intervalErrorMsg = "the mandatory field sync_interval is either 0, negative or missing in the config file"
66
cloudProviderErrorMsg = "the field cloud_provider has invalid value %v in the config file"
77
defaultCloudProvider = "AWS"
88
upstreamNameErrorMsg = "the mandatory field name is either empty or missing for an upstream in the config file"

cmd/sync/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func main() {
163163
}
164164

165165
select {
166-
case <-time.After(commonConfig.SyncInterval * time.Second): //nolint:durationcheck
166+
case <-time.After(commonConfig.SyncInterval):
167167
case <-sigterm:
168168
log.Println("Terminating...")
169169
return

examples/aws.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ nginx-asg-sync is configured in **/etc/nginx/config.yaml**.
2525
```yaml
2626
region: us-west-2
2727
api_endpoint: http://127.0.0.1:8080/api
28-
sync_interval_in_seconds: 5
28+
sync_interval: 5s
2929
cloud_provider: AWS
3030
upstreams:
3131
- name: backend-one
@@ -48,8 +48,8 @@ upstreams:
4848
```
4949
5050
- The `api_endpoint` key defines the NGINX Plus API endpoint.
51-
- The `sync_interval_in_seconds` key defines the synchronization interval: nginx-asg-sync checks for scaling updates
52-
every 5 seconds.
51+
- The `sync_interval` key defines the synchronization interval: nginx-asg-sync checks for scaling updates
52+
every 5 seconds. The value is a string that represents a duration (e.g., `5s`). The maximum unit is hours.
5353
- The `cloud_provider` key defines a cloud provider that will be used. The default is `AWS`. This means the key can be
5454
empty if using AWS. Possible values are: `AWS`, `Azure`.
5555
- The `region` key defines the AWS region where we deploy NGINX Plus and the Auto Scaling groups. Setting `region` to

examples/azure.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ nginx-asg-sync is configured in **/etc/nginx/config.yaml**.
2626

2727
```yaml
2828
api_endpoint: http://127.0.0.1:8080/api
29-
sync_interval_in_seconds: 5
29+
sync_interval: 5s
3030
cloud_provider: Azure
3131
subscription_id: my_subscription_id
3232
resource_group_name: my_resource_group
@@ -50,8 +50,8 @@ upstreams:
5050
```
5151
5252
- The `api_endpoint` key defines the NGINX Plus API endpoint.
53-
- The `sync_interval_in_seconds` key defines the synchronization interval: nginx-asg-sync checks for scaling updates
54-
every 5 seconds.
53+
- The `sync_interval` key defines the synchronization interval: nginx-asg-sync checks for scaling updates
54+
every 5 seconds. The value is a string that represents a duration (e.g., `5s`). The maximum unit is hours.
5555
- The `cloud_provider` key defines a Cloud Provider that will be used. The default is `AWS`. This means the key can be
5656
empty if using AWS. Possible values are: `AWS`, `Azure`.
5757
- The `subscription_id` key defines the Azure unique subscription id that identifies your Azure subscription.

0 commit comments

Comments
 (0)