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

User can create a new VPC with a custom IPv6 CIDR #4378

Merged
merged 9 commits into from
Nov 8, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
implent pr feedback
Jake committed Nov 8, 2021
commit 362c361de8d578434ff104cdb9a67f2ff7377730
15 changes: 4 additions & 11 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
@@ -195,7 +195,9 @@ func (c *ClusterConfig) ValidateVPCConfig() error {
if IsEnabled(c.VPC.AutoAllocateIPv6) {
return fmt.Errorf("auto allocate ipv6 is not supported with IPv6")
}
} else {
}

if c.VPC.IPFamily == IPV4Family {
if c.VPC.IPv6Cidr != "" || c.VPC.IPv6Pool != "" {
return fmt.Errorf("Ipv6Cidr and Ipv6CidrPool is only supportd when IPFamily is set to IPv6")
}
@@ -209,16 +211,7 @@ func (c *ClusterConfig) ValidateVPCConfig() error {
}

func (c *ClusterConfig) ipv6CidrsValid() error {
count := 0
if c.VPC.IPv6Cidr != "" {
count++
}

if c.VPC.IPv6Pool != "" {
count++
}

if count == 0 || count == 2 {
if (c.VPC.IPv6Cidr == "" && c.VPC.IPv6Pool == "") || (c.VPC.IPv6Cidr != "" && c.VPC.IPv6Pool != "") {
return nil
}
return fmt.Errorf("Ipv6Cidr and Ipv6Pool must both be configured to use a custom IPv6 CIDR and address pool")
4 changes: 2 additions & 2 deletions pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
@@ -731,13 +731,13 @@ var _ = Describe("ClusterConfig validation", func() {
cfg.VPC.IPFamily = api.IPV6Family
cfg.VPC.IPv6Cidr = "foo"
err = cfg.ValidateVPCConfig()
Expect(err).To(MatchError("Ipv6Cidr and Ipv6CidrPool must both be configured to use custom ipv6 CIDR pool"))
Expect(err).To(MatchError("Ipv6Cidr and Ipv6Pool must both be configured to use a custom IPv6 CIDR and address pool"))

cfg.VPC.IPFamily = api.IPV6Family
cfg.VPC.IPv6Cidr = ""
cfg.VPC.IPv6Pool = "bar"
err = cfg.ValidateVPCConfig()
Expect(err).To(MatchError("Ipv6Cidr and Ipv6CidrPool must both be configured to use custom ipv6 CIDR pool"))
Expect(err).To(MatchError("Ipv6Cidr and Ipv6Pool must both be configured to use a custom IPv6 CIDR and address pool"))
})
})
})