-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat: improve agent startup time #5976
Conversation
@@ -126,16 +124,32 @@ func main() { | |||
|
|||
inspector := commons.CreateImageInspector(cfg, configMapClient, secretClient) | |||
|
|||
// Connect to NATS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving NATS first staggers the gRPC connection a bit when we start agent and control plane together. gRPC backoff is quite steep, but I want to avoid tweaking it until absolutely needed as these defaults are there for a reason.
defer grpcConn.Close() | ||
|
||
// First request will 'wait for ready' with a timeout of agent.InitialTimeout. | ||
proContext, err := commons.ReadProContext(ctx, cfg, grpcClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this up a bit, as it groups nicely with the grpcConnection part, this is where we actually wait for the connection to move from idle -> transient error -> ready.
@@ -31,7 +31,8 @@ import ( | |||
) | |||
|
|||
const ( | |||
timeout = 10 * time.Second | |||
InitialTimeout = 30 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With gRPC backoff this would amount to: 1 + 1.6 + 2.5 + 4 +6.5 + 10.5 -> CRASH after 30s, last attempt at 26.1s. Kubernetes will then restart the pod and it will try again.
Pull request description
Checklist (choose whats happened)
Breaking changes
Changes
Fixes