Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled to configure the interval of livestate store for Lambda #5269

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Must be one of the following structs:
| roleARN | string | The IAM role arn to use when assuming an role. Required if you want to use the AWS SecurityTokenService. | No |
| tokenFile | string | The path to the WebIdentity token the SDK should use to assume a role with. Required if you want to use the AWS SecurityTokenService. | No |
| profile | string | The profile to use for logging into AWS cluster. The default value is `default`. | No |
| awsAPIPollingInterval | duration | The interval of periodical calls of AWS APIs. Currently, this is an interval of refreshing the live state of Lambda functions. Default is 15s. | No |

### PlatformProviderECSConfig

Expand Down
2 changes: 1 addition & 1 deletion pkg/app/piped/livestatestore/lambda/lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
client: client,
logger: logger.Named("store"),
},
interval: 15 * time.Second,
interval: time.Duration(cfg.AwsAPIPollingInterval),

Check warning on line 61 in pkg/app/piped/livestatestore/lambda/lambda.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/livestatestore/lambda/lambda.go#L61

Added line #L61 was not covered by tests
logger: logger,
firstSyncedCh: make(chan error, 1),
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/config/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,12 @@ type PlatformProviderLambdaConfig struct {
// If empty, the environment variable "AWS_PROFILE" is used.
// "default" is populated if the environment variable is also not set.
Profile string `json:"profile,omitempty"`
// The interval of periodical calls of AWS APIs.
// Currently this is used for live state of Lambda functions,
// but in the future, this might also be used for other polling features.
// Default is 15s.
// To reduce AWS API calls, this interval should be larger.
AwsAPIPollingInterval Duration `json:"awsAPIPollingInterval,omitempty" default:"15s"`
}

func (c *PlatformProviderLambdaConfig) Mask() {
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/piped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func TestPipedConfig(t *testing.T) {
Name: "lambda",
Type: model.PlatformProviderLambda,
LambdaConfig: &PlatformProviderLambdaConfig{
Region: "us-east-1",
Region: "us-east-1",
AwsAPIPollingInterval: Duration(15 * time.Second),
},
},
},
Expand Down
Loading