Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support ipv6 dual stack for Azure for testing #2799

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1777816
validate: Don't force IPv4 CIDRs
russellb Oct 16, 2019
eb557b0
aws: Start making terraform changes for IPv6
russellb Oct 17, 2019
e770d2e
aws: Add IPv6 route to the AWS internet gateway
russellb Oct 17, 2019
0f719ef
aws: Add IPv6 route from private subnet to internet gw
russellb Oct 17, 2019
5b44046
aws: Update security groups for IPv6
russellb Oct 17, 2019
6d19648
aws: Create IPv6 DNS records
russellb Oct 17, 2019
e8ea7af
aws: Disable IPv4 DNS records
russellb Oct 18, 2019
9a7fa84
aws: Create IPv6 compatible load balancers
russellb Oct 21, 2019
68636ab
aws: Apply use_ipv6 boolean in more places
russellb Oct 21, 2019
4a64b3d
aws: Re-enable api-int A record in IPv6 mode
russellb Oct 22, 2019
b1c9acf
aws: Don't accept public connections to api-int
russellb Oct 23, 2019
2a1ac77
aws: Check local_endpoints for more IPv6 resources
russellb Oct 23, 2019
d1f795d
aws: Disable the IPv6 dev/test env by default
russellb Oct 23, 2019
750c4b2
aws: Document the IPv6 dev/test env
russellb Oct 23, 2019
3874adc
validate: Update tests for IPv6 CIDR validation
russellb Oct 23, 2019
c46de1a
aws: Add env var OPENSHIFT_AWS_USE_IPV6
russellb Oct 24, 2019
b0add46
aws: Make more IPv6 resources conditional
russellb Oct 24, 2019
834b8b3
Use TCP health checks from the IPv6 load balancers
russellb Nov 22, 2019
8521d1d
aws: Allow port 5353 to masters.
russellb Nov 25, 2019
118af89
aws: Drop custom IPv6 load balancers
russellb Nov 27, 2019
86c9307
docs: Update aws_ipv6 description of load balancer usage.
russellb Nov 27, 2019
9648a03
aws: Allow port 5353 to workers.
markmc Nov 28, 2019
3e06624
Rename AWS IPv6 installer support variable
russellb Dec 6, 2019
76f1ab0
docs: Update aws_ipv6.md with more details
russellb Dec 6, 2019
2eb483e
aws: Drop TODO comments about a terraform upgrade
russellb Dec 6, 2019
40891fb
aws-ipv6: Note future move to egress only gateway
russellb Dec 7, 2019
7d7082f
aws: Remove unused variable
russellb Dec 9, 2019
9907dd2
aws: Simplify a formatlist conditional
russellb Dec 9, 2019
c21d6df
aws-ipv6: Adjust resource counts
russellb Dec 10, 2019
df9156f
aws-ipv6: Add comments to help explain subnet allocation
russellb Dec 10, 2019
9b4f14d
aws-ipv6: Drop etcd_ipv6_addresses
russellb Dec 10, 2019
71acc53
aws-ipv6: Add more validation
russellb Dec 10, 2019
d9eb7d6
vendor: Bump go-cidr to correctly handle ipv6 subnet CIDR math
smarterclayton Dec 16, 2019
85ac142
vendor: Switch to a branch of azurerm that fixes three bugs
smarterclayton Dec 16, 2019
6e187b4
azureprivatedns: Add support for AAAA records
smarterclayton Dec 16, 2019
377e920
azure: Add full dual-stack IPv6 support to the install for Azure
smarterclayton Dec 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions data/data/aws/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ resource "aws_security_group_rule" "ssh" {
to_port = 22
}

resource "aws_security_group_rule" "ssh_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.bootstrap.id

protocol = "tcp"
ipv6_cidr_blocks = local.public_endpoints ? ["::/0"] : var.vpc_ipv6_cidrs
from_port = 22
to_port = 22
}

resource "aws_security_group_rule" "bootstrap_journald_gateway" {
type = "ingress"
security_group_id = aws_security_group.bootstrap.id
Expand All @@ -194,3 +206,14 @@ resource "aws_security_group_rule" "bootstrap_journald_gateway" {
to_port = 19531
}

resource "aws_security_group_rule" "bootstrap_journald_gateway_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.bootstrap.id

protocol = "tcp"
ipv6_cidr_blocks = local.public_endpoints ? ["::/0"] : var.vpc_ipv6_cidrs
from_port = 19531
to_port = 19531
}
11 changes: 11 additions & 0 deletions data/data/aws/bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ variable "vpc_cidrs" {
description = "VPC CIDR blocks."
}

