-
Notifications
You must be signed in to change notification settings - Fork 356
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 kubevirt provider #3143
Add kubevirt provider #3143
Conversation
@h-kataria @Fryguy @jhernand @martinpovolny the current PR designed to replace #3051 It is more conventional and introduces provider specifics to multi_auth_credentials.html.haml |
@miq-bot add_labels enhacement graphics gaprindashvili/no |
@masayag Cannot apply the following label because they are not recognized: enhacement graphics gaprindashvili/no |
f70573d
to
bc25a2c
Compare
@serenamarie125 please review |
@miq-bot add_labels enhacement, graphics, gaprindashvili/no |
@masayag Cannot apply the following label because they are not recognized: enhacement |
@miq-bot add_label enhancement |
@AparnaKarve please review. |
@masayag Can you replace all |
Will do.
The option to add the kubevirt provider should be blocked. Management (add/remove or enable/disable) of the kubevirt provider is supposed to be done under the container manager as a secondary provider. So I need to somehow hide the kubevirt provider from the suggested providers list when trying to add new provider and also to block the possibility to remove it. Is it acceptable from UX point of view (@serenamarie125 ) ? If so, can you guide what is the place in code to control it ? |
Would you be creating a separate UI PR for the kubevirt provider Management tasks - Add/Remove/Enable/Disable ? |
return "disabled" if @ems.connection_configurations.try(:kubevirt).nil? | ||
"kubevirt" | ||
end | ||
|
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.
how about @ems.connection_configurations.try(:kubevirt).nil? ? "disabled" : "kubevirt"
or
@ems.connection_configurations.try(:kubevirt).present? ? "kubevirt" : "disabled"
Based on the screenshots in the top comment, editing a kubevirt provider seems to be a supported operation. Hence I was thinking - do you want to consider disabling the kubevirt option in the dropdown for Add screen, as shown below? A disabled entry would indicate that a kubevirt provider cannot be added from the provider Add screen, but is supported in the product. |
This pull request is not mergeable. Please rebase and repush. |
bc25a2c
to
12db17c
Compare
These actions are already part of this PR. From Compute --> Containers --> Providers --> Select 'kubernetes' provider with virtualization manager --> change 'virtualization' tab to 'disabled' - The admin will be able to remove the 'kubevirt' provider from the system.
Yes, I'd like to be able to do this as you showed in the attached screenshot of your comment. |
diff --git a/app/views/ems_infra/_form.html.haml b/app/views/ems_infra/_form.html.haml
index d0e0e80da..31b8e9ef2 100644
--- a/app/views/ems_infra/_form.html.haml
+++ b/app/views/ems_infra/_form.html.haml
@@ -24,7 +24,7 @@
= _('Type')
.col-md-8
= select_tag('emstype',
- options_for_select([["<#{_('Choose')}>", nil]] + @ems_types, disabled: ["<#{_('Choose')}>", nil]),
+ options_for_select([["<#{_('Choose')}>", nil]] + @ems_types, disabled: ["<#{_('Choose')}>", nil, 'Kubevirt', 'kubevirt']),
"ng-if" => "newRecord",
"ng-model" => "emsCommonModel.emstype",
"ng-change" => "providerTypeChanged()", This will disable Kubevirt. However, a proper approach would be to create an array in the controller - @disabled_ems_infra_types = ['Kubevirt', 'kubevirt'] and then in the haml, you could concat this array with options_for_select([["<#{_('Choose')}>", nil]] + @ems_types, disabled: ["<#{_('Choose')}>", nil].concat(@disabled_ems_infra_types)), |
@@ -445,6 +490,8 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', ' | |||
$scope.emsCommonModel.metrics_api_port = "5432"; | |||
$scope.emsCommonModel.default_api_port = $scope.getDefaultApiPort($scope.emsCommonModel.emstype); | |||
$scope.emsCommonModel.metrics_database_name = "ovirt_engine_history"; | |||
} else if ($scope.emsCommonModel.emstype === 'kubevirt') { |
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.
Should this be $scope.emsCommonModel.virtualization_selection === 'kubevirt'
?
since for a Container Provider, emstype
is either 'kubernetes' or 'openshift' and I believe virtualization_selection
is kubevirt
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.
If the above is true, can you check all emstype/kubevirt
references below and change them appropriately?
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.
@AparnaKarve I think this should be completed removed. I can't think of a scenario in which we'll allow modifying the type of the 'kubevirt' provider or when we'll allow the user to add that provider explicitly and not via the openshift/kubernetes provider.
12db17c
to
2352369
Compare
@AparnaKarve I've incorporated your comments into the PR. |
2352369
to
f320911
Compare
Yes, they are the same. Updating the token under 'Infra' --> 'Providers' --> 'KubeVirt' --> 'Edit' is supposed to be simpler flow to the user. |
a995e23
to
94a9786
Compare
@AparnaKarve I've added specs to this PR, please review and let me know if further fixes are needed. |
@@ -191,6 +191,82 @@ def test_setting_few_fields | |||
expect(@ems.options[:image_inspector_options][:http_proxy]).to eq("example.com") | |||
end | |||
end | |||
|
|||
context "update container provider with kubevirt provider" do |
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.
@masayag Would it be possible to move this test out of ems_common
, and move it to ems_container_controller_spec
instead?
In fact, all the other ems_container
specific tests before this PR also need to be moved if possible.
(but not in this PR)
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 you also include a test for editing/updating the kubevirt provider in ems_infra_controller_spec
?
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.
@AparnaKarve fixed the specs and added missing ones.
@moolitayer @zeari please see comment about pulling ems_container related specs to ems_container_controller_spec
94a9786
to
5fc7366
Compare
|
||
render_views | ||
|
||
it 'creates on post' do |
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.
@masayag Just wondering if we need the 'creates on post' spec at all, since in the UI we disallow creating an Infra Provider of this type, and only allow the user to update the Provider.
Instead of this -
kubevirt = ManageIQ::Providers::Kubevirt::InfraManager.where(:name => "openshift_with_kubevirt Virtualization Manager").first
is it possible to work with a FactoryGirl
record for the 'updates on post' spec?
@serenamarie125 from #3143 (comment)
Do you think it's better to just not even have Kubevirt in the drop down, rather than have it there disabled, since that type can't be added from the Infrastructure area? I'm thinking it might be confusing to the user, making them think there is some way to get that enabled. |
@Loicavenel @masayag is there a design document or something somewhere that explains why we want to show the kubevirt providers in 2 places in the UI? I'm just thinking it might get confusing both codewise and to the users. I'm sure someone has thought this out, but coming in from the outside, I'd like to understand the rationale behind this update before we merge. Thx, Dan |
@dclarizio there is no design document for it. The idea was to add a secondary virtualization provider to the ems container. However, it behaves as an infra manager, therefore, once enabled, it can be managed as an infra manager. Changing the endpoints cannot be done for the infra manager, only by changing the ems container endpoint, since they are basically the same (differ by api url, but same endpoint), and also the only property that can be changed is the token (authentication's password). We'd like to have the kubevirt as infra manager, to show its dashboard, list its resources and more. @serenamarie125 could you share your thoughts on this item as well ? |
@AparnaKarve @dclarizio @masayag Agree that we should not have disabled items in a drop down. Rather than disable it, please do not show it. |
@dclarizio @masayag there was no design doc for this, the premise that the new provider was supposed to be consistent with others. Seems like the only reason we are allowing a kubevirt provider on the infra side (hadn't realized this til it was pointed out to me) is to allow for it to be renamed. Having both is confusing from a UX perspective, and I'd rather be constrained to not allow them to rename the provider (assuming it's not a requirement). |
5fc7366
to
323af1f
Compare
@AparnaKarve latest version contains the removal of 'kubevirt' from 'Add Infra Provider' dialog. Disable 'Edit Provider' for kubevirt is still needed for this PR to be complete. |
After just looking at this with @masayag , I think the current flow is fine, so disregard my above comment. Please keep the KubeVirt provider in Infrastructure, and allow for editing. One thing that we could do with a follow up PR is including field level help on the Security Protocol, host name & API port which would provide a tooltip with an instruction stating if they want to edit that value, they'd need to do so by going to the associated Container Provider. |
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.
LGTM @masayag ! I've added a possible improvement that can be done in a future PR, but approving for now!
kubevirt provider is added as a secondary provider to be managed by the openshift/kubernetes provider. It will have also representation as an infrastructure provider, but its management will be done under openshift/kubernetes, as it shares the same endpoint, and might differ only by its token. The token might be different than the default token in order to allow the specific virtualization capabilities. Since kubevirt share the same endpoint as the parent provider, the 'detection' button will not be shown.
The kubevirt provider should be added as a sub-manager of the openshift/kubernetes provider, and as such we should block the option to add it from the UI as infrastructure manager.
323af1f
to
e373ef2
Compare
Checked commits masayag/manageiq-ui-classic@421c2e5~...e373ef2 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 **
app/controllers/ems_infra_controller.rb
app/controllers/mixins/ems_common_angular.rb
spec/controllers/ems_infra_controller_spec.rb
|
@masayag UI changes look good. As for the specs, I think what I had mentioned before is still valid #3143 (comment) Overall LGTM! @dclarizio This is good to go. |
🎉 |
1 similar comment
🎉 |
@AparnaKarve please note that in the create request on that spec file I'm not creating the 'kubevirt' provider alone (as one might not do from the UI), since the backend doesn't support it. Instead I'm creating 'openshift' provider with 'kubevirt' endpoint, which simulates the only supported method of adding 'kubevirt' provider into the system. |
@masayag Thanks for the above clarification. |
kubevirt provider is added as a secondary provider to be
managed by the openshift/kubernetes provider.
It will have also representation as an infrastructure provider, but its
management will be done under openshift/kubernetes, as it shares the
same endpoint, and might differ only by its token.
The token might be different than the default token in order to allow
the specific virtualization capabilities.
Since kubevirt share the same endpoint as the parent provider,
the 'detection' button will not be shown.
The virtualization label for the kubevirt provider:
![container_manager_virtualization_drop_down_list](https://user-images.githubusercontent.com/316242/34403076-910d9dcc-ebae-11e7-8c12-daf0938dc585.png)
The virtualization tab for the kubevirt provider:
![container_manager_virtualization_tab](https://user-images.githubusercontent.com/316242/34403099-bbea79a2-ebae-11e7-9e55-25cb7ff9deee.png)
Changing token for the virtualization manager:
![container_manager_virtualization_tab_change_token](https://user-images.githubusercontent.com/316242/34403111-dca078e0-ebae-11e7-90af-f7f2373510b2.png)
'Add provider' drop-down list without 'kubevirt':
![add_provider_list](https://user-images.githubusercontent.com/316242/36443707-324dd758-1682-11e8-873f-6c084a3bfa16.png)