Skip to content

Commit 49cab79

Browse files
aclevernamecPu1
authored andcommitted
Update integration/tests/ipv6/ipv6_test.go
Co-authored-by: Chetan Patwal <[email protected]>
1 parent 3b48a63 commit 49cab79

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

integration/tests/ipv6/ipv6_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ var _ = Describe("(Integration) [EKS IPv6 test]", func() {
6161
clusterConfig.IAM.WithOIDC = api.Enabled()
6262
clusterConfig.Addons = []*api.Addon{
6363
{
64-
Name: "vpc-cni",
64+
Name: api.VPCCNIAddon,
6565
},
6666
{
67-
Name: "kube-proxy",
67+
Name: api.KubeProxyAddon,
6868
},
6969
{
70-
Name: "coredns",
70+
Name: api.CoreDNSAddon,
7171
},
7272
}
7373

@@ -118,7 +118,7 @@ var _ = Describe("(Integration) [EKS IPv6 test]", func() {
118118
Expect(err).NotTo(HaveOccurred(), vpcOutput.GoString())
119119
Expect(vpcOutput.Vpcs[0].Ipv6CidrBlockAssociationSet).To(HaveLen(1))
120120

121-
// TODO: get rid of this once CF bug is fixed
121+
// TODO: get rid of this once CF bug is fixed https://github.com/weaveworks/eksctl/issues/4363
122122
By("setting AssignIpv6AddressOnCreation to true for each public subnet")
123123
var publicSubnets string
124124
for _, output := range describeStackOut.Stacks[0].Outputs {
@@ -133,11 +133,10 @@ var _ = Describe("(Integration) [EKS IPv6 test]", func() {
133133
Expect(err).NotTo(HaveOccurred())
134134
Expect(len(subnetsOutput.Subnets)).To(BeNumerically(">", 0))
135135
for _, s := range subnetsOutput.Subnets {
136-
Expect(s.AssignIpv6AddressOnCreation).NotTo(BeNil())
137136
Expect(*s.AssignIpv6AddressOnCreation).To(BeTrue())
138137
}
139138

140-
By("the k8s cluster's having IPv6 enabled")
139+
By("ensuring the K8s cluster has IPv6 enabled")
141140
var clientSet *kubernetes.Clientset
142141
ctl, err := eks.New(&api.ProviderConfig{Region: params.Region}, clusterConfig)
143142
Expect(err).NotTo(HaveOccurred())

pkg/apis/eksctl.io/v1alpha5/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ func IsDisabled(v *bool) bool { return v != nil && !*v }
380380
// IsSetAndNonEmptyString will only return true if s is not nil and not empty
381381
func IsSetAndNonEmptyString(s *string) bool { return s != nil && *s != "" }
382382

383+
// IsSetAndNonEmptyString will only return true if s is not nil and not empty
384+
func IsEmpty(s *string) bool { return !IsSetAndNonEmptyString(s) }
385+
383386
// SupportedRegions are the regions where EKS is available
384387
func SupportedRegions() []string {
385388
return []string{

pkg/cfn/manager/tasks.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ func (t *AssignIpv6AddressOnCreationTask) Describe() string {
146146

147147
func (t *AssignIpv6AddressOnCreationTask) Do(errs chan error) error {
148148
defer close(errs)
149-
for _, subnet := range t.ClusterConfig.VPC.Subnets.Public.WithIDs() {
150-
_, err := t.EC2API.ModifySubnetAttribute(&ec2.ModifySubnetAttributeInput{
151-
AssignIpv6AddressOnCreation: &ec2.AttributeBooleanValue{
152-
Value: aws.Bool(true),
153-
},
154-
SubnetId: aws.String(subnet),
155-
})
156-
if err != nil {
157-
return fmt.Errorf("failed to update subnet %q: %v", subnet, err)
149+
if t.ClusterConfig.VPC.Subnets.Public != nil {
150+
for _, subnet := range t.ClusterConfig.VPC.Subnets.Public.WithIDs() {
151+
_, err := t.EC2API.ModifySubnetAttribute(&ec2.ModifySubnetAttributeInput{
152+
AssignIpv6AddressOnCreation: &ec2.AttributeBooleanValue{
153+
Value: aws.Bool(true),
154+
},
155+
SubnetId: aws.String(subnet),
156+
})
157+
if err != nil {
158+
return fmt.Errorf("failed to update subnet %q: %v", subnet, err)
159+
}
158160
}
159161
}
160162
return nil

pkg/ctl/cmdutils/configfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func NewCreateClusterLoader(cmd *Cmd, ngFilter *filter.NodeGroupFilter, ng *api.
244244
}
245245
}
246246

247-
if clusterConfig.VPC.NAT != nil && !api.IsSetAndNonEmptyString(clusterConfig.VPC.NAT.Gateway) {
247+
if clusterConfig.VPC.NAT != nil && api.IsEmpty(clusterConfig.VPC.NAT.Gateway) {
248248
*clusterConfig.VPC.NAT.Gateway = api.ClusterSingleNAT
249249
}
250250

0 commit comments

Comments
 (0)