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 type to ContainerTemplate to allow subclassing. #35

Merged
merged 1 commit into from
Jul 26, 2017

Conversation

lfu
Copy link
Member

@lfu lfu commented Jul 7, 2017

Part of refactoring kube/openshift specific template code into its own provider directory.

Part of ManageIQ/manageiq#15523.

@miq-bot add_label refactoring

@gmcculloug
Copy link
Member

@miq-bot assign @Fryguy

@Fryguy
Copy link
Member

Fryguy commented Jul 17, 2017

cc @simon3z @enoodle Does this overlap with something you all were working on?

@enoodle
Copy link

enoodle commented Jul 18, 2017

cc @simon3z @enoodle Does this overlap with something you all were working on?

It is similar to #21 but with template instead of image. One key difference is that we left ContainerImage in the same place and didn't move it under ManageIQ::Providers::ContainerManager.

@lfu
Copy link
Member Author

lfu commented Jul 20, 2017

@enoodle Do you mean ContainerImage should be refactored and moved into ManageIQ::Providers::ContainerManager?

@lfu lfu force-pushed the refactor_container_manager branch from 1a170fd to 82a71d4 Compare July 20, 2017 14:54
@enoodle
Copy link

enoodle commented Jul 20, 2017

@lfu This is what I understand from this PR. Do you know if this is a requirement now that all Container models should be moved under ManageIQ::Poviders::ContainerManager? Why is template being moved in ManageIQ/manageiq#15523?
I feel that if we are moving the container models then it should be done in one PR, so maybe ManageIQ/manageiq#15523 should move all of them?


def up
say_with_time("Updating type column for ContainerTemplate") do
ContainerTemplate.update_all(:type => "ManageIQ::Providers::ContainerManager::ContainerTemplate")
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be ManageIQ::Providers::OpenShift::ContainerManager::ContainerTemplate or derive the class name with actual provider name from its container manager?

@lfu
Copy link
Member Author

lfu commented Jul 20, 2017

I feel that if we are moving the container models then it should be done in one PR, so maybe ManageIQ/manageiq#15523 should move all of them?

@enoodle That is correct. ManageIQ/manageiq#15523 is aimed at moving all Kube/Openshift specific code into its provider directory. Let me know if I have missed any other file.

@lfu lfu force-pushed the refactor_container_manager branch from 82a71d4 to 1ee2737 Compare July 20, 2017 16:42

def up
say_with_time("Updating type column for ContainerTemplate") do
ContainerTemplate.update_all(:type => "ManageIQ::Providers::OpenShift::ContainerManager::ContainerTemplate")
Copy link
Member

Choose a reason for hiding this comment

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

@lfu Tests are failing because OpenShift here does not match the test for Openshift (lower case "s").

You want to use "Openshift". Example: https://github.com/ManageIQ/manageiq-providers-openshift/blob/master/app/models/manageiq/providers/openshift/container_manager.rb#L1

@lfu lfu force-pushed the refactor_container_manager branch from 1ee2737 to e8552ce Compare July 21, 2017 14:24
@miq-bot
Copy link
Member

miq-bot commented Jul 21, 2017

Checked commit lfu@e8552ce with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 1 offense detected

db/migrate/20170707150520_update_container_template_types.rb

@gmcculloug
Copy link
Member

@enoodle @Fryguy Anything else needed here to merge this?

@enoodle
Copy link

enoodle commented Jul 23, 2017

IMO if we want to separate all the container classes that have mostly Openshift functions then we need to also move: ContainerBuild, ContainerBuildPod, ContainerDeployment and ContainerRoute. The all only Openshift meaning (I guess Route will/should be changed to include kubernetes ingress soon).

@lfu
Copy link
Member Author

lfu commented Jul 24, 2017

@enoodle Opened an issue to refactor all other container classes to its provider directory.
This PR focuses on the template provisioning related refactoring. Is there any other related class should be added in this PR?

@enoodle
Copy link

enoodle commented Jul 24, 2017

@lfu I don't think there is anything else that is concerning templates.

@lfu
Copy link
Member Author

lfu commented Jul 24, 2017

@Fryguy Please review.

@Fryguy Fryguy added the schema label Jul 26, 2017
@Fryguy Fryguy merged commit 7b49504 into ManageIQ:master Jul 26, 2017
@Fryguy Fryguy added this to the Sprint 66 Ending Aug 7, 2017 milestone Jul 26, 2017
@Fryguy
Copy link
Member

Fryguy commented Jul 26, 2017

Gah I just merged this, but how do you know the container template is always openshift...what if it's kubernetes?

@lfu
Copy link
Member Author

lfu commented Jul 26, 2017

I thought Openshift template is the only container template that is currently supported.

@cben
Copy link
Contributor

cben commented Jul 31, 2017

Yeah, templates are an Openshift concept, they don't exist in Kubernetes.
(they might in future, openshift concepts tend to get upstreamed, there is already a proposal)

Currently kubernetes refresh doesn't even try to collect/parse/create ContainerTemplate, this migration's assumption is safe. (aside from related PRs not being merged yet)

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