-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #552 from lxiaopei/topic/lxiaopei/networkinfo
Add NetworkInfo CR
- Loading branch information
Showing
18 changed files
with
876 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.11.0 | ||
creationTimestamp: null | ||
name: networkinfoes.nsx.vmware.com | ||
spec: | ||
group: nsx.vmware.com | ||
names: | ||
kind: NetworkInfo | ||
listKind: NetworkInfoList | ||
plural: networkinfoes | ||
singular: networkinfo | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: NetworkInfo is used to report the network information for a namespace. | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
vpcs: | ||
items: | ||
description: VPCState defines information for VPC. | ||
properties: | ||
defaultSNATIP: | ||
description: Default SNAT IP for Private Subnets. | ||
type: string | ||
loadBalancerIPAddresses: | ||
description: LoadBalancerIPAddresses (AVI SE Subnet CIDR or NSX | ||
LB SNAT IPs). | ||
type: string | ||
name: | ||
description: VPC name. | ||
type: string | ||
privateIPv4CIDRs: | ||
description: Private CIDRs used for the VPC. | ||
items: | ||
type: string | ||
type: array | ||
vpcPath: | ||
description: NSX Policy path for VPC. | ||
type: string | ||
required: | ||
- defaultSNATIP | ||
- name | ||
- vpcPath | ||
type: object | ||
type: array | ||
required: | ||
- vpcs | ||
type: object | ||
served: true | ||
storage: true |
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,47 @@ | ||
/* Copyright © 2024 VMware, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
//+kubebuilder:object:root=true | ||
//+kubebuilder:storageversion | ||
|
||
// NetworkInfo is used to report the network information for a namespace. | ||
type NetworkInfo struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
VPCs []VPCState `json:"vpcs"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// NetworkInfoList contains a list of NetworkInfo. | ||
type NetworkInfoList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NetworkInfo `json:"items"` | ||
} | ||
|
||
// VPCState defines information for VPC. | ||
type VPCState struct { | ||
// VPC name. | ||
Name string `json:"name"` | ||
// NSX Policy path for VPC. | ||
VPCPath string `json:"vpcPath"` | ||
// Default SNAT IP for Private Subnets. | ||
DefaultSNATIP string `json:"defaultSNATIP"` | ||
// LoadBalancerIPAddresses (AVI SE Subnet CIDR or NSX LB SNAT IPs). | ||
LoadBalancerIPAddresses string `json:"loadBalancerIPAddresses,omitempty"` | ||
// Private CIDRs used for the VPC. | ||
PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NetworkInfo{}, &NetworkInfoList{}) | ||
} |
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
109 changes: 103 additions & 6 deletions
109
pkg/apis/nsx.vmware.com/v1alpha1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
/* Copyright © 2024 VMware, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +genclient | ||
//+kubebuilder:object:root=true | ||
//+kubebuilder:storageversion | ||
|
||
// NetworkInfo is used to report the network information for a namespace. | ||
type NetworkInfo struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
VPCs []VPCState `json:"vpcs"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// NetworkInfoList contains a list of NetworkInfo. | ||
type NetworkInfoList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NetworkInfo `json:"items"` | ||
} | ||
|
||
// VPCState defines information for VPC. | ||
type VPCState struct { | ||
// VPC name. | ||
Name string `json:"name"` | ||
// NSX Policy path for VPC. | ||
VPCPath string `json:"vpcPath"` | ||
// Default SNAT IP for Private Subnets. | ||
DefaultSNATIP string `json:"defaultSNATIP"` | ||
// LoadBalancerIPAddresses (AVI SE Subnet CIDR or NSX LB SNAT IPs). | ||
LoadBalancerIPAddresses string `json:"loadBalancerIPAddresses,omitempty"` | ||
// Private CIDRs used for the VPC. | ||
PrivateIPv4CIDRs []string `json:"privateIPv4CIDRs,omitempty"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NetworkInfo{}, &NetworkInfoList{}) | ||
} |
Oops, something went wrong.