Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './vm-template-yaml-templates';
export * from './vm-yaml-templates';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: as this is already under models/templates, do we need the extra -templates at the end of the filename?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

Original file line number Diff line number Diff line change
@@ -1,50 +1,10 @@
import { Map as ImmutableMap } from 'immutable';

import { TemplateModel } from '@console/internal/models';
import { VirtualMachineModel } from './models';

export const yamlTemplates = ImmutableMap()
.setIn(
[VirtualMachineModel, 'default'],
`
apiVersion: ${VirtualMachineModel.apiGroup}/${VirtualMachineModel.apiVersion}
kind: ${VirtualMachineModel.kind}
metadata:
name: example
spec:
running: false
template:
spec:
domain:
devices:
disks:
- name: containerdisk
disk:
bus: virtio
- name: cloudinitdisk
disk:
bus: virtio
interfaces:
- name: default
bridge: {}
resources:
requests:
memory: 64M
networks:
- name: default
pod: {}
volumes:
- name: containerdisk
containerDisk:
image: kubevirt/cirros-registry-disk-demo
- name: cloudinitdisk
cloudInitNoCloud:
userDataBase64: SGkuXG4=
`,
)
.setIn(
[TemplateModel, 'vm-template'],
`
export const VmTemplateYAMLTemplates = ImmutableMap().setIn(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please rename to either VirtualMachineTemplate... or VMTemplate...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍 Nice

['vm-template'],
`
apiVersion: ${TemplateModel.apiGroup}/${TemplateModel.apiVersion}
kind: ${TemplateModel.kind}
metadata:
Expand Down Expand Up @@ -113,4 +73,4 @@ parameters:
description: Amount of cores
value: '4'
`,
);
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Map as ImmutableMap } from 'immutable';

import { VirtualMachineModel } from '..';

export const VirtualMachineYAMLTemplates = ImmutableMap().setIn(
['default'],
`
apiVersion: ${VirtualMachineModel.apiGroup}/${VirtualMachineModel.apiVersion}
kind: ${VirtualMachineModel.kind}
metadata:
name: example
spec:
running: false
template:
spec:
domain:
devices:
disks:
- name: containerdisk
disk:
bus: virtio
- name: cloudinitdisk
disk:
bus: virtio
interfaces:
- name: default
bridge: {}
resources:
requests:
memory: 64M
networks:
- name: default
pod: {}
volumes:
- name: containerdisk
containerDisk:
image: kubevirt/cirros-registry-disk-demo
- name: cloudinitdisk
cloudInitNoCloud:
userDataBase64: SGkuXG4=
`,
);
6 changes: 3 additions & 3 deletions frontend/packages/kubevirt-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { TemplateModel } from '@console/internal/models';

import * as models from './models';
import { yamlTemplates } from './yaml-templates';
import { VmTemplateYAMLTemplates, VirtualMachineYAMLTemplates } from './models/templates';

import './style.scss';

Expand Down Expand Up @@ -82,14 +82,14 @@ const plugin: Plugin<ConsumedExtensions> = [
type: 'YAMLTemplate',
properties: {
model: models.VirtualMachineModel,
template: yamlTemplates.getIn([models.VirtualMachineModel, 'default']),
template: VirtualMachineYAMLTemplates.getIn(['default']),
},
},
{
type: 'YAMLTemplate',
properties: {
model: TemplateModel,
template: yamlTemplates.getIn([TemplateModel, 'vm-template']),
template: VmTemplateYAMLTemplates.getIn(['vm-template']),
templateName: 'vm-template',
},
},
Expand Down