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

Refactoring code for label-based filtering for Ansible Operators #5086

Merged
merged 3 commits into from
Aug 11, 2021

Conversation

VenkatRamaraju
Copy link
Contributor

@VenkatRamaraju VenkatRamaraju commented Jul 23, 2021

Description of the change:
Removed some of the code from #3275 and instead obtained the same functionality from controller runtime.

Motivation for the change:
When this was originally created in Operator SDK, controller-runtime did not support this feature. Now that it's a part of controller-runtime (from this PR), we leverage it in SDK and remove the extra code.

Notes

  1. This feature involves removing the entire "predicate" folder under internal/ansible. The predicate folder only containspredicate.go. The code from predicate.go is present upstream.
  2. This exact feature has been implemented for Helm: Closes #4949: Label-based filtering for Helm via predicates #4997.
  3. Since this is just refactoring a previous feature, the documentation and changelog fragment already exist.

Signed-off-by: Venkat Ramaraju <venky2063@gmail.com>
return r.Selector.Matches(labels.Set(eventLabels))
}

func NewResourceFilterPredicate(s metav1.LabelSelector) (predicate.Predicate, error) {
Copy link
Member

Choose a reason for hiding this comment

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

While the new LabelSelectorPredicate does not have the exact same implementation as this does, it seems like a safe change because labels should only be update-able from an update event.

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2021
Copy link
Member

@fabianvf fabianvf left a comment

Choose a reason for hiding this comment

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

/lgtm

@estroz estroz merged commit 67ebc33 into operator-framework:master Aug 11, 2021
bentito pushed a commit to bentito/operator-sdk that referenced this pull request Aug 24, 2021
twasyl pushed a commit to twasyl/operator-sdk that referenced this pull request Sep 3, 2021
…rator-framework#5086)

Signed-off-by: Venkat Ramaraju <venky2063@gmail.com>
Signed-off-by: Thierry Wasylczenko <thierry.wasylczenko@gmail.com>
@jmrodri
Copy link
Member

jmrodri commented Sep 3, 2021

Fixes #4949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants