Files
orchard/internal/controller/option.go
T
Nikolay Edigaryev 4eafec99a5 Fail VMs if the worker had crashed/is unhealthy (#70)
* Fail VMs if the worker had crashed/is unhealthy

* OnDiskName: properly handle cases when VM's name contains hyphens

* Worker: introduce Offline() method and check it before scheduling

* tart.List(): use Tart's JSON output

* OnDiskName: remove empty parts check

* Scheduler: move health-checking logic to a separate function

* Only fail "running" VMs

* Only fail orphaned VMs if they're in terminal state

* Integration tests

* Run healthCheckingLoopIteration() before schedulingLoopIteration()

* Worker: sync on-disk VMs only once at start
2023-04-03 16:47:49 +04:00

52 lines
1.0 KiB
Go

package controller
import (
"crypto/tls"
"go.uber.org/zap"
"time"
)
type Option func(*Controller)
func WithDataDir(dataDir *DataDir) Option {
return func(controller *Controller) {
controller.dataDir = dataDir
}
}
func WithListenAddr(listenAddr string) Option {
return func(controller *Controller) {
controller.listenAddr = listenAddr
}
}
func WithTLSConfig(tlsConfig *tls.Config) Option {
return func(controller *Controller) {
controller.tlsConfig = tlsConfig
}
}
func WithInsecureAuthDisabled() Option {
return func(controller *Controller) {
controller.insecureAuthDisabled = true
}
}
func WithSwaggerDocs() Option {
return func(controller *Controller) {
controller.enableSwaggerDocs = true
}
}
func WithWorkerOfflineTimeout(workerOfflineTimeout time.Duration) Option {
return func(controller *Controller) {
controller.workerOfflineTimeout = workerOfflineTimeout
}
}
func WithLogger(logger *zap.Logger) Option {
return func(controller *Controller) {
controller.logger = logger.Sugar()
}
}