variable "vpc_ipv6_cidrs" {
type = list(string)
default = []
description = "VPC IPv6 CIDR blocks."
}

variable "vpc_security_group_ids" {
type = list(string)
default = []
Expand All @@ -78,3 +84,8 @@ variable "publish_strategy" {
type = string
description = "The publishing strategy for endpoints like load balancers"
}

variable "use_ipv6" {
description = "Use IPv6 instead of IPv4"
type = bool
}
8 changes: 7 additions & 1 deletion data/data/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ module "bootstrap" {
target_group_arns_length = module.vpc.aws_lb_target_group_arns_length
vpc_id = module.vpc.vpc_id
vpc_cidrs = module.vpc.vpc_cidrs
vpc_ipv6_cidrs = module.vpc.vpc_ipv6_cidrs
vpc_security_group_ids = [module.vpc.master_sg_id]
publish_strategy = var.aws_publish_strategy
use_ipv6 = var.aws_use_ipv6

tags = local.tags
}
Expand Down Expand Up @@ -70,10 +72,12 @@ module "dns" {
cluster_domain = var.cluster_domain
cluster_id = var.cluster_id
etcd_count = var.master_count
etcd_ip_addresses = flatten(module.masters.ip_addresses)
etcd_ip_addresses = var.aws_use_ipv6 == true ? flatten(module.masters.ipv6_addresses) : flatten(module.masters.ip_addresses)
tags = local.tags
vpc_id = module.vpc.vpc_id
publish_strategy = var.aws_publish_strategy

use_ipv6 = var.aws_use_ipv6
}

module "vpc" {
Expand All @@ -95,6 +99,8 @@ module "vpc" {
)

tags = local.tags

use_ipv6 = var.aws_use_ipv6
}

resource "aws_ami_copy" "main" {
Expand Down
12 changes: 10 additions & 2 deletions data/data/aws/master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,16 @@ resource "aws_network_interface" "master" {
var.tags,
)
}


# NOTE(russellb) For some reason, I was not able to access get IPv6 addresses
# on the resource, but was able to get them using the network interface data
# source.
data "aws_network_interface" "master" {
count = var.instance_count

id = aws_network_interface.master[count.index].id
}

resource "aws_instance" "master" {
count = var.instance_count
ami = var.ec2_ami
Expand Down Expand Up @@ -137,4 +146,3 @@ resource "aws_lb_target_group_attachment" "master" {
target_group_arn = var.target_group_arns[count.index % local.target_group_arns_length]
target_id = aws_instance.master[floor(count.index / local.target_group_arns_length)].private_ip
}

3 changes: 3 additions & 0 deletions data/data/aws/master/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ output "ip_addresses" {
value = aws_network_interface.master.*.private_ips
}

output "ipv6_addresses" {
value = data.aws_network_interface.master.*.ipv6_addresses
}
21 changes: 11 additions & 10 deletions data/data/aws/route53/base.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,20 @@ resource "aws_route53_record" "api_external_internal_zone" {
}

resource "aws_route53_record" "etcd_a_nodes" {
count = var.etcd_count
count = var.use_ipv6 == false ? var.etcd_count : 0
type = "A"
ttl = "60"
zone_id = aws_route53_zone.int.zone_id
name = "etcd-${count.index}.${var.cluster_domain}"
# TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to
# force an interpolation expression to be interpreted as a list by wrapping it
# in an extra set of list brackets. That form was supported for compatibilty in
# v0.11, but is no longer supported in Terraform v0.12.
#
# If the expression in the following list itself returns a list, remove the
# brackets to avoid interpretation as a list of lists. If the expression
# returns a single list item then leave it as-is and remove this TODO comment.
records = [var.etcd_ip_addresses[count.index]]
}

resource "aws_route53_record" "etcd_aaaa_nodes" {
count = var.use_ipv6 == true ? var.etcd_count : 0
type = "AAAA"
ttl = "60"
zone_id = aws_route53_zone.int.zone_id
name = "etcd-${count.index}.${var.cluster_domain}"
records = [var.etcd_ip_addresses[count.index]]
}

Expand All @@ -90,6 +91,6 @@ resource "aws_route53_record" "etcd_cluster" {
ttl = "60"
zone_id = aws_route53_zone.int.zone_id
name = "_etcd-server-ssl._tcp"
records = formatlist("0 10 2380 %s", aws_route53_record.etcd_a_nodes.*.fqdn)
records = formatlist("0 10 2380 %s", var.use_ipv6 == false ? aws_route53_record.etcd_a_nodes.*.fqdn : aws_route53_record.etcd_aaaa_nodes.*.fqdn)
}

7 changes: 6 additions & 1 deletion data/data/aws/route53/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variable "etcd_count" {
}

variable "etcd_ip_addresses" {
description = "List of string IPs for machines running etcd members."
description = "List of string IPs (IPv4 or IPv6) for machines running etcd members."
type = list(string)
default = []
}
Expand Down Expand Up @@ -64,3 +64,8 @@ based on if api_external_lb_dns_name for example, which will be null when there
So publish_strategy serves an coordinated proxy for that decision.
EOF
}

variable "use_ipv6" {
description = "Use IPv6 instead of IPv4"
type = bool
}
6 changes: 6 additions & 0 deletions data/data/aws/variables-aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ variable "aws_publish_strategy" {
type = string
description = "The cluster publishing strategy, either Internal or External"
}

variable "aws_use_ipv6" {
type = bool
default = false
description = "Enable an experimental IPv6 environment"
}
1 change: 0 additions & 1 deletion data/data/aws/vpc/master-elb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,3 @@ resource "aws_lb_listener" "api_external_api" {
type = "forward"
}
}

