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

Adjust ALB Settings configuration to support IPv6 and Transparent mode #549

Merged
merged 4 commits into from
Mar 8, 2023
Merged
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
3 changes: 3 additions & 0 deletions .changes/v2.20.0/549-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* NSX-T ALB settings for Edge Gateway gain support for IPv6 service network definition (VCD 10.4.0+)
and Transparent mode (VCD 10.4.1+) by adding new fields to `types.NsxtAlbConfig` and automatically
elevating API up to 37.1 [GH-549]
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes
# precedence all these users will be requested for review when someone opens a pull request.
* @lvirbalas @Didainius @adambarreiro @dataclouder
* @lvirbalas @Didainius @adambarreiro @dataclouder @adezxc
24 changes: 23 additions & 1 deletion govcd/nsxt_alb_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,32 @@ func (vcd *TestVCD) Test_UpdateAlbSettings(check *C) {
check.Assert(enabledSettingsCustomServiceDefinition.Enabled, Equals, true)
check.Assert(enabledSettingsCustomServiceDefinition.ServiceNetworkDefinition, Equals, "93.93.11.1/25")

// Disable ALB on Edge Gateway again and ensure it was disabled
// Disable ALB on Edge Gateway
err = edge.DisableAlb()
check.Assert(err, IsNil)

// Enable IPv6 service network definition (VCD 10.4.0+)
if vcd.client.Client.APIVCDMaxVersionIs(">= 37.0") {
printVerbose("Enabling IPv6 service network definition for VCD 10.4.0+\n")
albSettingsConfig.Ipv6ServiceNetworkDefinition = "2001:0db8:85a3:0000:0000:8a2e:0370:7334/120"
enabledSettingsIpv6ServiceDefinition, err := edge.UpdateAlbSettings(albSettingsConfig)
check.Assert(err, IsNil)
check.Assert(enabledSettingsIpv6ServiceDefinition.Ipv6ServiceNetworkDefinition, Equals, "2001:0db8:85a3:0000:0000:8a2e:0370:7334/120")
err = edge.DisableAlb()
check.Assert(err, IsNil)
}

// Enable Transparent mode (VCD 10.4.1+)
if vcd.client.Client.APIVCDMaxVersionIs(">= 37.1") {
printVerbose("Enabling Transparent mode for VCD 10.4.1+\n")
albSettingsConfig.TransparentModeEnabled = takeBoolPointer(true)
enabledSettingsTransparentMode, err := edge.UpdateAlbSettings(albSettingsConfig)
check.Assert(err, IsNil)
check.Assert(*enabledSettingsTransparentMode.TransparentModeEnabled, Equals, true)
err = edge.DisableAlb()
check.Assert(err, IsNil)
}

albSettings, err := edge.GetAlbSettings()
check.Assert(err, IsNil)
check.Assert(albSettings, NotNil)
Expand Down
7 changes: 2 additions & 5 deletions govcd/openapi_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ var endpointMinApiVersions = map[string]string{
types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointVdcNetworkProfile: "36.0", // VCD 10.3+
}

// elevateNsxtNatRuleApiVersion helps to elevate API version to consume newer NSX-T NAT Rule features
// API V35.2+ supports new fields FirewallMatch and Priority
// API V36.0+ supports new RuleType - REFLEXIVE

// endpointElevatedApiVersions endpoint elevated API versions
var endpointElevatedApiVersions = map[string][]string{
types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointNsxtNatRules: {
Expand Down Expand Up @@ -121,7 +117,8 @@ var endpointElevatedApiVersions = map[string][]string{
},
types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointAlbEdgeGateway: {
//"35.0", // Basic minimum required version
"37.0", // Deprecates LicenseType in favor of SupportedFeatureSet
"37.0", // Deprecates LicenseType in favor of SupportedFeatureSet. Adds IPv6 service network definition support
"37.1", // Adds support for Transparent Mode
},
types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointVdcNetworkProfile: {
//"36.0", // Introduced support
Expand Down
14 changes: 14 additions & 0 deletions types/v56/nsxt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,20 @@ type NsxtAlbConfig struct {
// must be 25. If nothing is set, the default is 192.168.255.1/25. Default CIDR can be configured. This field cannot
// be updated.
ServiceNetworkDefinition string `json:"serviceNetworkDefinition,omitempty"`

// The IPv6 network definition in Gateway CIDR format which will be used by Load Balancer
// service on Edge. All the load balancer service engines associated with the Service Engine
// Group will be attached to this network.
// Once set, this field cannot be updated. The default
// IPv4 service network will be used if both the serviceNetworkDefinition and
// ipv6ServiceNetworkDefinition properties are unset. If both are set, it will still be one
// service network with a dual IPv4 and IPv6 stack.
// This field is only available for VCD 10.4.0+ (v37.0+)
Ipv6ServiceNetworkDefinition string `json:"ipv6ServiceNetworkDefinition,omitempty"`

// TransparentModeEnabled allows to configure Preserve Client IP on a Virtual Service
// This field is only available for VCD 10.4.1+ (v37.1+)
TransparentModeEnabled *bool `json:"transparentModeEnabled,omitempty"`
}

// NsxtAlbServiceEngineGroupAssignment configures Service Engine Group assignments to Edge Gateway. The only mandatory
Expand Down