Skip to content
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

Use a watch predicate to filter on generation or annotation change #926

Merged
merged 1 commit into from
Nov 9, 2020

Conversation

zcahana
Copy link
Contributor

@zcahana zcahana commented Nov 9, 2020

This PR changes the watch events Predicate used the HyperConvereged controller to one that admits updates to the object annotations, even when the object's spec (==> generation) hasn't changed.

Signed-off-by: Zvi Cahana zvic@il.ibm.com

Release note:

NONE

…on change

Signed-off-by: Zvi Cahana <zvic@il.ibm.com>
@kubevirt-bot kubevirt-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Nov 9, 2020
@ovirt-infra
Copy link

Hello contributor, thanks for submitting a PR for this project!

I am the bot who triggers "standard-CI" builds for this project.
As a security measure, I will not run automated tests on PRs that are not from white-listed contributors.

In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:

  1. Type ci test please on this PR to trigger automated tests for it.
  2. Type ci add to whitelist on this PR to trigger automated tests for it and also add you to the contributor white-list so that your future PRs will be tested automatically. ( keep in mind this list might be overwritten if the job XML is refreshed, for permanent whitelisting, please follow Manage kubevirt CR from sdk generated code #3 option )
  3. If you are planning to contribute to more than one project, maybe it's better to ask them to add you to the project organization, so you'll be able to run tests for all the organization's projects.

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Nov 9, 2020
@openshift-ci-robot
Copy link
Collaborator

Hi @zcahana. Thanks for your PR.

I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 9, 2020
@kubevirt-bot
Copy link
Contributor

Hi @zcahana. Thanks for your PR.

I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

hcoutil "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util"
"github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/predicate"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the only actual change to the imports is the addition of github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/predicate (and removal of sigs.k8s.io/controller-runtime/pkg/predicate).

The rest is just a re-sort of the packages so that they're grouped by source.

@nunnatsa
Copy link
Collaborator

nunnatsa commented Nov 9, 2020

/ok-to-test

@kubevirt-bot kubevirt-bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Nov 9, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 9, 2020
@nunnatsa
Copy link
Collaborator

nunnatsa commented Nov 9, 2020

/retest

@tiraboschi
Copy link
Member

@zcahana isn't the vanilla ResourceVersionChangedPredicate enough for this?

@zcahana
Copy link
Contributor Author

zcahana commented Nov 9, 2020

isn't the vanilla ResourceVersionChangedPredicate enough for this?

@tiraboschi ResourceVersionChangedPredicate will "do the job" in terms of letting in annotation changes, but it won't filter status updates, so we'll have more (~double?) reconciliation cycles.

@tiraboschi
Copy link
Member

isn't the vanilla ResourceVersionChangedPredicate enough for this?

@tiraboschi ResourceVersionChangedPredicate will "do the job" in terms of letting in annotation changes, but it won't filter status updates, so we'll have more (~double?) reconciliation cycles.

OK, understood.
So maybe we should also try to push our new custom predicate to https://github.com/kubernetes-sigs/controller-runtime hoping it fan be useful also for others

@nunnatsa
Copy link
Collaborator

nunnatsa commented Nov 9, 2020

isn't the vanilla ResourceVersionChangedPredicate enough for this?

@tiraboschi ResourceVersionChangedPredicate will "do the job" in terms of letting in annotation changes, but it won't filter status updates, so we'll have more (~double?) reconciliation cycles.

OK, understood.
So maybe we should also try to push our new custom predicate to https://github.com/kubernetes-sigs/controller-runtime hoping it fan be useful also for others

If you are going there, we can maybe have one that only filter annotation, and then use the or predicate with both of them.

@nunnatsa
Copy link
Collaborator

nunnatsa commented Nov 9, 2020

/override coverage/coveralls

@kubevirt-bot
Copy link
Contributor

@nunnatsa: Overrode contexts on behalf of nunnatsa: coverage/coveralls

In response to this:

/override coverage/coveralls

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/test-infra repository.

@nunnatsa
Copy link
Collaborator

nunnatsa commented Nov 9, 2020

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2020
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nunnatsa

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2020
@kubevirt-bot kubevirt-bot merged commit e499477 into kubevirt:master Nov 9, 2020
@zcahana zcahana deleted the controller_predicate branch November 9, 2020 20:10
@zcahana
Copy link
Contributor Author

zcahana commented Nov 9, 2020

Submitted a similar PR to controller-runtime (including @nunnatsa's suggestion to separate to an annotation-only predicate and combine using "or").

kubernetes-sigs/controller-runtime#1254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants