Skip to content

Commit

Permalink
[Hybrid Nodes] Remove strict requirement of providing a VGW or TGW du…
Browse files Browse the repository at this point in the history
…ring cluster creation (#8168)

[Hybrid Nodes] Remote strict requirement of providing a VGW or TGW during cluster creation
  • Loading branch information
TiberiuGC authored Jan 29, 2025
1 parent 7979b9f commit 74c2b1f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
8 changes: 2 additions & 6 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,10 @@ func (c *ClusterConfig) validateRemoteNetworkingConfig() error {
return setNonEmpty("remoteNetworkConfig.remoteNodeNetworks")
}

if c.VPC.ID != "" {
if rnc.VPCGatewayID.IsSet() {
if rnc.VPCGatewayID.IsSet() {
if c.VPC.ID != "" {
return fmt.Errorf("remoteNetworkConfig.vpcGatewayID is not supported when using pre-existing VPC")
}
} else {
if !rnc.VPCGatewayID.IsSet() {
return setNonEmpty("remoteNetworkConfig.vpcGatewayID")
}
// vpcGatewayId must be either a virtual private gateway or a transit gateway
if !rnc.VPCGatewayID.IsTransitGateway() && !rnc.VPCGatewayID.IsVirtualPrivateGateway() {
return fmt.Errorf("invalid value %q provided for remoteNetworkConfig.vpcGatewayID; "+
Expand Down
6 changes: 0 additions & 6 deletions pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,6 @@ var _ = Describe("ClusterConfig validation", func() {
},
expectedErr: "remoteNetworkConfig.vpcGatewayID is not supported when using pre-existing VPC",
}),
Entry("both vpcGatewayID and pre-existing VPC are missing", remoteNetworkConfigEntry{
overrideConfig: func(cc *api.ClusterConfig) {
cc.RemoteNetworkConfig.VPCGatewayID = nil
},
expectedErr: "remoteNetworkConfig.vpcGatewayID must be set and non-empty",
}),
Entry("unsupported vpcGateway type", remoteNetworkConfigEntry{
overrideConfig: func(cc *api.ClusterConfig) {
gatewayID := api.VPCGateway("igw-1234")
Expand Down
2 changes: 2 additions & 0 deletions pkg/cfn/builder/vpc_ipv4.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"

"github.com/kris-nova/logger"
"github.com/weaveworks/eksctl/pkg/awsapi"

gfncfn "github.com/awslabs/goformation/v4/cloudformation/cloudformation"
Expand Down Expand Up @@ -396,6 +397,7 @@ func (v *IPv4VPCResourceSet) addHybridNodesNetworking() {
}
})
default:
logger.Warning("a TGW or VGW was not provided for hybrid nodes connectivity, hence eksctl won't configure any related routes and gateway attachments for your VPC")
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion userdocs/src/usage/hybrid-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ remoteNetworkConfig:
- cidrs: ["10.86.30.0/23"]
```
If your connectivity method of choice does not involve using a TGW or VGW, you must not rely on eksctl to create the VPC for you, and instead provide a pre-existing one. On a related note, if you are using a pre-existing VPC, eksctl won't make any amendments to it, and ensuring all networking requirements are in place falls under your responsibility.
If your connectivity method of choice does not involve using a TGW or VGW, you can omit setting `remoteNetworkConfig.vpcGatewayID` or provide a pre-existing VPC. On a related note, if you are using a pre-existing VPC, eksctl won't make any amendments to it, and ensuring all networking requirements are in place falls under your responsibility.

???+ note
eksctl does not setup any networking infrastructure outside your AWS VPC (i.e. any infrastructure from VGW/TGW to the remote networks)
Expand Down

0 comments on commit 74c2b1f

Please sign in to comment.