-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Introduce a feature flag to enable Namespace Scoped Zone. - Enhance zone discovery to support Namespace Scoped Zones. - Filter out zones marked for deletion during the discovery process. Signed-off-by: Gong Zhang <[email protected]>
- Loading branch information
Showing
14 changed files
with
866 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
//nolint:revive | ||
//nolint:stylecheck | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// NamespaceInfo contains identifying information about the vSphere resources | ||
// used to represent a Kubernetes namespace on individual vSphere Zones. | ||
type NamespaceInfo struct { | ||
// PoolMoId is the managed object ID of the vSphere ResourcePool for a | ||
// Namespace on an individual vSphere Cluster. | ||
PoolMoId string `json:"poolMoId,omitempty"` | ||
|
||
// PoolMoIDs are the managed object ID of the vSphere ResourcePools for a | ||
// Namespace in an individual vSphere Zone. A zone may be comprised of | ||
// multiple ResourcePools. | ||
PoolMoIDs []string `json:"poolMoIDs,omitempty"` | ||
|
||
// FolderMoId is the managed object ID of the vSphere Folder for a | ||
// Namespace. Folders are global and not per-vSphere Cluster, but the | ||
// FolderMoId is stored here, alongside the PoolMoId for convenience. | ||
FolderMoId string `json:"folderMoId,omitempty"` | ||
} | ||
|
||
// AvailabilityZoneSpec defines the desired state of AvailabilityZone. | ||
type AvailabilityZoneSpec struct { | ||
// ClusterComputeResourceMoId is the managed object ID of the vSphere | ||
// ClusterComputeResource represented by this availability zone. | ||
ClusterComputeResourceMoId string `json:"clusterComputeResourceMoId,omitempty"` | ||
|
||
// ClusterComputeResourceMoIDs are the managed object IDs of the vSphere | ||
// ClusterComputeResources represented by this availability zone. | ||
ClusterComputeResourceMoIDs []string `json:"clusterComputeResourceMoIDs,omitempty"` | ||
|
||
// Namespaces is a map that enables querying information about the vSphere | ||
// objects that make up a Kubernetes Namespace based on its name. | ||
Namespaces map[string]NamespaceInfo `json:"namespaces,omitempty"` | ||
} | ||
|
||
// AvailabilityZoneStatus defines the observed state of AvailabilityZone. | ||
type AvailabilityZoneStatus struct { | ||
} | ||
|
||
// AvailabilityZone is the schema for the AvailabilityZone resource for the | ||
// vSphere topology API. | ||
// | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=availabilityzones,scope=Cluster,shortName=az | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:subresource:status | ||
type AvailabilityZone struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec AvailabilityZoneSpec `json:"spec,omitempty"` | ||
Status AvailabilityZoneStatus `json:"status,omitempty"` | ||
} | ||
|
||
// AvailabilityZoneList contains a list of AvailabilityZone resources. | ||
// | ||
// +kubebuilder:object:root=true | ||
type AvailabilityZoneList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []AvailabilityZone `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&AvailabilityZone{}, &AvailabilityZoneList{}) | ||
} |
Oops, something went wrong.