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

identify openshift images through command variable #15022

Conversation

enoodle
Copy link

@enoodle enoodle commented May 7, 2017

Factor out Openshift image identification and use the command attribute as we are also parsing digest for images originating only from pods.

@enoodle
Copy link
Author

enoodle commented May 7, 2017

cc @moolitayer
@miq-bot add_label providers/containers enhancement

@miq-bot
Copy link
Member

miq-bot commented May 7, 2017

@enoodle Cannot apply the following label because they are not recognized: providers/containers enhancement

@@ -112,5 +112,9 @@ def disconnect_inv
save
end

def openshift_image?
command.present?
Copy link
Contributor

@simon3z simon3z May 10, 2017

Choose a reason for hiding this comment

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

@enoodle why command being present would give an indication whether it's an openshift_image or not?

Copy link
Author

Choose a reason for hiding this comment

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

We are only collecting this field from Openshift images and I expect all of them to have it. In case not all images have command and we can't find another field that answers these criteria then we will need to add something to mark it.

BTW this is currently will cause an error message when ManageIQ attempts to annotate an image that doesn't exists but this won't result in a negative user experience so maybe we also want to leave it as is.

@simon3z
Copy link
Contributor

simon3z commented May 17, 2017

@enoodle I think the idea is good but the current implementation is poor. Maybe we should do something at refresh time (e.g. use a type column and have different classes for the different types of images).

@moolitayer
Copy link

moolitayer commented May 17, 2017

We will need to avoid some confusion. We have

  1. images that come from a kubernetes cluster (only through running pods)
  2. images that come from an openshift cluster through get images
  3. images that come from an openshift cluster through running pods

we usually use Inheritance for 1. vs the others, this case we would need distinguish between 2 and others.

@simon3z
Copy link
Contributor

simon3z commented May 17, 2017

images that come from a kubernetes cluster (only through running pods)
images that come from an openshift cluster through running pods

@moolitayer what's the difference between these two?

@moolitayer
Copy link

moolitayer commented May 17, 2017

@moolitayer what's the difference between these two?

For this pr they are the same. I would expect 1 and 2 to be represented by app/models/container_image
and 3 to be under app/models/manageiq/providers/openshift/container_manager. Maybe someone else has a better idea

@simon3z
Copy link
Contributor

simon3z commented May 17, 2017

For this pr they are the same. I would expect 1 and 2 to be represented by app/models/container_image
and 3 to be under app/models/manageiq/providers/openshift/container_manager. Maybe someone else has a better idea

@moolitayer with reference to your comment, I don't think there's any difference between 1 and 3, they are both ContainerImage (there's nothing specific of OpenShift).
Instead 2 is a different type: OpenShiftImage and yes it will probably need to live in app/models/manageiq/providers/openshift/container_manager.

@chessbyte
Copy link
Member

@simon3z @moolitayer bump

@simon3z
Copy link
Contributor

simon3z commented Jun 5, 2017

@enoodle as mentioned in the past I would like to see this at refresh-time. Feel free to update this PR or close it to handle the issue in another one.

@enoodle enoodle force-pushed the identify_openshift_images_for_miq_action branch from ea270fc to 5e459f9 Compare June 5, 2017 16:46
@enoodle
Copy link
Author

enoodle commented Jun 5, 2017

@moolitayer @simon3z I have added ems_ref field to ContainerImage to identify if the image has an entity in the EMS too. This will be accompanied with a one line PR to manageiq-providers-openshift if you will say that this direction is OK.

@enoodle enoodle force-pushed the identify_openshift_images_for_miq_action branch 2 times, most recently from a3fa362 to 483d79b Compare June 6, 2017 09:21
@simon3z
Copy link
Contributor

simon3z commented Jun 6, 2017

@moolitayer @simon3z I have added ems_ref field to ContainerImage to identify if the image has an entity in the EMS too. This will be accompanied with a one line PR to manageiq-providers-openshift if you will say that this direction is OK.

@enoodle we need a unique identifier for the image but again I think we need also two different types for the images.

@enoodle enoodle force-pushed the identify_openshift_images_for_miq_action branch from 483d79b to bf63edc Compare June 6, 2017 12:20
Will allow to identify provider entities of images from images that are
entities only in ManageIQ
@enoodle enoodle force-pushed the identify_openshift_images_for_miq_action branch from bf63edc to 934d7ce Compare June 6, 2017 13:31
@miq-bot
Copy link
Member

miq-bot commented Jun 6, 2017

Checked commit enoodle@934d7ce with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 5 offenses detected

app/models/miq_action.rb

spec/models/miq_action_spec.rb

@@ -742,7 +742,7 @@ def action_container_image_annotate_deny_execution(action, rec, inputs)
return
end

unless rec.digest.present?
unless !rec.ems_ref.blank?
Copy link
Member

@Fryguy Fryguy Jun 13, 2017

Choose a reason for hiding this comment

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

unless + ! + blank? is a recipe for confusion... This is equivalent to if rec.ems_ref.blank?

@Fryguy
Copy link
Member

Fryguy commented Jun 13, 2017

@simon3z I'll wait on your before I review further. I think my opinion matches yours in #15022 (comment)

@enoodle
Copy link
Author

enoodle commented Jun 15, 2017

Different classes for container images: #15386

@miq-bot
Copy link
Member

miq-bot commented Jun 22, 2017

This pull request is not mergeable. Please rebase and repush.

@Fryguy
Copy link
Member

Fryguy commented Jun 22, 2017

Database migrations have now been moved to the https://github.com/ManageIQ/manageiq-schema repo. Please see http://talk.manageiq.org/t/new-split-repo-manageiq-schema/2478 for instructions on how to transfer your database migrations. If this PR contains only migrations, I will leave it open for a short time during the transition, after which I will close this if it has not been moved over.

@enoodle enoodle closed this Jun 25, 2017
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.

6 participants