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

Kubevirt VmTemplateList #1673

Merged

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Jun 5, 2019

Introduces List Page for Virtual Machines.

OKD

OKD(1)

Override template yaml:
OKD(2)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 5, 2019
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2019
@yaacov
Copy link
Member Author

yaacov commented Jun 5, 2019

@mareklibra @vojtechszocs @rawagner original PR #1637 is closed ... continue here.

@spadgett spadgett added this to the v4.2 milestone Jun 5, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch 2 times, most recently from 49902eb to b7d1a51 Compare June 11, 2019 11:23
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 11, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from 7166cb8 to 3c6aa9b Compare June 11, 2019 11:36
@yaacov
Copy link
Member Author

yaacov commented Jun 11, 2019

@mareklibra @vojtechszocs @rawagner using page route seems to work :-) please review.

@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from 3c6aa9b to f1beb77 Compare June 11, 2019 11:47
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 11, 2019
@yaacov yaacov changed the title [WIP] Kubvirt plugin vmtemplate Kubvirt plugin vmtemplate Jun 11, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 11, 2019
@yaacov
Copy link
Member Author

yaacov commented Jun 11, 2019

Removed WIP and removed dev dependency for kubvirt plugin.

export const VmTemplatesPageTitle = 'Virtual Machine Templates';

const createItems = {
wizard: 'Create with Wizard',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's comment-out this item until wizard is implemented.
We can keep commented-out code here if there is imminent plan for a follow-up fixing that, but a PR should result in a production-ready change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing 👍


import {
getTemplateOperatingSystems,
DASHES,
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on review of a separate PR, we should align on using of just single dash -.

Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced 🙉

@@ -65,6 +79,26 @@ const plugin: Plugin<ConsumedExtensions> = [
template: yamlTemplates.getIn([models.VirtualMachineModel, 'default']),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be yaml template customized as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I forgot it 😎 , added.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note, when defining a template we override the TemplateModel yaml template, so if we want to support a different yaml for templates we will have to write a new page renderer for ~new.

Copy link
Contributor

@vojtechszocs vojtechszocs Jun 20, 2019

Choose a reason for hiding this comment

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

Note, when defining a template we override the TemplateModel yaml template

YAML templates are keyed by model & template name (using default if not specified).

In this case, we should do something like:

{
  type: 'YAMLTemplate',
  properties: {
    model: TemplateModel,
    template: 'VM template YAML goes here',
    templateName: 'vm-template',
  },
},

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, thanks !

{
type: 'Page/Route',
properties: {
path: `/k8s/ns/:ns/${models.VmTemplateModel.plural}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed? We have a resource list page and specialized model. I think generic router rule should work. Please correct me.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what I understood from #1658 (comment) , I may have misunderstood the discussion ...

Background
AFAIU VmTemplateModel is of kind Template so defining it will redefining the existing model Template, so ModelDefinition skips it. Once I added the template we actually get a console warning:

attempt to redefine model template.openshift.io~v1~Template

Copy link
Contributor

@vojtechszocs vojtechszocs Jun 18, 2019

Choose a reason for hiding this comment

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

Yes, KubeVirt reuses the existing Template (template.openshift.io~v1~Template).

There's no need to redefine that model. What we need is a resource list page which applies a default filter to show VM templates only, e.g. via Table.staticFilters prop.

Copy link
Contributor

@vojtechszocs vojtechszocs Jun 18, 2019

Choose a reason for hiding this comment

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

We have a resource list page and specialized model.

We don't have a specialized model for VM template, we reuse the existing template model.

Mapping between models vs. resource list/details pages is 1-1 so we need to use route-based page here.

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 12, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from f0c1735 to 08f00e0 Compare June 12, 2019 11:20
@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 12, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from 08f00e0 to 4b08e86 Compare June 12, 2019 11:21
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 26, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from daf5f4e to 1024120 Compare June 26, 2019 11:30
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 26, 2019
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch 3 times, most recently from cb986e3 to 1672a08 Compare June 26, 2019 11:51
@yaacov
Copy link
Member Author

yaacov commented Jun 26, 2019

@suomiy thanks 👍 addressed the comments except the one about moving the yaml templates, It will impact orher resources and IMHO should be done separate from this PR.

p.s.
squashed commits because it became more then 20 commits ... :-)

};
VmTempleateTableHeader.displayName = 'VmTemplateTableHeader';

const VmTemplateTableRow = ({ template, index, key, style }: VmTemplateTableRowProps) => {
Copy link
Member

Choose a reason for hiding this comment

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

please also here

Copy link
Member Author

Choose a reason for hiding this comment

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

😄 👍

);

type VmTemplateTableRowProps = {
template: K8sResourceKind;
Copy link
Member

Choose a reason for hiding this comment

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

TemplateKind should be more concrete

key: string;
style: any;
};
type VirtualMachineTemplatesProps = {};
Copy link
Member

Choose a reason for hiding this comment

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

having empty types is not much useful

Copy link
Member Author

Choose a reason for hiding this comment

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

😎

@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from e3f06b9 to f2f6812 Compare June 26, 2019 13:57
@yaacov yaacov force-pushed the kubvirt-plugin-vmtemplate branch from f2f6812 to bd336fe Compare June 26, 2019 13:59
@yaacov
Copy link
Member Author

yaacov commented Jun 26, 2019

@suomiy thanks for the comments 👍 , broke some things in the way, now it's working again :-)

Kebab.columnClass,
];

const VmTempleateTableHeader = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: VmTemplateTableHeader.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks 😎

{
// NOTE(yaacov): vmtemplates is a template resource with a selector.
// 'NavItem/ResourceNS' is used, and not 'NavItem/Href', because it injects
// the namespace needed to get the correct link to a resource ( template with selector ) in our case.
Copy link
Contributor

Choose a reason for hiding this comment

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

In theory, NavItem/Href should only be used for URLs outside of Console 😄

So using NavItem/ResourceNS pointing to VM template resource is self-explanatory, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

This comment is here because of #1754 (comment)

May be an over kill 😄 I can remove it if you go not think someone may refactor it into an href in the future 🌷

type: 'Page/Route',
properties: {
exact: true,
path: [`/k8s/ns/:ns/vmtemplates`, '/k8s/all-namespaces/vmtemplates'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: no need for ` in static strings.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

metadata:
creationTimestamp: null
labels:
kubevirt-vm: 'vm-\${NAME}'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably missing something but where does NAME (and other uppercase-labeled variables) come from?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@yaacov Thank you for clarification.

@vojtechszocs
Copy link
Contributor

vojtechszocs commented Jun 26, 2019

squashed commits because it became more then 20 commits ... :-)

When working with multiple un-merged PRs stacked onto each other, it's more practical & easier to review (in my opinion) when one PR is one commit. But that's just a workaround to the general problem of GitHub not supporting proper PR linking/association.

@yaacov
Copy link
Member Author

yaacov commented Jun 27, 2019

@vojtechszocs Thanks ^^

@yaacov
Copy link
Member Author

yaacov commented Jun 27, 2019

@vojtechszocs @suomiy please review

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 27, 2019
@yaacov
Copy link
Member Author

yaacov commented Jun 27, 2019

@suomiy thanks ! this PR also need lgtm label 🚜

@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 27, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suomiy, yaacov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 78628d9 into openshift:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants