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

Azure labeling and tagging support #3697

Merged
merged 1 commit into from
Apr 18, 2018

Conversation

@miq-bot miq-bot added the wip label Mar 28, 2018
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.

👍 on UI. Attaching screenshot you sent on gitter:
[UPDATE: SCREENSHOT NO LONGER MATCHES PR EXACTLY]
before:
before
after:
after
(one translation is missing, dictionary.model.ManageIQ::Providers::Azure::CloudManager::Image)

See comment on needed backend change to support these options.

# "Vm" => "Amazon",
# "Image" => "Amazon",
'Vm' => [nil, 'Amazon', 'Azure'].freeze,
'Image' => [nil, 'Amazon', 'Azure'].freeze,
Copy link
Contributor

Choose a reason for hiding this comment

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

The key of this hash — e.g. 'Image' — is still what's saved as the ContainerLabelTagMapping labeled_resource_type, for each of these options?
When the mapping is performed during refresh, mapper won't be able to distinguish whether user wanted it to apply to only amazon images, azure images or both.

=> You do need distinct labeled_resource_type values for each option.
And you'll need to extend ContainerLabelTagMapping::Mapper to apply mappings with several values. Currently it matches mappings with given type, and nil:
https://github.com/ManageIQ/manageiq/blob/84aae96783c3/app/models/container_label_tag_mapping/mapper.rb#L62-L66
you'll need to match 3 values.

@AlexanderZagaynov AlexanderZagaynov changed the title [WIP] support azure labeling and tagging Azure labeling and tagging support Apr 16, 2018
@miq-bot
Copy link
Member

miq-bot commented Apr 16, 2018

Checked commit AlexanderZagaynov@d4f0437 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@miq-bot miq-bot removed the wip label Apr 16, 2018
@AlexanderZagaynov
Copy link
Author

Hi @martinpovolny can you review this please?

@martinpovolny
Copy link
Member

Looks good, but "pending core", right?

@AlexanderZagaynov
Copy link
Author

@martinpovolny yeah, it should be merged after this one: ManageIQ/manageiq-providers-azure#231

@@ -79,7 +82,7 @@ def entity_ui_name_or_all(entity)
if entity
provider = MAPPABLE_ENTITIES[entity]
model = case entity
when 'Vm'
when 'Vm', 'VmAzure'
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that this break the pluggable providers approach. But it seems to be the case before, so if @martinpovolny is ok with this, I guess we can merge.

We should refactor this though next, so this generic code doesn't know anything about k8s, AWS or Azure

Copy link
Member

@martinpovolny martinpovolny Apr 18, 2018

Choose a reason for hiding this comment

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

I am "ok" with that given this is a blocker BZ.

Code like this should not exist in the UI. The UI should never test for "azure" or anything like that. We should only use the supports? interface from the UI.

I am going to merge this PR, but with the expectation that there's going to be a follow up that fixes this and this too:

provider.azure? && entity.sub(/Azure$/, '...

Copy link
Contributor

Choose a reason for hiding this comment

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

See proposed refactor followup: 22a532f
(might also help reviewing this PR — the explicit values there were computed by actually running logic from entity_ui_name_or_all and label_tag_mapping_add in this PR).

It still won't be "pluggable", there is currently no mechanism by which providers report which types can be mapped in their refresh (and UI shouldn't offer types that wouldn't work).

I'm happy to later do a bigger followup with a migration to a better schema, but I'm afraid the answer at this point will be "don't bother", justifiably so...

@bronaghs
Copy link

@martinpovolny dependent PR merged.

@martinpovolny martinpovolny merged commit 9945ede into ManageIQ:master Apr 18, 2018
@martinpovolny martinpovolny added this to the Sprint 84 Ending Apr 23, 2018 milestone Apr 18, 2018
@AlexanderZagaynov
Copy link
Author

@miq-bot remove-label bug
@miq-bot remove-label pending core

@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit c629cf16896e5384b157fc5ac0d210f0a513d404
Author: Martin Povolny <mpovolny@redhat.com>
Date:   Wed Apr 18 15:40:52 2018 +0200

    Merge pull request #3697 from AlexanderZagaynov/BZ-1493041
    
    Azure labeling and tagging support
    (cherry picked from commit 9945eded7d97e35b3c4125f4ffcac2d129ff21c6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1568807

@AlexanderZagaynov
Copy link
Author

@miq-bot add_label fine/yes

simaishi pushed a commit that referenced this pull request Apr 23, 2018
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit c8855c06fe9d4756e99485d5b499081a4a36b74d
Author: Martin Povolny <mpovolny@redhat.com>
Date:   Wed Apr 18 15:40:52 2018 +0200

    Merge pull request #3697 from AlexanderZagaynov/BZ-1493041
    
    Azure labeling and tagging support
    (cherry picked from commit 9945eded7d97e35b3c4125f4ffcac2d129ff21c6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1493041

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.

7 participants