-
Notifications
You must be signed in to change notification settings - Fork 204
OTA-1531: [4/x] cvo: extract config informer creation #1189
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
OTA-1531: [4/x] cvo: extract config informer creation #1189
Conversation
@petr-muller: This pull request references OTA-1531 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In 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 openshift-eng/jira-lifecycle-plugin repository. |
Skipping CI for Draft Pull Request. |
/test unit lint images e2e-agnostic-operator |
/test e2e-agnostic-operator |
/test e2e-agnostic-operator e2e-agnostic-ovn-upgrade-into-change e2e-agnostic-ovn-upgrade-into-change-techpreview |
edc4c45
to
e3c7151
Compare
/test e2e-agnostic-operator e2e-agnostic-ovn-upgrade-into-change e2e-agnostic-ovn-upgrade-into-change-techpreview |
e3c7151
to
3fa96aa
Compare
/test e2e-agnostic-operator e2e-agnostic-ovn-upgrade-into-change e2e-agnostic-ovn-upgrade-into-change-techpreview lint images unit |
3fa96aa
to
1fb5c12
Compare
/test e2e-agnostic-operator e2e-agnostic-ovn-upgrade-into-change e2e-agnostic-ovn-upgrade-into-change-techpreview lint images unit |
1fb5c12
to
0c045a3
Compare
/test e2e-agnostic-operator e2e-agnostic-ovn-upgrade-into-change e2e-agnostic-ovn-upgrade-into-change-techpreview lint images unit |
6121d53
to
5ec3e49
Compare
@petr-muller: This pull request references OTA-1531 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In 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 openshift-eng/jira-lifecycle-plugin repository. |
@petr-muller: This pull request references OTA-1531 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In 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 openshift-eng/jira-lifecycle-plugin repository. |
/test lint |
/cc @hongkailiu |
Happy to review this today/tomorrow. /cc |
pkg/start/start.go
Outdated
|
||
coInformer := sharedInformers.Config().V1().ClusterOperators() | ||
coInformer := clusterVersionConfigInformerFactory.Config().V1().ClusterOperators() |
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.
this is wrong, this should be configInformerFactory
, not the cv one
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.
but now the names at least make that visible
The code to set up informers is messy so this change attempts to make it more consistent: - Alias all informer-related imports to `somethinginformers` - Everything made by `NewSharedInformerFactory` methods is now called `somethingInformerFactory` - Name factories in `Context` consistently: `SomethingFactory` - Document the purpose of individual factories in `Context` - Reorder code into clusters that deal with individual factory types
OTA-1531 will need the config.openshift.io group lister early in the CVO execution and outside of the `Context` structure, so this commit moves the necessary preparation code outside of `NewControllerContext` and passes these factories into it as parameters. Constructing factories at separate places is a little awkward but for now I try keeping the change small instead of trying to invent some centralized informer factory management. I think it is reasonable to treat config.openshift.io informers separately if they are actually used separately.
`NewFilteredSharedInformerFactory` is deprecated and can be replaced by `NewSharedInformerFactoryWithOptions`, where the filter is expressed as `TweakListOption`. The direct `FieldSelector` equality can be replaced with the `OneTermEqualSelector` helper.
Address an earlier review comment: openshift#1188 (comment)
5ec3e49
to
61ca445
Compare
@petr-muller: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/retest |
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.
Looks good to me.
/hold
Putting on hold in case @hongkailiu is in mid-review or wanted to review these changes personally. However, two approvals are plenty for such changes, IMO. Feel free to unhold 🤷
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DavidHurta, petr-muller The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
LGTM
OpenshiftConfigManagedInformerFactory informers.SharedInformerFactory | ||
InformerFactory externalversions.SharedInformerFactory | ||
OperatorInformerFactory operatorexternalversions.SharedInformerFactory | ||
// ClusterVersionInformerFactory should be used to get informers / listers for code that works with ClusterVersion resource |
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 love those comments. Thanks.
// singleton in the cluster. | ||
ClusterVersionInformerFactory configinformers.SharedInformerFactory | ||
// ConfigInformerFactory should be used to get informers / listers for code that works with resources from the | ||
// config.openshift.io group, _except_ the ClusterVersion resource singleton. |
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 did not understand why we use another factory for CV. But this is me, need more time to read the code.
My native guess is that their configurations are different for some reason.
/hold cancel |
/label no-qe Still covered by the "will be tested on the last PR" agreement with QE |
[ART PR BUILD NOTIFIER] Distgit: cluster-version-operator |
The code to set up informers is messy so this change attempts to make it more consistent:
somethinginformers
NewSharedInformerFactory
methods is now calledsomethingInformerFactory
Context
consistently:SomethingFactory
Context
OTA-1531 will need the config.openshift.io group lister early in the CVO execution and outside of the
Context
structure, so this commit moves the necessary preparation code outside ofNewControllerContext
and passes these factories into it as parameters. Constructing factories at separate places is a little awkward but for now I try keeping the change small instead of trying to invent some centralized informer factory management. I think it is reasonable to treat config.openshift.io informers separately if they are actually used separately.NewFilteredSharedInformerFactory
is deprecated and can be replaced byNewSharedInformerFactoryWithOptions
, where the filter is expressed asTweakListOption
. The directFieldSelector
equality can be replaced with theOneTermEqualSelector
helper.Address an earlier review comment: #1188 (comment)