-
Notifications
You must be signed in to change notification settings - Fork 128
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
Configurable cron schedule for reconciler #398
Conversation
Signed-off-by: nicklesimba <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
2776b86
to
5b1a857
Compare
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
5b1a857
to
f67b5ce
Compare
cmd/controlloop/controlloop.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are unique, but, they're non zero. :approved-stamp:
cmd/controlloop/controlloop.go
Outdated
} | ||
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the fixes, naming updates, and improvements. This looks like it's working well in my lab... output from starting and changing the cron expression...
[fedora@labkube-master-1 whereabouts]$ kubectl logs -f -n kube-system whereabouts-trz62
Done configuring CNI. Sleep=false
2023-12-20T17:00:22Z [debug] Filtering pods with filter key 'spec.nodeName' and filter value 'labkube-master-1'
2023-12-20T17:00:22Z [verbose] pod controller created
2023-12-20T17:00:22Z [verbose] Starting informer factories ...
2023-12-20T17:00:22Z [verbose] Informer factories started
2023-12-20T17:00:22Z [verbose] starting network controller
2023-12-20T17:00:23Z [verbose] using expression: 30 4 * * *
2023-12-20T17:00:23Z [verbose] started cron with job ID: "02dec27b-53d6-4c7c-a9f6-faee98afbb75"
2023-12-20T17:02:37Z [verbose] using expression: */2 * * * *
2023-12-20T17:02:37Z [verbose] configuration updated to file "/cron-schedule/config". New cron expression: */2 * * * *
2023-12-20T17:02:37Z [verbose] successfully updated CRON configuration id "02dec27b-53d6-4c7c-a9f6-faee98afbb75" - new cron expression: */2 * * * *
2023-12-20T17:02:37Z [verbose] using expression: */2 * * * *
2023-12-20T17:02:37Z [verbose] configuration updated to file "/cron-schedule/config". New cron expression: */2 * * * *
2023-12-20T17:02:37Z [verbose] successfully updated CRON configuration id "02dec27b-53d6-4c7c-a9f6-faee98afbb75" - new cron expression: */2 * * * *
2023-12-20T17:04:00Z [verbose] starting reconciler run
2023-12-20T17:04:00Z [debug] NewReconcileLooper - inferred connection data
2023-12-20T17:04:00Z [debug] listing IP pools
2023-12-20T17:04:00Z [debug] no IP addresses to cleanup
2023-12-20T17:04:00Z [verbose] reconciler success
This change will allow us to unit test the configuration updates without having to create the CNI configuration files (they're unrelated to this unit). Signed-off-by: Miguel Duarte Barroso <[email protected]>
108a2ce
to
2df0757
Compare
Move everything related to watching / updating the configuration to a separate pkg. That makes the code easier to follow, and allows us to properly unit test watching the configuration. Signed-off-by: Miguel Duarte Barroso <[email protected]>
This allows us to use cron expressions with seconds in the tests, thus allowing the test run to finish a lot quicker. Signed-off-by: Miguel Duarte Barroso <[email protected]>
2df0757
to
40ea8de
Compare
@dougbtv I've added a unit test that shows this working. I think that's enough ... I'm OK with merging. Let's talk about it in 2024. |
Signed-off-by: Miguel Duarte Barroso <[email protected]>
What this PR does / why we need it:
This PR builds on top of #392 (which adds a config map from where the reconciler scheduler can be configured via a config map) to react to updates of said configuration.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer (optional):
Tested locally.