Skip to content

Commit

Permalink
reconciler: sort out the reconciler error codes
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed Dec 20, 2023
1 parent 3d6186d commit 2776b86
Showing 1 changed file with 10 additions and 7 deletions.
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)
}

for {
Expand Down

0 comments on commit 2776b86

Please sign in to comment.