mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
* 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
52 lines
1.0 KiB
Go
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()
|
|
}
|
|
}
|