-
Notifications
You must be signed in to change notification settings - Fork 898
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
Container Template: Add object_labels #15406
Conversation
@miq-bot add_label providers/containers, enhancement |
b96f788
to
34a0e28
Compare
@zakiva aren't labels a one-to-many relationship to |
Template also has one-to-many relationship to
|
34a0e28
to
b3a13e0
Compare
@zakiva then these labels seems instantiation-time labels that we shouldn't persist in the database. |
This pull request is not mergeable. Please rebase and repush. |
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. |
@zakiva Maybe these user specified labels should be saved the same way as the user specified parameters? These parameters currently are saved in Service/ServiceTemplate. |
b3a13e0
to
32957eb
Compare
@simon3z done, please take a look |
app/models/container_template.rb
Outdated
@@ -26,15 +27,16 @@ class ContainerTemplate < ApplicationRecord | |||
"Service" => ContainerService, | |||
}.freeze | |||
|
|||
def instantiate(params, project = nil) | |||
def instantiate(params, labels, project = nil) |
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.
@zakiva Is it better to make labels
an optional parameter?
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.
we can use template.object_labels as default value, if you prefer? (I thought that we always want to add a unique template label to mark the objects)
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 don't mind leave it the same as for template parameters for now.
@zakiva If I understand it correctly, the user input instantiation-time labels will be saved in service if implemented later, and those specified in the template will be saved as |
Those are labels that we save for the template as part of its metadata, as we do for the rest of the container objects. The 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.
Can we add some tests?
|
@miq-bot rm_label sql migration |
This pull request is not mergeable. Please rebase and repush. |
32957eb
to
c00ba9e
Compare
Checked commit zakiva@c00ba9e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
LGTM. Using (A 3rd option would be a JSONB column; I don't know enough about that to say anything.) |
@cben this is still waiting a technical review of the dependency ManageIQ/manageiq-schema#32 |
👍 |
@cben can you approve? |
Depends on: ManageIQ/manageiq-schema#32
Changes included:
Adding(Extracted), parsing this field is added in Container Template: Parse object_labels manageiq-providers-openshift#25.object_labels
column tocontainer_templates
tableAllowing the. moved to Container Template: Allow instantiation with object_labels manageiq-providers-kubernetes#98instantiate
method to receive labels as an argument so that each created object will be tagged with these labels during instantiation