From 885e2bc4163cc466fca3a0634cf51e9da00f0a26 Mon Sep 17 00:00:00 2001 From: Karel Simon Date: Wed, 9 Aug 2023 12:28:13 +0200 Subject: [PATCH] feat: replace vm.spec.template.spec.domain.resources.requests.memory with vm.spec.template.spec.domain.memory.guest the path vm.spec.template.spec.domain.memory.guest is used for setting the memory the guest can use. Signed-off-by: Karel Simon --- automation/validate-min-memory-consistency.py | 2 +- templates/README.md | 4 ++-- templates/VALIDATION.md | 4 ++-- templates/centos-stream8.tpl.yaml | 9 ++++----- templates/centos-stream9.tpl.yaml | 9 ++++----- templates/centos6.tpl.yaml | 9 ++++----- templates/centos7.tpl.yaml | 9 ++++----- templates/fedora.tpl.yaml | 9 ++++----- templates/opensuse.tpl.yaml | 9 ++++----- templates/rhel7.tpl.yaml | 9 ++++----- templates/rhel8.tpl.yaml | 9 ++++----- templates/rhel9.tpl.yaml | 9 ++++----- templates/ubuntu.tpl.yaml | 9 ++++----- templates/windows10.tpl.yaml | 9 ++++----- templates/windows11.tpl.yaml | 9 ++++----- templates/windows2k12.tpl.yaml | 9 ++++----- templates/windows2k16.tpl.yaml | 9 ++++----- templates/windows2k19.tpl.yaml | 9 ++++----- templates/windows2k22.tpl.yaml | 9 ++++----- 19 files changed, 69 insertions(+), 85 deletions(-) diff --git a/automation/validate-min-memory-consistency.py b/automation/validate-min-memory-consistency.py index f18d6ba0..af64aa18 100644 --- a/automation/validate-min-memory-consistency.py +++ b/automation/validate-min-memory-consistency.py @@ -23,7 +23,7 @@ def newestOsLabel(template): def minMemoryReqInTemplate(template): object = template["objects"][0] - min_str = object["spec"]["template"]["spec"]["domain"]["resources"]["requests"]["memory"] + min_str = object["spec"]["template"]["spec"]["domain"]["memory"]["guest"] if min_str.startswith("${"): for param in template["parameters"]: if param["name"] == min_str[2:-1]: diff --git a/templates/README.md b/templates/README.md index 0a532bdd..87f4a290 100644 --- a/templates/README.md +++ b/templates/README.md @@ -76,7 +76,7 @@ metadata: # The jsonpath root is the objects: element of the template template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -211,7 +211,7 @@ metadata: # The jsonpath root is the spec: element of the VM object template.kubevirt.io/keep: | /template.spec.domain.cpu.cores - /template.spec.domain.resources.requests.memory + /template.spec.domain.memory.guest /template.spec.domain.devices.disks /template.spec.volumes /template.spec.networks diff --git a/templates/VALIDATION.md b/templates/VALIDATION.md index 4f625211..e61a4de9 100644 --- a/templates/VALIDATION.md +++ b/templates/VALIDATION.md @@ -59,12 +59,12 @@ the `jsonpath::` prefix. good: ``` -jsonpath::.spec.domain.resources.requests.memory +jsonpath::.spec.domain.memory.guest ``` bad: ``` -.spec.domain.resources.requests.memory +.spec.domain.memory.guest ``` ### Validation rules diff --git a/templates/centos-stream8.tpl.yaml b/templates/centos-stream8.tpl.yaml index 230210ac..48403e5a 100644 --- a/templates/centos-stream8.tpl.yaml +++ b/templates/centos-stream8.tpl.yaml @@ -31,7 +31,7 @@ metadata: /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.resources.requests.memory + /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 @@ -64,7 +64,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -107,9 +107,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/centos-stream9.tpl.yaml b/templates/centos-stream9.tpl.yaml index bab8dc02..37737c01 100644 --- a/templates/centos-stream9.tpl.yaml +++ b/templates/centos-stream9.tpl.yaml @@ -31,7 +31,7 @@ metadata: /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.resources.requests.memory + /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 @@ -64,7 +64,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -107,9 +107,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/centos6.tpl.yaml b/templates/centos6.tpl.yaml index 9be5bf19..b512ff4a 100644 --- a/templates/centos6.tpl.yaml +++ b/templates/centos6.tpl.yaml @@ -21,7 +21,7 @@ metadata: /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.resources.requests.memory + /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 @@ -54,7 +54,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -97,9 +97,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: networkInterfaceMultiqueue: true useVirtioTransitional: true diff --git a/templates/centos7.tpl.yaml b/templates/centos7.tpl.yaml index 9b13b4b8..a853e898 100644 --- a/templates/centos7.tpl.yaml +++ b/templates/centos7.tpl.yaml @@ -31,7 +31,7 @@ metadata: /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.resources.requests.memory + /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 @@ -64,7 +64,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -107,9 +107,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/fedora.tpl.yaml b/templates/fedora.tpl.yaml index 9de4c30e..f305be67 100644 --- a/templates/fedora.tpl.yaml +++ b/templates/fedora.tpl.yaml @@ -30,7 +30,7 @@ metadata: /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.resources.requests.memory + /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 @@ -63,7 +63,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -118,9 +118,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/opensuse.tpl.yaml b/templates/opensuse.tpl.yaml index ed7c5553..d98ba256 100644 --- a/templates/opensuse.tpl.yaml +++ b/templates/opensuse.tpl.yaml @@ -25,7 +25,7 @@ metadata: /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.resources.requests.memory + /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 @@ -58,7 +58,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -101,9 +101,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/rhel7.tpl.yaml b/templates/rhel7.tpl.yaml index 4d665ce4..c2bad188 100644 --- a/templates/rhel7.tpl.yaml +++ b/templates/rhel7.tpl.yaml @@ -25,7 +25,7 @@ metadata: /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.resources.requests.memory + /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 @@ -58,7 +58,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -107,9 +107,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/rhel8.tpl.yaml b/templates/rhel8.tpl.yaml index d111ad18..855b8788 100644 --- a/templates/rhel8.tpl.yaml +++ b/templates/rhel8.tpl.yaml @@ -27,7 +27,7 @@ metadata: /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.resources.requests.memory + /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 @@ -60,7 +60,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -109,9 +109,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/rhel9.tpl.yaml b/templates/rhel9.tpl.yaml index 3224c860..ac93bf74 100644 --- a/templates/rhel9.tpl.yaml +++ b/templates/rhel9.tpl.yaml @@ -27,7 +27,7 @@ metadata: /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.resources.requests.memory + /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 @@ -60,7 +60,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -109,9 +109,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/ubuntu.tpl.yaml b/templates/ubuntu.tpl.yaml index 2f204d1c..b47ae5b7 100644 --- a/templates/ubuntu.tpl.yaml +++ b/templates/ubuntu.tpl.yaml @@ -31,7 +31,7 @@ metadata: /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.resources.requests.memory + /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 @@ -64,7 +64,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -107,9 +107,8 @@ objects: {% if cpumodel |default("") %} model: {{ cpumodel }} {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} devices: rng: {} networkInterfaceMultiqueue: true diff --git a/templates/windows10.tpl.yaml b/templates/windows10.tpl.yaml index abefd253..5f6aceee 100644 --- a/templates/windows10.tpl.yaml +++ b/templates/windows10.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -122,9 +122,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {} diff --git a/templates/windows11.tpl.yaml b/templates/windows11.tpl.yaml index a4c02ceb..43e1e159 100644 --- a/templates/windows11.tpl.yaml +++ b/templates/windows11.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.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"] }} @@ -128,9 +128,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {} diff --git a/templates/windows2k12.tpl.yaml b/templates/windows2k12.tpl.yaml index 52af4b9a..dc8d90dd 100644 --- a/templates/windows2k12.tpl.yaml +++ b/templates/windows2k12.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.memory", + "path": "jsonpath::.spec.domain.memory.guest", "rule": "integer", "message": "This VM requires more memory.", "min": {{ lookup('osinfo', osinfoname)["minimum_resources.0.ram"] }} @@ -122,9 +122,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {} diff --git a/templates/windows2k16.tpl.yaml b/templates/windows2k16.tpl.yaml index 8c3c9ac0..c34d8391 100644 --- a/templates/windows2k16.tpl.yaml +++ b/templates/windows2k16.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.memory", + "path": "jsonpath::.spec.domain.memory.guest", "rule": "integer", "message": "This VM requires more memory.", "min": {{ lookup('osinfo', osinfoname)["minimum_resources.0.ram"] }} @@ -122,9 +122,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {} diff --git a/templates/windows2k19.tpl.yaml b/templates/windows2k19.tpl.yaml index 714142c3..f0afbd51 100644 --- a/templates/windows2k19.tpl.yaml +++ b/templates/windows2k19.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.memory", + "path": "jsonpath::.spec.domain.memory.guest", "rule": "integer", "message": "This VM requires more memory.", "min": {{ lookup('osinfo', osinfoname)["minimum_resources.0.ram"] }} @@ -122,9 +122,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {} diff --git a/templates/windows2k22.tpl.yaml b/templates/windows2k22.tpl.yaml index dd484896..b886dc29 100644 --- a/templates/windows2k22.tpl.yaml +++ b/templates/windows2k22.tpl.yaml @@ -18,7 +18,7 @@ metadata: defaults.template.kubevirt.io/network: default template.kubevirt.io/editable: | /objects[0].spec.template.spec.domain.cpu.cores - /objects[0].spec.template.spec.domain.resources.requests.memory + /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 @@ -47,7 +47,7 @@ objects: [ { "name": "minimal-required-memory", - "path": "jsonpath::.spec.domain.resources.requests.memory", + "path": "jsonpath::.spec.domain.memory.guest", "rule": "integer", "message": "This VM requires more memory.", "min": {{ lookup('osinfo', osinfoname)["minimum_resources.0.ram"] }} @@ -122,9 +122,8 @@ objects: {% if item.emulatorthread %} isolateEmulatorThread: True {% endif %} - resources: - requests: - memory: {{ item.memsize }} + memory: + guest: {{ item.memsize }} features: acpi: {} apic: {}