-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix: fresh objects for Synchronization executions #181
Conversation
@@ -1398,10 +1444,23 @@ func (op *AddonOperator) HandleGlobalHookRun(t sh_task.Task, labels map[string]s | |||
op.MetricStorage.HistogramObserve("{PREFIX}global_hook_run_seconds", d.Seconds(), metricLabels) | |||
})() | |||
|
|||
logEntry.Infof("Global hook run") | |||
isSynchronization := hm.BindingType == OnKubernetesEvent && hm.BindingContext[0].Type == types.TypeSynchronization | |||
shouldRunHook := true |
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.
Can we move this code to a method for this instead of copying it? And why do we add shouldRunHook
by the way? :)
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.
-
I've created a method IsSynchronization.
-
shouldRunHook
is needed as GlobalHookRun and ModuleHookRun tasks are now created for bindings withexecuteHookOnSynchronization: false
. These tasks only enable emitting events from the binding's Monitor and do not run the hook.
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.
About the second part:
I was wondering about moving some code out of the Handle*
methods. If it is hard or gives no benefits, let's leave things as is.
d4966f9
to
422f4cf
Compare
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.
No serious concerns left. The only thing we have to do is updating go.mod
after merging flant/shell-operator#261
Overview
Set
objects
in "Synchronization" binding context to an actual state in the cluster.What this PR does / why we need it
See flant/shell-operator#261
Special notes for your reviewer
Does this PR introduce a user-facing change?