-
Notifications
You must be signed in to change notification settings - Fork 900
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
Replace ContainerLabelTagMapping.controls_tag? with Tag.controlled_by_mapping scope #16449
Conversation
…_mapping scope More efficient, and can be used in graph refresh.
6fc96a2
to
c4e76ed
Compare
Original code didn't set read_only (UI does set it), failed with new retagging implementation from ManageIQ/manageiq#16449
@cben Cannot apply the following label because they are not recognized: enhancement gaprindashvili/yes |
Checked commit cben@c4e76ed with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 |
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, would be nice to prove that the queries perform good with high counts.
@miq-bot add-label performance, gaprindashvili/yes Yeah, I should benchmark. Wanted something that works at all first :-) |
Also, I hope later to move to simpler query on tag prefix, but not before some refactorings, that'd be g/no. |
- Use factory for more accurate test Original test didn't set read_only (UI does set it), failed with new retagging implementation from ManageIQ/manageiq#16449 - Test that we don't remove user-assigned tags
It seems Tag.controlled_by_mapping works right but entity.tags.controlled_by_mapping doesn't (?) Until I debug it, this revert prevents regression of tag mapping in classic refresh (and specifically fixes save_tags_inventory_spec)
In ManageIQ#16453, I changed this spec to "realistically" create a tag mapping + category + tag. But I made a typo/thinko, taking the parent (category) tag to be assigned to the vm. This caused false failure for ManageIQ#16449 and days of lost work debugging/rewriting it, eventually caused similar failure in the rewrite too :-( https://bugzilla.redhat.com/show_bug.cgi?id=1508437
A scope is needed for tag mapping in graph refresh, and may improve performance. Alternative to ManageIQ#16449 - this one no longer cares if there exists a ContainerLabelTagMapping linked to the category, only that it's name starts with `kubernetes:` / `amazon:`. This can happen to user-created categories too, so we also check it's read_only.
THIS WAS REVERTED in #16462.
More efficient and necessary for ManageIQ/manageiq-providers-kubernetes#162 mapping in graph refresh.
Links
Overview/plan: ManageIQ/manageiq-providers-kubernetes#126
This is necessary to complete containers graph refresh, BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1470021