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

Add config option to skip container_images #14606

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Apr 1, 2017

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

@@ -133,6 +133,7 @@
:refresh_interval: 15.minutes
:openshift:
:refresh_interval: 15.minutes
:get_container_images: true
Copy link
Contributor

@cben cben Apr 3, 2017

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)

Copy link
Member Author

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!

@agrare agrare force-pushed the allow_container_images_to_be_skipped branch from 0628baf to 1f09545 Compare April 3, 2017 19:18
Copy link
Contributor

@cben cben left a 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
Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link

@enoodle enoodle left a comment

Choose a reason for hiding this comment

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

LGTM

@agrare agrare changed the title [WIP] Add config option to skip container_images Add config option to skip container_images Apr 4, 2017
@agrare agrare removed the wip label Apr 4, 2017
@@ -133,6 +133,7 @@
:refresh_interval: 15.minutes
:openshift:
:refresh_interval: 15.minutes
:skip_container_images: false
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@agrare agrare force-pushed the allow_container_images_to_be_skipped branch 2 times, most recently from 121759f to 1dd92a7 Compare April 4, 2017 14:49
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.
@agrare agrare force-pushed the allow_container_images_to_be_skipped branch from 1dd92a7 to 9ec23fb Compare April 4, 2017 14:56
@miq-bot
Copy link
Member

miq-bot commented Apr 4, 2017

Checked commit agrare@9ec23fb with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 0 offenses detected
Everything looks good. 👍

@agrare
Copy link
Member Author

agrare commented Apr 4, 2017

@Fryguy changed it over to :get_container_images: true

@chessbyte chessbyte requested a review from simon3z April 5, 2017 09:03
@blomquisg blomquisg merged commit d3ebee7 into ManageIQ:master Apr 5, 2017
@blomquisg blomquisg added this to the Sprint 58 Ending Apr 10, 2017 milestone Apr 5, 2017
@agrare agrare deleted the allow_container_images_to_be_skipped branch April 5, 2017 16:12
agrare pushed a commit that referenced this pull request Apr 19, 2017
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.
simaishi pushed a commit that referenced this pull request Aug 23, 2017
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit c1f88dddd9ebb1fefdfd99126b09b5a419980b28
Author: Greg Blomquist <blomquisg@gmail.com>
Date:   Wed Apr 5 12:10:03 2017 -0400

    Merge pull request #14606 from agrare/allow_container_images_to_be_skipped
    
    Add config option to skip container_images
    (cherry picked from commit d3ebee7c480c8e88ca6066f505fc922daceb4943)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1484548

@simaishi
Copy link
Contributor

@agrare For Euwe branch, does :get_container_images: true in config/settings.yml need to go to both :openshift: and :openshift_enterprise: ?

@agrare
Copy link
Member Author

agrare commented Aug 23, 2017

@simaishi yes I'll make an euwe PR for this

@agrare
Copy link
Member Author

agrare commented Aug 23, 2017

@simaishi #15885

@simaishi
Copy link
Contributor

simaishi pushed a commit that referenced this pull request Aug 23, 2017
agrare pushed a commit to agrare/manageiq that referenced this pull request Aug 24, 2017
…to_be_skipped

Add config option to skip container_images

(cherry picked from commit d3ebee7)
@simaishi
Copy link
Contributor

Backported to Euwe via #15885

cben added a commit to cben/manageiq that referenced this pull request Aug 28, 2017
cben pushed a commit to cben/manageiq that referenced this pull request Aug 30, 2017
…-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)
simaishi added a commit that referenced this pull request Aug 31, 2017
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
…to_be_skipped

Add config option to skip container_images
(cherry picked from commit d3ebee7)

https://bugzilla.redhat.com/show_bug.cgi?id=1484548
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants