2026-02-25 09:04:48 +01:00
|
|
|
package conf
|
|
|
|
|
|
2026-03-26 11:15:02 +01:00
|
|
|
import (
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
2026-02-25 09:04:48 +01:00
|
|
|
|
|
|
|
|
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
|
2026-02-25 09:04:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var instance *Config
|
|
|
|
|
var once sync.Once
|
|
|
|
|
|
|
|
|
|
func GetConfig() *Config {
|
|
|
|
|
once.Do(func() {
|
|
|
|
|
instance = &Config{}
|
|
|
|
|
})
|
|
|
|
|
return instance
|
|
|
|
|
}
|