-
Notifications
You must be signed in to change notification settings - Fork 65
/
windows10.tpl.yaml
196 lines (196 loc) · 6.34 KB
/
windows10.tpl.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: windows10-{{ item.workload }}-{{ item.flavor }}
annotations:
openshift.io/display-name: "Microsoft Windows 10 VM"
description: >-
Template for Microsoft Windows 10 VM.
A PVC with the Windows disk image must be available.
tags: "hidden,kubevirt,virtualmachine,windows"
iconClass: "icon-windows"
openshift.io/provider-display-name: "KubeVirt"
openshift.io/documentation-url: "https://github.com/kubevirt/common-templates"
openshift.io/support-url: "https://github.com/kubevirt/common-templates/issues"
template.openshift.io/bindable: "false"
template.kubevirt.io/version: v1alpha1
defaults.template.kubevirt.io/disk: rootdisk
defaults.template.kubevirt.io/network: default
template.kubevirt.io/editable: |
/objects[0].spec.template.spec.domain.cpu.cores
/objects[0].spec.template.spec.domain.memory.guest
/objects[0].spec.template.spec.domain.devices.disks
/objects[0].spec.template.spec.volumes
/objects[0].spec.template.spec.networks
name.os.template.kubevirt.io/win10: {{ lookup('osinfo', 'win10').name }}
labels:
os.template.kubevirt.io/win10: "true"
workload.template.kubevirt.io/{{ item.workload }}: "true"
flavor.template.kubevirt.io/{{ item.flavor }}: "true"
template.kubevirt.io/type: "base"
template.kubevirt.io/version: "{{ lookup('env', 'VERSION') | default('devel', true) }}"
{% if item.default %}
template.kubevirt.io/default-os-variant: "true"
{% endif %}
template.kubevirt.io/architecture: "amd64"
objects:
- apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: ${NAME}
labels:
vm.kubevirt.io/template: windows10-{{ item.workload }}-{{ item.flavor }}
vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}"
vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}"
app: ${NAME}
annotations:
vm.kubevirt.io/validations: |
[
{
"name": "minimal-required-memory",
"path": "jsonpath::.spec.domain.memory.guest",
"rule": "integer",
"message": "This VM requires more memory.",
"min": {{ lookup('osinfo', osinfoname)["minimum_resources.architecture=x86_64.ram"] }}
}, {
"name": "windows-virtio-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "virtio disk bus type has better performance, install virtio drivers in VM and change bus type",
"values": ["virtio"],
"justWarning": true
}, {
"name": "windows-disk-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "disk bus has to be either virtio or sata or scsi",
"values": ["virtio", "sata", "scsi"]
}, {
"name": "windows-cd-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*].cdrom.bus",
"rule": "enum",
"message": "cd bus has to be sata",
"values": ["sata"]
}
]
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: ${NAME}
spec:
storage:
resources:
requests:
storage: 60Gi
sourceRef:
kind: DataSource
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
runStrategy: Halted
template:
metadata:
annotations:
vm.kubevirt.io/os: "windows10"
vm.kubevirt.io/workload: "{{ item.workload }}"
vm.kubevirt.io/flavor: "{{ item.flavor }}"
labels:
kubevirt.io/domain: ${NAME}
kubevirt.io/size: {{ item.flavor }}
spec:
architecture: amd64
domain:
clock:
utc: {}
timer:
hpet:
present: false
pit:
tickPolicy: delay
rtc:
tickPolicy: catchup
hyperv: {}
cpu:
sockets: {{ item.cpus }}
cores: 1
threads: 1
{% if item.iothreads or item.emulatorthread %}
dedicatedCpuPlacement: True
{% endif %}
{% if item.emulatorthread %}
isolateEmulatorThread: True
{% endif %}
memory:
guest: {{ item.memsize }}
features:
acpi: {}
apic: {}
smm: {}
hyperv:
relaxed: {}
vapic: {}
vpindex: {}
spinlocks:
spinlocks: 8191
synic: {}
synictimer:
direct: {}
tlbflush: {}
frequencies: {}
reenlightenment: {}
ipi: {}
runtime: {}
reset: {}
firmware:
bootloader:
efi:
secureBoot: true
devices:
{% if item.multiqueue and item.cpus > 1 %}
networkInterfaceMultiqueue: True
{% endif %}
disks:
- disk:
{% if item.workload == "highperformance" %}
bus: virtio
{% else %}
bus: sata
{% endif %}
name: rootdisk
interfaces:
- masquerade: {}
{% if item.multiqueue %}
model: virtio
{% else %}
model: e1000e
{% endif %}
name: default
{% if item.tablet %}
inputs:
- type: tablet
bus: usb
name: tablet
{% endif %}
terminationGracePeriodSeconds: 3600
volumes:
- dataVolume:
name: ${NAME}
name: rootdisk
networks:
- name: default
pod: {}
parameters:
- name: NAME
description: VM name
generate: expression
from: "windows10-[a-z0-9]{6}"
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: win10
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images