-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add config option to skip container_images #14606
Add config option to skip container_images #14606
Conversation
@@ -133,6 +133,7 @@ | |||
:refresh_interval: 15.minutes | |||
:openshift: | |||
:refresh_interval: 15.minutes | |||
:get_container_images: true |
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.
note that if you backport / make a hotfix, i believe euwe had both :openshift:
& :openshift_enterprise:
types, both will need this true default.
(or could change the logic to double negative unless refresher_options.get_container_images == false
, which should preserve normal behavior if setting is missing)
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.
Thanks @cben I didn't realize that!
0628baf
to
1f09545
Compare
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.
cc @enoodle. I think we want to merge this in any case, and you may want to base your following work on this.
@@ -25,16 +25,19 @@ def fetch_hawk_inv(ems) | |||
end | |||
|
|||
def parse_legacy_inventory(ems) | |||
request_entities = OPENSHIFT_ENTITIES.dup | |||
request_entities.delete(:name => 'images') if refresher_options.skip_container_images |
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.
Consider turning OPENSHIFT_ENTITIES into a method.
I don't like there being a const that's not always the correct value. Though now that you flipped it to include images unless skip, it's pretty OK as is.
@@ -1,14 +1,14 @@ | |||
module ManageIQ::Providers | |||
module Openshift | |||
class ContainerManager::RefreshParser < ManageIQ::Providers::Kubernetes::ContainerManager::RefreshParser | |||
def ems_inv_to_hashes(inventory) | |||
def ems_inv_to_hashes(inventory, options = Config::Options.new) |
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.
Forgot one thing: since you added options args to Kubernetes parser too, let's super(inventory, options)
below.
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.
Good catch I missed that 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.
LGTM
config/settings.yml
Outdated
@@ -133,6 +133,7 @@ | |||
:refresh_interval: 15.minutes | |||
:openshift: | |||
:refresh_interval: 15.minutes | |||
:skip_container_images: false |
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 prefer to use positive-oriented option names. This way, you don't get into the unless !no_ping
type of code unreadability. skip: false
is already a double-negative.
In amazon we used the option named get_public_images
... See https://github.com/ManageIQ/manageiq-providers-amazon/blob/master/config/settings.yml#L32 . I recommend get_images: true
or something similar here.
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.
👍
121759f
to
1dd92a7
Compare
In some OpenShift environments the number of container images can result in extremely large API responses to the point where the connection will timeout, as well as save_inventory times can be dramatically longer. This adds a config option that if set to false will not request container images from the /ImageList endpoint and will not parse them in the RefreshParser.
1dd92a7
to
9ec23fb
Compare
Checked commit agrare@9ec23fb with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@Fryguy changed it over to |
Checked what happens to previous image data when image collection is disabled. => The unused images are disconected, the used image metadata is not deleted. stub_settings is risky, as it omits all other settings, and code may rely on default settings for sane behavior. stub_settings_merge is safer.
…ipped Add config option to skip container_images (cherry picked from commit d3ebee7) https://bugzilla.redhat.com/show_bug.cgi?id=1484548
Fine backport details:
|
@agrare For Euwe branch, does |
@simaishi yes I'll make an euwe PR for this |
…elete-spec Test improvements for #14606 (cherry picked from commit 6354a4e) https://bugzilla.redhat.com/show_bug.cgi?id=1484548
…to_be_skipped Add config option to skip container_images (cherry picked from commit d3ebee7)
Backported to Euwe via #15885 |
Manually cherry-picked out of ManageIQ/manageiq-providers-openshift#34 Useful to better test the backported get_container_images option (ManageIQ#14606). https://bugzilla.redhat.com/show_bug.cgi?id=1484548
…-false-delete-spec Test improvements for ManageIQ#14606 https://bugzilla.redhat.com/show_bug.cgi?id=1484548 (cherry picked from master commit 6354a4e via [FINE] cherry pick commit 0c1fb68 which adjusted for stub_settings_merge not existing yet, then adjusted for different [EUWE] vcr cassette)
…age-metadata [EUWE] Test improvements for #14606
…to_be_skipped Add config option to skip container_images (cherry picked from commit d3ebee7) https://bugzilla.redhat.com/show_bug.cgi?id=1484548
…-false-delete-spec Test improvements for ManageIQ#14606 (cherry picked from commit 6354a4e) https://bugzilla.redhat.com/show_bug.cgi?id=1484548
Manually cherry-picked out of ManageIQ/manageiq-providers-openshift#34 Useful to better test the backported get_container_images option (ManageIQ#14606). https://bugzilla.redhat.com/show_bug.cgi?id=1484548
In some OpenShift environments the number of container images can result
in extremely large API responses to the point where the connection will
timeout, as well as save_inventory times can be dramatically longer.
This adds a config option that if set to false will not request
container images from the /ImageList endpoint and will not parse them in
the RefreshParser.
https://bugzilla.redhat.com/show_bug.cgi?id=1436176