Files
oc-scheduler/conf/config.go

36 lines
684 B
Go
Raw Normal View History

package conf
2026-03-26 11:15:02 +01:00
import (
"sync"
"time"
)
type Config struct {
2026-03-26 11:15:02 +01:00
KubeHost string
KubePort string
KubeCA string
KubeCert string
KubeData string
// PrepLeadSeconds must match oc-schedulerd's PREP_LEAD_SECONDS.
// Used both as the ASAP buffer and as the minimum allowed lead time
// when validating explicit booking start dates.
PrepLeadSeconds int
}
func (c *Config) PrepLead() time.Duration {
if c.PrepLeadSeconds <= 0 {
return 2 * time.Minute
}
return time.Duration(c.PrepLeadSeconds) * time.Second
}
var instance *Config
var once sync.Once
func GetConfig() *Config {
once.Do(func() {
instance = &Config{}
})
return instance
}