forked from kubevirt/common-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
centos-stream8.tpl.yaml
161 lines (161 loc) · 5.19 KB
/
centos-stream8.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
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: {{ os }}-{{ item.workload }}-{{ item.flavor }}
annotations:
openshift.io/display-name: "CentOS Stream 8 VM"
description: >-
Template for CentOS Stream 8 VM or newer.
A PVC with the CentOS Stream disk image must be available.
tags: "hidden,kubevirt,virtualmachine,linux,centosstream"
iconClass: "icon-{{ icon }}"
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
{% if containerdisk_urls | length > 0 %}
template.kubevirt.io/containerdisks: |
{% for url in containerdisk_urls %}
{{ url }}
{% endfor %}
{% endif %}
{% if image_urls | length > 0 %}
template.kubevirt.io/images: |
{% for url in image_urls %}
{{ url }}
{% endfor %}
{% endif %}
template.kubevirt.io/editable: |
/objects[0].spec.template.spec.domain.cpu.sockets
/objects[0].spec.template.spec.domain.cpu.cores
/objects[0].spec.template.spec.domain.cpu.threads
/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
{% for osl in oslabels %}
name.os.template.kubevirt.io/{{ osl }}: {{ lookup('osinfo', oslabels[0]).name }} or higher
{% endfor %}
labels:
{% for osl in oslabels %}
os.template.kubevirt.io/{{ osl }}: "true"
{% endfor %}
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 %}
objects:
- apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: ${NAME}
labels:
vm.kubevirt.io/template: {{ os }}-{{ 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|all.ram"] }}
}
]
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: ${NAME}
spec:
storage:
resources:
requests:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
annotations:
vm.kubevirt.io/os: "{{ os }}"
vm.kubevirt.io/workload: "{{ item.workload }}"
vm.kubevirt.io/flavor: "{{ item.flavor }}"
labels:
kubevirt.io/domain: ${NAME}
kubevirt.io/size: {{ item.flavor }}
spec:
domain:
{% if item.iothreads %}
ioThreadsPolicy: shared
{% endif %}
cpu:
sockets: {{ item.cpus }}
cores: 1
threads: 1
{% if cpumodel |default("") %}
model: {{ cpumodel }}
{% endif %}
memory:
guest: {{ item.memsize }}
devices:
rng: {}
networkInterfaceMultiqueue: true
{% if item.tablet %}
inputs:
- type: tablet
bus: virtio
name: tablet
{% endif %}
disks:
- disk:
bus: {{ diskbus | default("virtio") }}
name: rootdisk
- disk:
bus: {{ diskbus | default("virtio") }}
name: cloudinitdisk
interfaces:
- masquerade: {}
name: default
model: virtio
terminationGracePeriodSeconds: 180
networks:
- name: default
pod: {}
volumes:
- dataVolume:
name: ${NAME}
name: rootdisk
- cloudInitNoCloud:
userData: |-
#cloud-config
user: {{ cloudusername }}
password: ${CLOUD_USER_PASSWORD}
chpasswd: { expire: False }
name: cloudinitdisk
parameters:
- description: VM name
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
from: '[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}'
generate: expression
name: CLOUD_USER_PASSWORD