zero: refactor telemetry and controller (#5135)

* zero: refactor controller

* refactor zero telemetry and controller

* wire with connect handler

* cr
This commit is contained in:
Denis Mishin 2024-06-12 21:59:25 -04:00 committed by GitHub
parent cc636be707
commit 114f730dba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 612 additions and 342 deletions

View file

@ -17,6 +17,7 @@ type controllerConfig struct {
reconcilerLeaseDuration time.Duration
databrokerRequestTimeout time.Duration
shutdownTimeout time.Duration
}
// WithTmpDir sets the temporary directory to use.
@ -110,6 +111,13 @@ func WithDatabrokerRequestTimeout(timeout time.Duration) Option {
}
}
// WithShutdownTimeout sets the timeout for shutting down and cleanup.
func WithShutdownTimeout(timeout time.Duration) Option {
return func(c *controllerConfig) {
c.shutdownTimeout = timeout
}
}
func newControllerConfig(opts ...Option) *controllerConfig {
c := new(controllerConfig)
@ -118,6 +126,7 @@ func newControllerConfig(opts ...Option) *controllerConfig {
WithConnectAPIEndpoint("https://connect.pomerium.com"),
WithDatabrokerLeaseDuration(time.Second * 30),
WithDatabrokerRequestTimeout(time.Second * 30),
WithShutdownTimeout(time.Second * 10),
} {
opt(c)
}