Skip to content

Commit

Permalink
Address review feedback - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed May 19, 2021
1 parent 64acdca commit 1f167eb
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
18 changes: 18 additions & 0 deletions pkg/apis/kops/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,24 @@ func TestValidateSubnets(t *testing.T) {
},
ExpectedErrors: []string{"Invalid value::subnets[0].ipv6CIDR"},
},
{
Input: []kops.ClusterSubnetSpec{
{Name: "a", IPv6CIDR: "::ffff:10.128.0.0"},
},
ExpectedErrors: []string{"Invalid value::subnets[0].ipv6CIDR"},
},
{
Input: []kops.ClusterSubnetSpec{
{Name: "a", IPv6CIDR: "::ffff:10.128.0.0/8"},
},
ExpectedErrors: []string{"Invalid value::subnets[0].ipv6CIDR"},
},
{
Input: []kops.ClusterSubnetSpec{
{Name: "a", CIDR: "::ffff:10.128.0.0/8"},
},
ExpectedErrors: []string{"Invalid value::subnets[0].cidr"},
},
}
for _, g := range grid {
cluster := &kops.ClusterSpec{
Expand Down
8 changes: 4 additions & 4 deletions pkg/model/awsmodel/api_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
Name: fi.String("icmpv6-pmtu-api-elb-" + cidr),
Lifecycle: b.SecurityLifecycle,
IPv6CIDR: fi.String(cidr),
FromPort: fi.Int64(2),
FromPort: fi.Int64(-1),
Protocol: fi.String("icmpv6"),
SecurityGroup: lbSG,
ToPort: fi.Int64(0),
ToPort: fi.Int64(-1),
})
} else {
c.AddTask(&awstasks.SecurityGroupRule{
Expand Down Expand Up @@ -401,10 +401,10 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
Name: fi.String("icmpv6-pmtu-api-elb-" + cidr),
Lifecycle: b.SecurityLifecycle,
IPv6CIDR: fi.String(cidr),
FromPort: fi.Int64(2),
FromPort: fi.Int64(-1),
Protocol: fi.String("icmpv6"),
SecurityGroup: masterGroup.Task,
ToPort: fi.Int64(0),
ToPort: fi.Int64(-1),
})
} else {
c.AddTask(&awstasks.SecurityGroupRule{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@
"GroupId": {
"Ref": "AWSEC2SecurityGroupmastersminimalipv6examplecom"
},
"FromPort": 2,
"ToPort": 0,
"FromPort": -1,
"ToPort": -1,
"IpProtocol": "icmpv6",
"CidrIpv6": "::/0"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/update_cluster/minimal-ipv6/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,11 @@ resource "aws_security_group_rule" "icmp-pmtu-api-elb-0-0-0-0--0" {
}

resource "aws_security_group_rule" "icmpv6-pmtu-api-elb-__--0" {
from_port = 2
from_port = -1
ipv6_cidr_blocks = ["::/0"]
protocol = "icmpv6"
security_group_id = aws_security_group.masters-minimal-ipv6-example-com.id
to_port = 0
to_port = -1
type = "ingress"
}

Expand Down
11 changes: 6 additions & 5 deletions upup/pkg/fi/cloudup/awstasks/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ type VPC struct {
Name *string
Lifecycle *fi.Lifecycle

ID *string
CIDR *string
EnableDNSHostnames *bool
EnableDNSSupport *bool
ID *string
CIDR *string

// Used only for Terraform rendering.
// AmazonIPv6 is used only for Terraform rendering.
// Direct and CloudFormation rendering is handled via the VPCAmazonIPv6CIDRBlock task
AmazonIPv6 *bool
IPv6CIDR *string

EnableDNSHostnames *bool
EnableDNSSupport *bool

// Shared is set if this is a shared VPC
Shared *bool

Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/awstasks/vpcamazonipv6cidrblock.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 1f167eb

Please sign in to comment.