Skip to content

Commit 74831c6

Browse files
Ensure backwards compatibility
1 parent 906a154 commit 74831c6

File tree

7 files changed

+257
-123
lines changed

7 files changed

+257
-123
lines changed

api/v1/hypervisor_types.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,20 @@ type OperatingSystemStatus struct {
196196
GardenLinuxFeatures []string `json:"gardenLinuxFeatures,omitempty"`
197197
}
198198

199-
// Compute capabilities relevant to check if a VM
200-
// can be scheduled on the hypervisor.
199+
// Capabilities of the hypervisor as reported by libvirt.
201200
type Capabilities struct {
201+
// +kubebuilder:default:=unknown
202+
// The hosts CPU architecture (not the guests).
203+
HostCpuArch string `json:"cpuArch,omitempty"`
204+
// Total host memory available as a sum of memory over all numa cells.
205+
HostMemory resource.Quantity `json:"memory,omitempty"`
206+
// Total host cpus available as a sum of cpus over all numa cells.
207+
HostCpus resource.Quantity `json:"cpus,omitempty"`
208+
}
209+
210+
// Domain capabilities of the hypervisor as reported by libvirt.
211+
// These details are relevant to check if a VM can be scheduled on the hypervisor.
212+
type DomainCapabilities struct {
202213
// +kubebuilder:default:=unknown
203214
// The available domain cpu architecture.
204215
Arch string `json:"arch,omitempty"`
@@ -231,9 +242,12 @@ type HypervisorStatus struct {
231242
// Represents the Hypervisor hosted Virtual Machines
232243
Instances []Instance `json:"instances,omitempty"`
233244

234-
// Auto-discovered compute capabilities relevant to check if a VM
245+
// Auto-discovered capabilities as reported by libvirt.
246+
Capabilities Capabilities `json:"capabilities"`
247+
248+
// Auto-discovered domain capabilities relevant to check if a VM
235249
// can be scheduled on the hypervisor.
236-
Capabilities Capabilities `json:"capabilities,omitempty"`
250+
DomainCapabilities DomainCapabilities `json:"domainCapabilities"`
237251

238252
// +kubebuilder:default:={}
239253
// Auto-discovered capacity available in total on the hypervisor.

api/v1/zz_generated.deepcopy.go

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/capabilities.go

Lines changed: 20 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/domaincapabilities.go

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/hypervisorstatus.go

Lines changed: 25 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/openstack-hypervisor-operator/crds/hypervisor-crd.yaml

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.19.0
5+
controller-gen.kubebuilder.io/version: v0.18.0
66
name: hypervisors.kvm.cloud.sap
77
spec:
88
group: kvm.cloud.sap
@@ -206,38 +206,28 @@ spec:
206206
on the hypervisor. Note that this does not include reserved capacity.
207207
type: object
208208
capabilities:
209-
description: |-
210-
Auto-discovered compute capabilities relevant to check if a VM
211-
can be scheduled on the hypervisor.
209+
description: Auto-discovered capabilities as reported by libvirt.
212210
properties:
213-
arch:
211+
cpuArch:
214212
default: unknown
215-
description: The available domain cpu architecture.
213+
description: The hosts CPU architecture (not the guests).
216214
type: string
217-
hypervisorType:
218-
default: unknown
219-
description: The supported type of virtualization for domains,
220-
such as "ch".
221-
type: string
222-
supportedCpuModes:
223-
default: []
224-
description: Supported cpu modes for domains, such as "host-passthrough".
225-
items:
226-
type: string
227-
type: array
228-
supportedDevices:
229-
default: []
230-
description: Supported devices for domains, such as "video".
231-
items:
232-
type: string
233-
type: array
234-
supportedFeatures:
235-
default: []
236-
description: Supported features for domains, such as "sev" or
237-
"sgx".
238-
items:
239-
type: string
240-
type: array
215+
cpus:
216+
anyOf:
217+
- type: integer
218+
- type: string
219+
description: Total host cpus available as a sum of cpus over all
220+
numa cells.
221+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
222+
x-kubernetes-int-or-string: true
223+
memory:
224+
anyOf:
225+
- type: integer
226+
- type: string
227+
description: Total host memory available as a sum of memory over
228+
all numa cells.
229+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
230+
x-kubernetes-int-or-string: true
241231
type: object
242232
capacity:
243233
additionalProperties:
@@ -309,6 +299,40 @@ spec:
309299
- type
310300
type: object
311301
type: array
302+
domainCapabilities:
303+
description: |-
304+
Auto-discovered domain capabilities relevant to check if a VM
305+
can be scheduled on the hypervisor.
306+
properties:
307+
arch:
308+
default: unknown
309+
description: The available domain cpu architecture.
310+
type: string
311+
hypervisorType:
312+
default: unknown
313+
description: The supported type of virtualization for domains,
314+
such as "ch".
315+
type: string
316+
supportedCpuModes:
317+
default: []
318+
description: Supported cpu modes for domains, such as "host-passthrough".
319+
items:
320+
type: string
321+
type: array
322+
supportedDevices:
323+
default: []
324+
description: Supported devices for domains, such as "video".
325+
items:
326+
type: string
327+
type: array
328+
supportedFeatures:
329+
default: []
330+
description: Supported features for domains, such as "sev" or
331+
"sgx".
332+
items:
333+
type: string
334+
type: array
335+
type: object
312336
evicted:
313337
description: Evicted indicates whether the hypervisor is evicted.
314338
(no instances left with active maintenance mode)

0 commit comments

Comments
 (0)