fix: make rpc_timeout and max_bundle_workers configurable on the agent#7093
fix: make rpc_timeout and max_bundle_workers configurable on the agent#7093salimeid wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request makes SPIRE Agent’s gRPC timeout and federated bundle fetch concurrency configurable via experimental HCL settings, addressing bundle sync failures when many federations cause update cycles to exceed the fixed RPC timeout.
Changes:
- Exposes agent RPC timeout as an experimental
rpc_timeoutoption and applies it to agent client calls. - Exposes federated bundle fetch concurrency as an experimental
max_bundle_workersoption. - Adds CLI config parsing/validation and unit tests for the new experimental options.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/agent/client/client.go | Introduces exported, configurable RPC timeout and bundle worker count; updates client call sites and worker spawning to use the configurable values. |
| cmd/spire-agent/cli/run/run.go | Adds experimental HCL fields, parses/validates them, and applies them to the agent client configuration with warnings. |
| cmd/spire-agent/cli/run/run_test.go | Adds test coverage for parsing/validation and warning logs for the new experimental settings. |
| func SetRPCTimeout(d time.Duration) { | ||
| RPCTimeout = d | ||
| } |
There was a problem hiding this comment.
Leaving this comment unresolved, reviewers can decide of which approach to take here
Both values were package-level constants with no way to tune them at runtime. Expose them as experimental HCL options following the same pattern as jwt_svid_cache_hit_timeout. Signed-off-by: Salim Eid <seid@genetec.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Salim Eid <4256703+salimeid@users.noreply.github.com>
a7691da to
bd9a463
Compare
| const ( | ||
| rpcTimeout = 30 * time.Second | ||
|
|
||
| // maxBundleWorkers is the maximum number of worker goroutines to use when fetching bundles. |
There was a problem hiding this comment.
We should keep this comment.
| rpcTimeout = 30 * time.Second | ||
| maxBundleWorkers = 10 |
There was a problem hiding this comment.
Could you rename these to defaultX to differentiate them from the other ones
| RPCTimeout = rpcTimeout | ||
| MaxBundleWorkers = maxBundleWorkers |
There was a problem hiding this comment.
These do not need to be exported, maybe after renaming the consts, these can become rpcTimeout and maxBundleWorkers.
Both values were package-level constants with no way to tune them at runtime. Expose them as experimental HCL options following the same pattern as jwt_svid_cache_hit_timeout.
Affected functionality
Fetching of federated trust bundles.
Description of change
Makes spire-agent gRPC Timeout and federated bundle fetch's concurrency configurable.
Which issue this PR fixes
Fixes: #6490