mirror of https://github.com/kubernetes/kops.git
Add --ipv6 experimental cli flag
This commit is contained in:
parent
fcfba36b14
commit
2a11fa7dde
|
@ -260,6 +260,10 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
// TODO: Can we deprecate this flag - it is awkward?
|
||||
cmd.Flags().BoolVar(&associatePublicIP, "associate-public-ip", false, "Specify --associate-public-ip=[true|false] to enable/disable association of public IP for master ASG and nodes. Default is 'true'.")
|
||||
|
||||
if featureflag.AWSIPv6.Enabled() {
|
||||
cmd.Flags().BoolVar(&options.IPv6, "ipv6", false, "Allocate IPv6 CIDRs to sunets for clusters with public topology on AWS")
|
||||
}
|
||||
|
||||
cmd.Flags().StringSliceVar(&options.NodeSecurityGroups, "node-security-groups", options.NodeSecurityGroups, "Add precreated additional security groups to nodes.")
|
||||
cmd.Flags().StringSliceVar(&options.MasterSecurityGroups, "master-security-groups", options.MasterSecurityGroups, "Add precreated additional security groups to masters.")
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ var (
|
|||
APIServerNodes = New("APIServerNodes", Bool(false))
|
||||
// UseAddonOperators activates experimental addon operator support
|
||||
UseAddonOperators = New("UseAddonOperators", Bool(false))
|
||||
// AWSIPv6 activates experimental AWS IPv6 support.
|
||||
AWSIPv6 = New("AWSIPv6", Bool(false))
|
||||
)
|
||||
|
||||
// FeatureFlag defines a feature flag
|
||||
|
|
|
@ -43,6 +43,7 @@ spec:
|
|||
- 0.0.0.0/0
|
||||
subnets:
|
||||
- cidr: 172.20.32.0/19
|
||||
ipv6CIDR: /64#1
|
||||
name: us-test-1a
|
||||
type: Public
|
||||
zone: us-test-1a
|
||||
|
|
|
@ -4,3 +4,4 @@ Zones:
|
|||
CloudProvider: aws
|
||||
Networking: calico
|
||||
KubernetesVersion: v1.22.0
|
||||
IPv6: true
|
||||
|
|
|
@ -91,6 +91,8 @@ type NewClusterOptions struct {
|
|||
UtilitySubnetIDs []string
|
||||
// Egress defines the method of traffic egress for subnets.
|
||||
Egress string
|
||||
// IPv6 adds IPv6 CIDRs to subnets
|
||||
IPv6 bool
|
||||
|
||||
// OpenstackExternalNet is the name of the external network for the openstack router.
|
||||
OpenstackExternalNet string
|
||||
|
@ -942,6 +944,19 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
|
|||
cluster.Spec.Subnets[i].Type = api.SubnetTypePublic
|
||||
}
|
||||
|
||||
if opt.IPv6 {
|
||||
if api.CloudProviderID(cluster.Spec.CloudProvider) == api.CloudProviderAWS {
|
||||
klog.Warningf("IPv6 support is EXPERIMENTAL and can be changed or removed at any time in the future!!!")
|
||||
for i := range cluster.Spec.Subnets {
|
||||
// Start IPv6 CIDR numbering from "1" to reserve /64#0 for later use
|
||||
// with NonMasqueradeCIDR, ClusterCIDR and ServiceClusterIPRange
|
||||
cluster.Spec.Subnets[i].IPv6CIDR = fmt.Sprintf("/64#%x", i+1)
|
||||
}
|
||||
} else {
|
||||
klog.Errorf("IPv6 support is available only on AWS")
|
||||
}
|
||||
}
|
||||
|
||||
case api.TopologyPrivate:
|
||||
if cluster.Spec.Networking.Kubenet != nil {
|
||||
return nil, fmt.Errorf("invalid networking option %s. Kubenet does not support private topology", opt.Networking)
|
||||
|
|
Loading…
Reference in New Issue