Skip to content

Commit c5fec1d

Browse files
authored
Merge pull request #3561 from zhanggbj/bump_zone
🌱 Update topology api
2 parents 765db0d + 479a5dc commit c5fec1d

File tree

5 files changed

+189
-7
lines changed

5 files changed

+189
-7
lines changed

internal/apis/topology/v1alpha1/availability_zone.go

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2021 VMware, Inc. All Rights Reserved.
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
23
// SPDX-License-Identifier: Apache-2.0
34

45
package v1alpha1
@@ -7,6 +8,14 @@ import (
78
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
89
)
910

11+
const (
12+
// AvailabiltyZoneConditionInUse indiciates that the AvailabilityZone is in
13+
// use.
14+
//
15+
// See Zone.Status for more details.
16+
AvailabiltyZoneConditionInUse = "AvailabiltyZoneInUse"
17+
)
18+
1019
// NamespaceInfo contains identifying information about the vSphere resources
1120
// used to represent a Kubernetes namespace on individual vSphere Zones.
1221
type NamespaceInfo struct {
@@ -25,6 +34,24 @@ type NamespaceInfo struct {
2534
FolderMoId string `json:"folderMoId,omitempty"`
2635
}
2736

37+
// SystemInfo contains identifying information about the vSphere resources
38+
// holding or otherwise used by a Supervisor's system-managed resources in an
39+
// individual vSphere Zone.
40+
type SystemInfo struct {
41+
// PoolMoIDs are the managed object IDs of the vSphere ResourcePools for
42+
// this Supervisor's system-managed resources within a zone. A zone may be
43+
// comprised of multiple ResourcePools.
44+
// +optional
45+
PoolMoIDs []string `json:"poolMoIDs,omitempty"`
46+
47+
// FolderMoID is the managed object ID of the vSphere Folder for this
48+
// Supervisor's system-managed resources. Folders are global and not scoped to
49+
// a zone or vSphere cluster, but the FolderMoID is stored here for
50+
// convenience.
51+
// +optional
52+
FolderMoID string `json:"folderMoID,omitempty"`
53+
}
54+
2855
// AvailabilityZoneSpec defines the desired state of AvailabilityZone.
2956
type AvailabilityZoneSpec struct {
3057
// ClusterComputeResourceMoId is the managed object ID of the vSphere
@@ -35,13 +62,26 @@ type AvailabilityZoneSpec struct {
3562
// ClusterComputeResources represented by this availability zone.
3663
ClusterComputeResourceMoIDs []string `json:"clusterComputeResourceMoIDs,omitempty"`
3764

65+
// SystemInfo holds identifying information about vSphere resource grouping
66+
// objects used by the Supervisor's system objects. These are typically
67+
// the top Supervisor-level "Namespaces" Resource Pools and Folder.
68+
// +optional
69+
SystemInfo *SystemInfo `json:"systemInfo,omitempty"`
70+
3871
// Namespaces is a map that enables querying information about the vSphere
3972
// objects that make up a Kubernetes Namespace based on its name.
4073
Namespaces map[string]NamespaceInfo `json:"namespaces,omitempty"`
4174
}
4275

4376
// AvailabilityZoneStatus defines the observed state of AvailabilityZone.
4477
type AvailabilityZoneStatus struct {
78+
// +optional
79+
// Conditions describes the observed conditions of the AvailabilityZone
80+
Conditions []metav1.Condition `json:"conditions,omitempty"`
81+
82+
// +optional
83+
// MarkedForRemoval describes if the AvailabiltyZone is marked for removal.
84+
MarkedForRemoval bool `json:"markedForRemoval,omitempty"`
4585
}
4686

4787
// AvailabilityZone is the schema for the AvailabilityZone resource for the

internal/apis/topology/v1alpha1/groupversion_info.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2021 VMware, Inc. All Rights Reserved.
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
23
// SPDX-License-Identifier: Apache-2.0
34

45
// Package v1alpha1 contains API Schema definitions for vSphere topology APIs.

internal/apis/topology/v1alpha1/vsphere_zone.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2022 VMware, Inc. All Rights Reserved.
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
23
// SPDX-License-Identifier: Apache-2.0
34

45
package v1alpha1

internal/apis/topology/v1alpha1/zone.go

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2024 VMware, Inc. All Rights Reserved.
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
23
// SPDX-License-Identifier: Apache-2.0
34

45
package v1alpha1
@@ -7,6 +8,23 @@ import (
78
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
89
)
910

11+
const (
12+
// ZoneConditionPersistentVolumeClaimsExist indicates that PVCs exist in the
13+
// Zone.
14+
ZoneConditionPersistentVolumeClaimsExist = "ZonePersistentVolumeClaimsExist"
15+
16+
// ZoneConditionPodsExist indicates that Pods exist in the Zone.
17+
ZoneConditionPodsExist = "ZonePodsExist"
18+
19+
// ZoneConditionVirtualMachinesExist indicates that VirtualMachines exist
20+
// in the Zone.
21+
ZoneConditionVirtualMachinesExist = "ZoneVirtualMachinesExist"
22+
23+
// ZoneConditionNamespaceResourcePoolReconciled indicates that the
24+
// Namespace ResourcePool has been reconciled.
25+
ZoneConditionNamespaceResourcePoolReconciled = "ZoneNamespaceResourcePoolReconciled"
26+
)
27+
1028
// AvailabilityZoneReference describes a reference to the cluster scoped
1129
// AvailabilityZone object.
1230
type AvailabilityZoneReference struct {
@@ -21,6 +39,11 @@ type AvailabilityZoneReference struct {
2139
// VSphereEntityInfo contains the managed object IDs associated with
2240
// a vSphere entity
2341
type VSphereEntityInfo struct {
42+
// +optional
43+
// ClusterMoIDs are the managed object IDs of the vSphere Clusters in an
44+
// individual vSphere Zone. A zone may be comprised of multiple Clusters.
45+
ClusterMoIDs []string `json:"clusterMoIDs,omitempty"`
46+
2447
// +optional
2548
// PoolMoIDs are the managed object ID of the vSphere ResourcePools
2649
// in an individual vSphere Zone. A zone may be comprised of
@@ -33,6 +56,18 @@ type VSphereEntityInfo struct {
3356
FolderMoID string `json:"folderMoID,omitempty"`
3457
}
3558

59+
// VirtualMachineClassAllocationInfo describes the definition of allocations
60+
// for Virtual Machines of a given class.
61+
type VirtualMachineClassAllocationInfo struct {
62+
// +optional
63+
// Identifier of the Virtual Machine class used for allocation.
64+
ReservedVMClass string `json:"reservedVmClass,omitempty"`
65+
66+
// +optional
67+
// Number of instances of given Virtual Machine class.
68+
Count int64 `json:"count,omitempty"`
69+
}
70+
3671
// ZoneSpec contains identifying information about the
3772
// vSphere resources used to represent a Kubernetes namespace on individual
3873
// vSphere Zones.
@@ -51,13 +86,55 @@ type ZoneSpec struct {
5186
// Zone is a reference to the cluster scoped AvailabilityZone this
5287
// Zone is derived from.
5388
Zone AvailabilityZoneReference `json:"availabilityZoneReference"`
89+
90+
// +optional
91+
// Guaranteed number of reserved Virtual Machine class instances that are available for the
92+
// namespace in this zone.
93+
VirtualMachineReservations []VirtualMachineClassAllocationInfo `json:"virtualMachineReservations,omitempty"`
94+
95+
// +optional
96+
// CPU limit (in megahertz) for the namespace in this zone in addition to the limits specified as part of
97+
// reserved Virtual Machine classes.
98+
CPULimitMHz int64 `json:"cpuLimitMHz,omitempty"`
99+
100+
// +optional
101+
// CPU reservation (in megahertz) for the namespace in this zone, for VMs
102+
// that are not using reserved Virtual Machine class instances.
103+
CPUReservationMHz int64 `json:"cpuReservationMHz,omitempty"`
104+
105+
// +optional
106+
// Memory limit (in mebibytes) for the namespace in this zone in addition
107+
// to the limits specified as part of reserved Virtual Machine classes.
108+
MemoryLimitMiB int64 `json:"memoryLimitMiB,omitempty"`
109+
110+
// +optional
111+
// Memory reservation (in mebibytes) for the namespace in this zone, for
112+
// VMs that are not using reserved Virtual Machine class instances.
113+
MemoryReservationMiB int64 `json:"memoryReservationMiB,omitempty"`
114+
115+
// +optional
116+
// Determines whether workloads that don't use a reserved Virtual Machine class
117+
// instance can use a DirectPath device.
118+
DisallowUnreservedDirectPathUsage bool `json:"disallowUnreservedDirectPathUsage,omitempty"`
119+
120+
// +optional
121+
// AllowedClusterComputeResourceMoIDs are the managed object IDs of the vSphere
122+
// ClusterComputeResources in this vSphere Zone on which workloads in this Supervisor
123+
// Namespace can be placed on. If empty, all the vSphere Clusters in the vSphere Zone are
124+
// candidates to place the workloads in this vSphere Namespace.
125+
AllowedClusterComputeResourceMoIDs []string `json:"allowedClusterComputeResourceMoIDs,omitempty"`
54126
}
55127

56128
// ZoneStatus defines the observed state of Zone.
57129
type ZoneStatus struct {
58130
// +optional
59131
// Conditions describes the observed conditions of the Zone
60132
Conditions []metav1.Condition `json:"conditions,omitempty"`
133+
134+
// +optional
135+
// MarkedForRemoval describes if the Zone is marked for removal from the
136+
// Namespace.
137+
MarkedForRemoval bool `json:"markedForRemoval,omitempty"`
61138
}
62139

63140
// Zone is the schema for the Zone resource for the vSphere topology API.

internal/apis/topology/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)