Add optional hook for operator specific status modifications#2101
Add optional hook for operator specific status modifications#2101rashmigottipati wants to merge 3 commits intoopenshift:masterfrom
Conversation
|
/hold |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rashmigottipati The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com> Co-authored-by: Predrag Knezevic <pknezevi@redhat.com>
5fc35ac to
5b1dcb2
Compare
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com> Co-authored-by: Predrag Knezevic <pknezevi@redhat.com>
|
/unhold |
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
|
Do you have an example PR we could use as an illustration of how this is utilized to achieve consistent upgrade signal? |
|
@rashmigottipati: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Example of usage: openshift/cluster-olm-operator#169 |
|
I talked to @rashmigottipati and @pedjak, this is not a good solution how to fix an operator not setting With the last test changes, operators are allowed to stay Progressing=false if the operand image is the same as before, e.g. during upgrade between two close versions. This PR has a good code, anyone can reopen it if they find a good reason to have hooks in the StatusController. Flipping |
Thanks for the update. I’m going to close the PR then. As you wrote, it can be reopened when we find a good reason to have hooks in the StatusController. /close |
|
@p0lyn0mial: Closed this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Description
This PR adds an optional hook mechanism to StatusSyncer that allows operators to modify their ClusterOperator status before the update request is send to API server. The hook receives both the original status (reconcile start) and the mutated status (done by the reconcile logic), enabling operators informed decisions about additional tweaks, i.e. version that is going to send to API server.
Changes:
ClusterOperatorStatusHookfunction typeWithBeforeStatusUpdateHook()builder methodSync()after standard status logic completes, before the API updateMotivation
Operators sometimes need custom status logic such as detecting version changes during cluster upgrades. This usually requires comparing the target version (from environment) against the current version (in ClusterOperator status). Without access to the original status from etcd, operators cannot reliably detect these transitions. This hook provides a generic mechanism for operators to implement such custom logic.
Co-authored-by: Predrag Knezevic pknezevi@redhat.com