Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable cron schedule for reconciler #398

Merged
17 changes: 10 additions & 7 deletions cmd/controlloop/controlloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ const (
)

const (
couldNotCreateController = 1
couldNotReadFlatfile = 1
couldNotGetFlatIPAM = 1
cronExpressionError = 1
_ int = iota
couldNotCreateController
couldNotGetFlatIPAM
cronExpressionError
cronSchedulerCreationError
fileWatcherError
fileWatcherAddWatcherError
)

const (
Expand Down Expand Up @@ -70,7 +73,7 @@ func main() {

s, err := gocron.NewScheduler(gocron.WithLocation(time.UTC))
if err != nil {
os.Exit(123)
os.Exit(cronSchedulerCreationError)
}
schedule := determineCronExpression()

Expand All @@ -91,14 +94,14 @@ func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
_ = logging.Errorf("error creating configuration watcher: %v", err)
os.Exit(321)
os.Exit(fileWatcherError)
}
defer watcher.Close()

go syncConfiguration(watcher, s, job, errorChan)
if err := watcher.Add(reconcilerCronConfiguration); err != nil {
_ = logging.Errorf("error adding watcher to config %q: %v", reconcilerCronConfiguration, err)
os.Exit(1234)
os.Exit(fileWatcherAddWatcherError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it :) ok now I see what's up. thanks, perfect

}

for {
Expand Down
Loading