mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #14503 from chrisleck/cle-fix-aws-vpc-lookup
Fix for issue #14466.
This commit is contained in:
commit
1daa365d7a
@ -1276,7 +1276,7 @@ func (self *AWSCloud) findVPCID() (string, error) {
|
|||||||
return "", fmt.Errorf("Could not find VPC id in instance metadata")
|
return "", fmt.Errorf("Could not find VPC id in instance metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the kubernetes VPC
|
// Find the VPC which self is attached to.
|
||||||
func (self *AWSCloud) findVPC() (*ec2.VPC, error) {
|
func (self *AWSCloud) findVPC() (*ec2.VPC, error) {
|
||||||
request := &ec2.DescribeVPCsInput{}
|
request := &ec2.DescribeVPCsInput{}
|
||||||
|
|
||||||
@ -1286,7 +1286,9 @@ func (self *AWSCloud) findVPC() (*ec2.VPC, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
filters := []*ec2.Filter{newEc2Filter("vpc-id", vpcID)}
|
filters := []*ec2.Filter{newEc2Filter("vpc-id", vpcID)}
|
||||||
request.Filters = self.addFilters(filters)
|
// Don't bother adding the filterTags as we know this VPC is valid for this instance from findVPCID above.
|
||||||
|
// This is important as sharing a single regional VPC with multiple per-AZ clusters is a common deployment.
|
||||||
|
request.Filters = filters
|
||||||
|
|
||||||
vpcs, err := self.ec2.DescribeVPCs(request)
|
vpcs, err := self.ec2.DescribeVPCs(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1628,6 +1630,9 @@ func (s *AWSCloud) EnsureTCPLoadBalancer(name, region string, publicIP net.IP, p
|
|||||||
request := &ec2.DescribeSubnetsInput{}
|
request := &ec2.DescribeSubnetsInput{}
|
||||||
filters := []*ec2.Filter{}
|
filters := []*ec2.Filter{}
|
||||||
filters = append(filters, newEc2Filter("vpc-id", orEmpty(vpc.VPCID)))
|
filters = append(filters, newEc2Filter("vpc-id", orEmpty(vpc.VPCID)))
|
||||||
|
// Note, this will only return subnets tagged with the cluster identifier for this Kubernetes cluster.
|
||||||
|
// In the case where an AZ has public & private subnets per AWS best practices, the deployment should ensure
|
||||||
|
// only the public subnet (where the ELB will go) is so tagged.
|
||||||
filters = s.addFilters(filters)
|
filters = s.addFilters(filters)
|
||||||
request.Filters = filters
|
request.Filters = filters
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user