Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NetworkConfiguration CR with new VPC API #595

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
bin/
.DS_Store
go.work
go.work.sum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not submit .gitignore

go.work.sum
vendor/
.golangci-bin/
4 changes: 3 additions & 1 deletion build/yaml/crd/nsx.vmware.com_ippools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ spec:
type: object
type: array
type:
description: Type defines the type of this IPPool, Public or Private.
description: Type defines the type of this IPPool, Public, Private
or Project.
enum:
- Public
- Private
- Project
type: string
type: object
status:
Expand Down
1 change: 1 addition & 0 deletions build/yaml/crd/nsx.vmware.com_subnets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ spec:
enum:
- Private
- Public
- Project
type: string
advancedConfig:
description: Subnet advanced configuration.
Expand Down
1 change: 1 addition & 0 deletions build/yaml/crd/nsx.vmware.com_subnetsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ spec:
enum:
- Private
- Public
- Project
type: string
advancedConfig:
description: Subnet advanced configuration.
Expand Down
18 changes: 15 additions & 3 deletions build/yaml/crd/nsx.vmware.com_vpcnetworkconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ spec:
description: Default size of Subnet based upon estimated workload
count. Defaults to 26.
type: integer
defaultSubnetAccessMode:
description: DefaultSubnetAccessMode defines the access mode of the
default SubnetSet for PodVM and VM. Must be Public or Private.
defaultPodSubnetAccessMode:
description: DefaultPodSubnetAccessMode defines the access mode of
the default SubnetSet for PodVM. Must be Public or Private.
enum:
- Public
- Private
- Project
type: string
edgeClusterPath:
description: Edge cluster path on which the networking elements will
Expand All @@ -79,6 +80,13 @@ spec:
maxItems: 5
minItems: 0
type: array
lbServiceSize:
enum:
- SMALL
- MEDIUM
- LARGE
- XLARGE
type: string
nsxtProject:
description: NSX-T Project the Namespace associated with.
type: string
Expand All @@ -94,6 +102,10 @@ spec:
context in logs. Less than or equal to 8 characters.
maxLength: 8
type: string
vpcConnectivityProfile:
description: VPCConnectivityProfile ID. This profile has configuration
related to create VPC transit gateway attachment.
type: string
type: object
status:
description: VPCNetworkConfigurationStatus defines the observed state
Expand Down
11 changes: 7 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ require (
github.com/vmware-tanzu/nsx-operator/pkg/client v0.0.0-20240102061654-537b080e159f
github.com/vmware-tanzu/vm-operator/api v1.8.2
github.com/vmware/govmomi v0.27.4
github.com/vmware/vsphere-automation-sdk-go/lib v0.7.0
github.com/vmware/vsphere-automation-sdk-go/runtime v0.7.1-0.20240611083326-25a4e1834c4d
github.com/vmware/vsphere-automation-sdk-go/services/nsxt v0.12.0
github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp v0.6.0
go.uber.org/automaxprocs v1.5.3
go.uber.org/zap v1.25.0
golang.org/x/crypto v0.17.0
Expand All @@ -48,6 +44,13 @@ require (
sigs.k8s.io/controller-runtime v0.16.0
)

require (
github.com/zhengxiexie/vsphere-automation-sdk-go/lib v0.7.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we merge this change now, or wait till new SDK ready and change it to official one?

github.com/zhengxiexie/vsphere-automation-sdk-go/runtime v0.7.2
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt v0.12.2
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt-mp v0.6.2
)

require (
github.com/beevik/etree v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9o
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zhengxiexie/vsphere-automation-sdk-go/lib v0.7.3-0.20240628090521-3ad1af047210 h1:ZdoS46cHwnmPh4bs6OxlllI6PX92Z4a3qm428s4f93c=
github.com/zhengxiexie/vsphere-automation-sdk-go/lib v0.7.3-0.20240628090521-3ad1af047210/go.mod h1:CNBmjJmN8Mja3FRhLN4q6n9qhiBfxvq3Uij8t7r6370=
github.com/zhengxiexie/vsphere-automation-sdk-go/runtime v0.7.3-0.20240628090521-3ad1af047210 h1:vYtG51i9JqSO06oJlDa23riTvMP2ppnQ72FdhoJVtGQ=
github.com/zhengxiexie/vsphere-automation-sdk-go/runtime v0.7.3-0.20240628090521-3ad1af047210/go.mod h1:DzLetYAmw1+vj7bqElRWEpuy40WYE/woL3alsymYa/c=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt v0.12.3-0.20240628090521-3ad1af047210 h1:sclbs9AnzZ6gb8apIUQJI5rqx/SixhoCAu5O1mUcxoY=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt v0.12.3-0.20240628090521-3ad1af047210/go.mod h1:RACl1XoB+anHOOgmYjM72zJAKOtr1gNkx2u+ZLt93D8=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt-mp v0.6.3-0.20240628090521-3ad1af047210 h1:34H/XVcNwNYrkdcBNrqOC298XL17idkjvp1kr5HWoHc=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt-mp v0.6.3-0.20240628090521-3ad1af047210/go.mod h1:ur/ob18hNxdaK42eug61vyiq7rbLQJhnOngdQSvgr54=
github.com/zhengxiexie/vsphere-automation-sdk-go/lib v0.7.2 h1:uslFBNmozFIyMxxAaSYWpQ4Dc//y5DOrvvuODf96jmE=
github.com/zhengxiexie/vsphere-automation-sdk-go/lib v0.7.2/go.mod h1:dS8Uv/HwR7DRivMlqF1qdp8k/w65HAiaEQWkIm1L2bw=
github.com/zhengxiexie/vsphere-automation-sdk-go/runtime v0.7.2 h1:kNZ2Vgp28+OEsGpDUZ0wAstAHH/L8mGiq1XqeYw1NYI=
github.com/zhengxiexie/vsphere-automation-sdk-go/runtime v0.7.2/go.mod h1:8sgZX59Twp6HRGaybY/vnBNIn1eRyuO3c2oX1+YYI/8=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt v0.12.2 h1:DqwN7Zk7qPTd5srvNiWB5DcU1l7teFuUQQgGAXKWe6Q=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt v0.12.2/go.mod h1:hZaSASWSwMhJjd9jnDYlF/mFfOZHruZMXrgAQp5/9u4=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt-mp v0.6.2 h1:Hg9xgLD2G+UE5/tREuNSr8sYhfOg5/Vte6GvKvO55WI=
github.com/zhengxiexie/vsphere-automation-sdk-go/services/nsxt-mp v0.6.2/go.mod h1:YTGOq+6ab6CVIeadkuGr22S7aG8D6btWsRLUgUrl0yw=
go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k=
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0=
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type SubnetSpec struct {
// +kubebuilder:validation:Minimum:=16
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
// +kubebuilder:validation:Enum=Private;Public
// +kubebuilder:validation:Enum=Private;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet CIDRS.
// +kubebuilder:validation:MinItems=0
Expand All @@ -38,9 +38,9 @@ type SubnetStatus struct {
}

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// Subnet is the Schema for the subnets API.
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
Expand All @@ -54,7 +54,7 @@ type Subnet struct {
Status SubnetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// SubnetList contains a list of Subnet.
type SubnetList struct {
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/nsx.vmware.com/v1alpha1/subnetset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type SubnetSetSpec struct {
// +kubebuilder:validation:Minimum:=16
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
// +kubebuilder:validation:Enum=Private;Public
// +kubebuilder:validation:Enum=Private;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet advanced configuration.
AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"`
Expand All @@ -37,9 +37,9 @@ type SubnetSetStatus struct {
}

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// SubnetSet is the Schema for the subnetsets API.
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
Expand All @@ -53,7 +53,7 @@ type SubnetSet struct {
Status SubnetSetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// SubnetSetList contains a list of SubnetSet.
type SubnetSetList struct {
Expand Down
35 changes: 25 additions & 10 deletions pkg/apis/nsx.vmware.com/v1alpha1/vpcnetworkconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ import (
)

const (
AccessModePublic string = "Public"
AccessModePrivate string = "Private"
AccessModePublic string = "Public"
AccessModePrivate string = "Private"
AccessModeProject string = "Project"
LbServiceSizeSmall string = "SMALL"
LbServiceSizeMedium string = "MEDIUM"
LbServiceSizeLarge string = "LARGE"
LbServiceSizeXlarge string = "XLARGE"
)

// VPCNetworkConfigurationSpec defines the desired state of VPCNetworkConfiguration.
Expand All @@ -21,14 +26,24 @@ const (
type VPCNetworkConfigurationSpec struct {
// PolicyPath of Tier0 or Tier0 VRF gateway.
DefaultGatewayPath string `json:"defaultGatewayPath,omitempty"`

// VPCConnectivityProfile ID. This profile has configuration related to create VPC transit gateway attachment.
VPCConnectivityProfile string `json:"vpcConnectivityProfile,omitempty"`

// +kubebuilder:validation:Enum=SMALL;MEDIUM;LARGE;XLARGE
LbServiceSize string `json:"lbServiceSize,omitempty"`

// Edge cluster path on which the networking elements will be created.
EdgeClusterPath string `json:"edgeClusterPath,omitempty"`

// NSX-T Project the Namespace associated with.
NSXTProject string `json:"nsxtProject,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NSXTProject -> "NsxProject"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VPCNetworkConfigurationSpec should be like
type VPCNetworkConfigurationSpec struct {
NsxProject
VpcConnectivityProfile
PrivateIPs
ShortID
LbServiceSize
PodSubnetAccessMode
DefaultSubnetSize
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wenqiq probably you missed this one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dantingl do we only support for VPC new model or both old and new model?


// NSX-T IPv4 Block paths used to allocate external Subnets.
// +kubebuilder:validation:MinItems=0
// +kubebuilder:validation:MaxItems=5
ExternalIPv4Blocks []string `json:"externalIPv4Blocks,omitempty"`

// Private IPv4 CIDRs used to allocate Private Subnets.
// +kubebuilder:validation:MinItems=0
// +kubebuilder:validation:MaxItems=5
Expand All @@ -37,12 +52,12 @@ type VPCNetworkConfigurationSpec struct {
// Defaults to 26.
// +kubebuilder:default=26
DefaultIPv4SubnetSize int `json:"defaultIPv4SubnetSize,omitempty"`
// DefaultSubnetAccessMode defines the access mode of the default SubnetSet for PodVM and VM.
// DefaultPodSubnetAccessMode defines the access mode of the default SubnetSet for PodVM.
// Must be Public or Private.
// +kubebuilder:validation:Enum=Public;Private
DefaultSubnetAccessMode string `json:"defaultSubnetAccessMode,omitempty"`
// +kubebuilder:validation:Enum=Public;Private;Project
DefaultPodSubnetAccessMode string `json:"defaultPodSubnetAccessMode,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to PodSubnetAccessMode

// ShortID specifies Identifier to use when displaying VPC context in logs.
// Less than or equal to 8 characters.
// Less than equal to 8 characters.
// +kubebuilder:validation:MaxLength=8
// +optional
ShortID string `json:"shortID,omitempty"`
Expand All @@ -64,9 +79,9 @@ type VPCInfo struct {

// +genclient
// +genclient:nonNamespaced
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// VPCNetworkConfiguration is the Schema for the vpcnetworkconfigurations API.
// +kubebuilder:resource:scope="Cluster"
Expand All @@ -81,7 +96,7 @@ type VPCNetworkConfiguration struct {
Status VPCNetworkConfigurationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// VPCNetworkConfigurationList contains a list of VPCNetworkConfiguration.
type VPCNetworkConfigurationList struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/nsx.vmware.com/v1alpha2/ippool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// IPPool is the Schema for the ippools API.
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,description="Type of IPPool"
Expand All @@ -25,7 +25,7 @@ type IPPool struct {
Status IPPoolStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// IPPoolList contains a list of IPPool.
type IPPoolList struct {
Expand All @@ -36,8 +36,8 @@ type IPPoolList struct {

// IPPoolSpec defines the desired state of IPPool.
type IPPoolSpec struct {
// Type defines the type of this IPPool, Public or Private.
// +kubebuilder:validation:Enum=Public;Private
// Type defines the type of this IPPool, Public, Private or Project.
// +kubebuilder:validation:Enum=Public;Private;Project
// +optional
Type string `json:"type,omitempty"`
// Subnets defines set of subnets need to be allocated.
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/v1alpha1/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type SubnetSpec struct {
// +kubebuilder:validation:Minimum:=16
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
// +kubebuilder:validation:Enum=Private;Public
// +kubebuilder:validation:Enum=Private;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet CIDRS.
// +kubebuilder:validation:MinItems=0
Expand All @@ -38,9 +38,9 @@ type SubnetStatus struct {
}

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// Subnet is the Schema for the subnets API.
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
Expand All @@ -54,7 +54,7 @@ type Subnet struct {
Status SubnetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// SubnetList contains a list of Subnet.
type SubnetList struct {
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/v1alpha1/subnetset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type SubnetSetSpec struct {
// +kubebuilder:validation:Minimum:=16
IPv4SubnetSize int `json:"ipv4SubnetSize,omitempty"`
// Access mode of Subnet, accessible only from within VPC or from outside VPC.
// +kubebuilder:validation:Enum=Private;Public
// +kubebuilder:validation:Enum=Private;Public;Project
AccessMode AccessMode `json:"accessMode,omitempty"`
// Subnet advanced configuration.
AdvancedConfig AdvancedConfig `json:"advancedConfig,omitempty"`
Expand All @@ -37,9 +37,9 @@ type SubnetSetStatus struct {
}

// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion

// SubnetSet is the Schema for the subnetsets API.
// +kubebuilder:printcolumn:name="AccessMode",type=string,JSONPath=`.spec.accessMode`,description="Access mode of Subnet"
Expand All @@ -53,7 +53,7 @@ type SubnetSet struct {
Status SubnetSetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// SubnetSetList contains a list of SubnetSet.
type SubnetSetList struct {
Expand Down
Loading
Loading