-
Notifications
You must be signed in to change notification settings - Fork 295
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
786 additions
and
565 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,73 @@ | ||
// Copyright (c) 2021 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
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{}) | ||
} |
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,26 @@ | ||
// Copyright (c) 2021 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package v1alpha1 contains API Schema definitions for vSphere topology APIs. | ||
// +kubebuilder:object:generate=true | ||
// +groupName=topology.tanzu.vmware.com | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{ | ||
Group: "topology.tanzu.vmware.com", | ||
Version: "v1alpha1", | ||
} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
Oops, something went wrong.