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
enhancement: Replace UpdateStatus() for ApplyStatus() to avoid informer errors #5883
enhancement: Replace UpdateStatus() for ApplyStatus() to avoid informer errors #5883
Conversation
To avoid too many back-and-forth with the e2e tests you might want to modify only one controller (e.g. Alertmanager) first. |
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.
getting a bit cryptic with all these 'trac', 'aac' and so but they come from the applyconfiguration changes 🗡️
a75f3d6
to
ac5de8f
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.
The call to stsReporter.Update()
at L806 also sets some of the status fields so we need to adapt it.
e50417b
to
f3d7700
Compare
Signed-off-by: Mario Fernandez <mariofer@redhat.com>
f3d7700
to
4582562
Compare
👋 -- Just out of curiosity, what errors are we seeing in UpdateStatus() that we're fixing here? :) |
Trying to update the operator status, the error: "failed to update status subresource" is shown and could be confused. |
To add more context, we're seeing this type of messages in the OpenShift's prometheus operator logs (I've seen in plain Kind clusters too):
My guess is that since UpdateStatus() reads the Prometheus object from the cache, it may have a slightly outdated version with an old |
Would it be possible to have the Status set to an older version if we use apply, even if for a little bit? I don't really see a problem with that, just thinking out loud at the moment, but do you see that as a problem? |
@ArthurSens my assumption is that the update will retrigger a status update if required. In most cases, it should be a no-op. |
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
change fieldManager to const andd add force true Signed-off-by: Mario Fernandez <mariofer@redhat.com>
Signed-off-by: Mario Fernandez <mariofer@redhat.com>
@@ -53,7 +54,8 @@ import ( | |||
) | |||
|
|||
const ( | |||
resyncPeriod = 5 * time.Minute | |||
resyncPeriod = 5 * time.Minute | |||
prometheusOperatorFieldManager = "PrometheusOperator" |
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.
nit: It doesn't hurt, but if it has only one usage I wouldn't bother creating a var for it. Do you plan to use this in any follow-up PRs? Don't bother changing it back just because of this, just curious.
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.
The same change will be applied to the Prometheus and Thanos controllers so we'll need a constant in the end.
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.
Great! Can you proceed with the other UpdateStatus() functions?
@@ -53,7 +54,8 @@ import ( | |||
) | |||
|
|||
const ( | |||
resyncPeriod = 5 * time.Minute | |||
resyncPeriod = 5 * time.Minute | |||
prometheusOperatorFieldManager = "PrometheusOperator" |
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.
The same change will be applied to the Prometheus and Thanos controllers so we'll need a constant in the end.
Clarified offline with @marioferh. Let's merge this and PRs will follow for the other controllers. |
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.
Thanks!
Description
To set the status subresource, the operator make use of ApplyStatus() instead of UpdateStatus() to avoid informer errors.
Type of change
CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Changelog entry