mirror of https://github.com/kubernetes/kops.git
Fix the detection and rendering of multiple additionalNetworkCIDR blocks
This commit is contained in:
parent
0978cd97e8
commit
4bcfebebcc
|
@ -93,7 +93,7 @@ func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
Lifecycle: b.Lifecycle,
|
||||
VPC: b.LinkToVPC(),
|
||||
Shared: fi.Bool(sharedVPC),
|
||||
CIDRBlock: &cidr,
|
||||
CIDRBlock: s(cidr),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -931,7 +931,7 @@
|
|||
"VpcId": {
|
||||
"Ref": "AWSEC2VPCcomplexexamplecom"
|
||||
},
|
||||
"CidrBlock": "10.2.0.0/16"
|
||||
"CidrBlock": "10.1.0.0/16"
|
||||
}
|
||||
},
|
||||
"AWSEC2VPCCidrBlock1020016": {
|
||||
|
|
|
@ -732,7 +732,7 @@ resource "aws_vpc_dhcp_options" "complex-example-com" {
|
|||
}
|
||||
|
||||
resource "aws_vpc_ipv4_cidr_block_association" "cidr-10-1-0-0--16" {
|
||||
cidr_block = "10.2.0.0/16"
|
||||
cidr_block = "10.1.0.0/16"
|
||||
vpc_id = aws_vpc.complex-example-com.id
|
||||
}
|
||||
|
||||
|
|
|
@ -48,10 +48,21 @@ func (e *VPCCIDRBlock) Find(c *fi.Context) (*VPCCIDRBlock, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
found := false
|
||||
for _, cba := range vpc.CidrBlockAssociationSet {
|
||||
if fi.StringValue(cba.CidrBlock) == fi.StringValue(e.CIDRBlock) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
actual := &VPCCIDRBlock{
|
||||
CIDRBlock: e.CIDRBlock,
|
||||
VPC: &VPC{ID: vpc.VpcId},
|
||||
}
|
||||
actual.VPC = &VPC{ID: vpc.VpcId}
|
||||
|
||||
// Prevent spurious changes
|
||||
actual.Shared = e.Shared
|
||||
|
|
Loading…
Reference in New Issue