-
Notifications
You must be signed in to change notification settings - Fork 615
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
Kubevirt VmTemplateList #1673
Conversation
@mareklibra @vojtechszocs @rawagner original PR #1637 is closed ... continue here. |
49902eb
to
b7d1a51
Compare
7166cb8
to
3c6aa9b
Compare
@mareklibra @vojtechszocs @rawagner using page route seems to work :-) please review. |
3c6aa9b
to
f1beb77
Compare
Removed WIP and removed dev dependency for kubvirt plugin. |
export const VmTemplatesPageTitle = 'Virtual Machine Templates'; | ||
|
||
const createItems = { | ||
wizard: 'Create with Wizard', |
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.
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.
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.
Removing 👍
|
||
import { | ||
getTemplateOperatingSystems, | ||
DASHES, |
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.
Based on review of a separate PR, we should align on using of just single dash -
.
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.
Replaced 🙉
@@ -65,6 +79,26 @@ const plugin: Plugin<ConsumedExtensions> = [ | |||
template: yamlTemplates.getIn([models.VirtualMachineModel, 'default']), |
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.
Shouldn't be yaml template customized as well?
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.
Yes, I forgot it 😎 , added.
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.
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
.
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.
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',
},
},
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.
Nice, thanks !
{ | ||
type: 'Page/Route', | ||
properties: { | ||
path: `/k8s/ns/:ns/${models.VmTemplateModel.plural}`, |
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.
Is this needed? We have a resource list page and specialized model. I think generic router rule should work. Please correct me.
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.
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
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.
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.
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 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.
f0c1735
to
08f00e0
Compare
08f00e0
to
4b08e86
Compare
daf5f4e
to
1024120
Compare
cb986e3
to
1672a08
Compare
@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. |
}; | ||
VmTempleateTableHeader.displayName = 'VmTemplateTableHeader'; | ||
|
||
const VmTemplateTableRow = ({ template, index, key, style }: VmTemplateTableRowProps) => { |
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.
please also here
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.
😄 👍
); | ||
|
||
type VmTemplateTableRowProps = { | ||
template: K8sResourceKind; |
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.
TemplateKind should be more concrete
key: string; | ||
style: any; | ||
}; | ||
type VirtualMachineTemplatesProps = {}; |
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.
having empty types is not much useful
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.
😎
e3f06b9
to
f2f6812
Compare
f2f6812
to
bd336fe
Compare
@suomiy thanks for the comments 👍 , broke some things in the way, now it's working again :-) |
Kebab.columnClass, | ||
]; | ||
|
||
const VmTempleateTableHeader = () => { |
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.
Typo: VmTemplateTableHeader
.
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.
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. |
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.
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.
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.
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'], |
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.
Nit: no need for `
in static strings.
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.
👍
metadata: | ||
creationTimestamp: null | ||
labels: | ||
kubevirt-vm: 'vm-\${NAME}' |
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'm probably missing something but where does NAME
(and other uppercase-labeled variables) come from?
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.
It's the template pramters, https://docs.okd.io/latest/dev_guide/templates.html#writing-parameters
default values defined here:
https://github.com/openshift/console/pull/1673/files#diff-a05f509d407deb7b65bb87cd43944154R106
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.
@yaacov Thank you for clarification.
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. |
@vojtechszocs Thanks ^^ |
@vojtechszocs @suomiy please review |
@suomiy thanks ! this PR also need lgtm label 🚜 |
/lgtm |
[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 |
Introduces List Page for Virtual Machines.
Override template yaml: