mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 05:22:01 +02:00
Apply the configuration from CRD.
This commit is contained in:
+20
@@ -7,6 +7,7 @@ import (
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/zalando-incubator/postgres-operator/pkg/controller"
|
||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||
@@ -20,6 +21,14 @@ var (
|
||||
config spec.ControllerConfig
|
||||
)
|
||||
|
||||
func mustParseDuration(d string) time.Duration {
|
||||
duration, err := time.ParseDuration(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return duration
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&kubeConfigFile, "kubeconfig", "", "Path to kubeconfig file with authorization and master location information.")
|
||||
flag.BoolVar(&outOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.")
|
||||
@@ -38,6 +47,17 @@ func init() {
|
||||
log.Printf("Fully qualified configmap name: %v", config.ConfigMapName)
|
||||
|
||||
}
|
||||
if crd_interval := os.Getenv("CRD_READY_WAIT_INTERVAL"); crd_interval != "" {
|
||||
config.CRDReadyWaitInterval = mustParseDuration(crd_interval)
|
||||
} else {
|
||||
config.CRDReadyWaitInterval = 4 * time.Second
|
||||
}
|
||||
|
||||
if crd_timeout := os.Getenv("CRD_READY_WAIT_TIMEOUT"); crd_timeout != "" {
|
||||
config.CRDReadyWaitTimeout = mustParseDuration(crd_timeout)
|
||||
} else {
|
||||
config.CRDReadyWaitTimeout = 30 * time.Second
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user