5 changes: 4 additions & 1 deletion data/data/aws/vpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ output "vpc_cidrs" {
value = [data.aws_vpc.cluster_vpc.cidr_block]
}

output "vpc_ipv6_cidrs" {
value = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]
}

output "az_to_private_subnet_id" {
value = zipmap(data.aws_subnet.private.*.availability_zone, data.aws_subnet.private.*.id)
}
Expand Down Expand Up @@ -63,4 +67,3 @@ output "aws_lb_api_internal_dns_name" {
output "aws_lb_api_internal_zone_id" {
value = aws_lb.api_internal.zone_id
}

88 changes: 88 additions & 0 deletions data/data/aws/vpc/sg-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ resource "aws_security_group_rule" "master_mcs" {
to_port = 22623
}

resource "aws_security_group_rule" "master_mcs_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

protocol = "tcp"
ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]
from_port = 22623
to_port = 22623
}

resource "aws_security_group_rule" "master_egress" {
type = "egress"
security_group_id = aws_security_group.master.id
Expand All @@ -33,6 +45,18 @@ resource "aws_security_group_rule" "master_egress" {
cidr_blocks = ["0.0.0.0/0"]
}

resource "aws_security_group_rule" "master_egress_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "egress"
security_group_id = aws_security_group.master.id

from_port = 0
to_port = 0
protocol = "-1"
ipv6_cidr_blocks = ["::/0"]
}

resource "aws_security_group_rule" "master_ingress_icmp" {
type = "ingress"
security_group_id = aws_security_group.master.id
Expand All @@ -43,6 +67,18 @@ resource "aws_security_group_rule" "master_ingress_icmp" {
to_port = -1
}

resource "aws_security_group_rule" "master_ingress_icmp_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

protocol = "icmp"
ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]
from_port = -1
to_port = -1
}

resource "aws_security_group_rule" "master_ingress_ssh" {
type = "ingress"
security_group_id = aws_security_group.master.id
Expand All @@ -53,6 +89,18 @@ resource "aws_security_group_rule" "master_ingress_ssh" {
to_port = 22
}

resource "aws_security_group_rule" "master_ingress_ssh_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

protocol = "tcp"
ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]
from_port = 22
to_port = 22
}

resource "aws_security_group_rule" "master_ingress_https" {
type = "ingress"
security_group_id = aws_security_group.master.id
Expand All @@ -63,6 +111,18 @@ resource "aws_security_group_rule" "master_ingress_https" {
to_port = 6443
}

resource "aws_security_group_rule" "master_ingress_https_v6" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

protocol = "tcp"
ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]
from_port = 6443
to_port = 6443
}

resource "aws_security_group_rule" "master_ingress_vxlan" {
type = "ingress"
security_group_id = aws_security_group.master.id
Expand Down Expand Up @@ -253,3 +313,31 @@ resource "aws_security_group_rule" "master_ingress_services_udp" {
self = true
}

# For our AWS IPv6 environment, we run CoreDNS with host networking,
# because it must use IPv4 to reach AWS DNS, so it can't be on our
# IPv6 only SDN.
resource "aws_security_group_rule" "master_dns_udp" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]

protocol = "udp"
from_port = 5353
to_port = 5353
}

resource "aws_security_group_rule" "master_dns_tcp" {
count = var.use_ipv6 == true ? 1 : 0

type = "ingress"
security_group_id = aws_security_group.master.id

ipv6_cidr_blocks = [data.aws_vpc.cluster_vpc.ipv6_cidr_block]

protocol = "tcp"
from_port = 5353
to_port = 5353
}
Loading