fix: set audit/logger webhook retry interval to maximum 1m (#20404)

This commit is contained in:
Harshavardhana 2024-09-09 02:36:47 -07:00 committed by GitHub
parent 8268c12cfb
commit fb24bcfee0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View File

@ -494,6 +494,9 @@ func lookupLoggerWebhookConfig(scfg config.Config, cfg Config) (Config, error) {
if err != nil {
return cfg, err
}
if retryInterval > time.Minute {
return cfg, fmt.Errorf("maximum allowed value for retry interval is '1m': %s", retryIntervalCfgVal)
}
cfg.HTTP[k] = http.Config{
Enabled: true,
Endpoint: url,
@ -571,6 +574,9 @@ func lookupAuditWebhookConfig(scfg config.Config, cfg Config) (Config, error) {
if err != nil {
return cfg, err
}
if retryInterval > time.Minute {
return cfg, fmt.Errorf("maximum allowed value for retry interval is '1m': %s", retryIntervalCfgVal)
}
cfg.AuditWebhook[k] = http.Config{
Enabled: true,
Endpoint: url,

View File

@ -76,6 +76,18 @@ var (
Optional: true,
Type: "string",
},
config.HelpKV{
Key: MaxRetry,
Description: `maximum retry count before we start dropping logged event(s)`,
Optional: true,
Type: "number",
},
config.HelpKV{
Key: RetryInterval,
Description: `sleep between each retries, allowed maximum value is '1m' e.g. '10s'`,
Optional: true,
Type: "duration",
},
config.HelpKV{
Key: config.Comment,
Description: config.DefaultComment,
@ -133,13 +145,13 @@ var (
},
config.HelpKV{
Key: MaxRetry,
Description: `maximum retry count before we start dropping upto batch_size events`,
Description: `maximum retry count before we start dropping audit event(s)`,
Optional: true,
Type: "number",
},
config.HelpKV{
Key: RetryInterval,
Description: `maximum retry sleeps between each retries`,
Description: `sleep between each retries, allowed maximum value is '1m' e.g. '10s'`,
Optional: true,
Type: "duration",
},