mirror of https://github.com/kubernetes/kops.git
Check and docs
This commit is contained in:
parent
863d080011
commit
f908dcb3bf
|
@ -76,6 +76,36 @@ probably remove that tag to indicate that the resources are not owned by that cl
|
|||
deleting the cluster won't try to delete the VPC. (Deleting the VPC won't succeed anyway, because it's in use,
|
||||
but it's better to avoid the later confusion!)
|
||||
|
||||
|
||||
### VPC with multiple CIDRs
|
||||
|
||||
AWS now allows you to add more CIDRs to a VPC, the param `AdditionalNetworkCIDRs` allows you to specify any additional CIDRs added to the VPC.
|
||||
|
||||
```
|
||||
metadata:
|
||||
creationTimestamp: "2016-06-27T14:23:34Z"
|
||||
name: ${CLUSTER_NAME}
|
||||
spec:
|
||||
cloudProvider: aws
|
||||
networkCIDR: 10.1.0.0/16
|
||||
AdditionalNetworkCIDRs:
|
||||
- 10.2.0.0/16
|
||||
networkID: vpc-00aa5577
|
||||
subnets:
|
||||
- cidr: 10.1.0.0/19
|
||||
name: us-east-1b
|
||||
type: Public
|
||||
zone: us-east-1b
|
||||
id: subnet-1234567
|
||||
- cidr: 10.2.0.0/19
|
||||
name: us-east-1b
|
||||
type: Public
|
||||
zone: us-east-1b
|
||||
id: subnet-1234568
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Advanced Options for Creating Clusters in Existing VPCs
|
||||
|
||||
### Shared Subnets
|
||||
|
|
|
@ -496,7 +496,7 @@ func ValidateCluster(c *kops.Cluster, strict bool) *field.Error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// validateEtcdClusterSpec is responsible for validating the etcd cluster spec
|
||||
// validateSubnetCIDR is responsible for validating subnets are part of the CIRDs assigned to the cluster.
|
||||
func validateSubnetCIDR(networkCIDR *net.IPNet, additionalNetworkCIDRs []*net.IPNet, subnetCIDR *net.IPNet) bool {
|
||||
if isSubnet(networkCIDR, subnetCIDR) {
|
||||
return true
|
||||
|
|
|
@ -36,6 +36,7 @@ type VPC struct {
|
|||
|
||||
ID *string
|
||||
CIDR *string
|
||||
AdditionalCIDR *[]string
|
||||
EnableDNSHostnames *bool
|
||||
EnableDNSSupport *bool
|
||||
|
||||
|
@ -77,6 +78,7 @@ func (e *VPC) Find(c *fi.Context) (*VPC, error) {
|
|||
actual := &VPC{
|
||||
ID: vpc.VpcId,
|
||||
CIDR: vpc.CidrBlock,
|
||||
AdditionalCIDR: getAdditionalCIDR(vpc.CidrBlock, vpc.CidrBlockAssociationSet),
|
||||
Name: findNameTag(vpc.Tags),
|
||||
Tags: intersectTags(vpc.Tags, e.Tags),
|
||||
}
|
||||
|
@ -273,3 +275,15 @@ func (e *VPC) CloudformationLink() *cloudformation.Literal {
|
|||
|
||||
return cloudformation.Ref("AWS::EC2::VPC", *e.Name)
|
||||
}
|
||||
|
||||
func getAdditionalCIDR(CIDR *string, additionalCIDRSet []*ec2.VpcCidrBlockAssociation) *[]string {
|
||||
var additionalCIDRs []string
|
||||
|
||||
for _, CIDRSet := range additionalCIDRSet {
|
||||
if *CIDRSet.CidrBlock != *CIDR {
|
||||
additionalCIDRs = append(additionalCIDRs, *CIDRSet.CidrBlock)
|
||||
}
|
||||
}
|
||||
|
||||
return &additionalCIDRs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue