-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(network): add support for optional IPv6 configuration
IPv4/IPv6 dual-stack is actually not supported, it keeps being an IPv4 single stack. PRs welcome! Added the `enable_ipv6` variable to conditionally enable IPv6 addresses for servers. This update allows users to specify whether their infrastructure should support IPv6, making the setup more flexible for different network requirements. Additionally, updated resources and configurations to respect the `enable_ipv6` flag, including adjustments to server and network configurations to properly handle IPv6 addresses and subnets when enabled. This change enhances network configuration options, enabling users to opt for IPv6 support based on their specific needs or restrictions. The update includes: - A new variable `enable_ipv6` to toggle IPv6 support. - Conditional logic in Terraform configurations to apply IPv6 settings. - Adjustments to server provisioning scripts to enable or disable IPv6 based on the new variable. This enhancement simplifies network configuration management in environments where IPv6 support is either required or needs to be explicitly disabled, providing greater flexibility in how infrastructure is deployed.
- Loading branch information
Showing
5 changed files
with
118 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,82 @@ | ||
locals { | ||
worker_yaml = [for index in range(0, var.control_plane_count) : yamlencode({ | ||
machine = { | ||
kubelet = { | ||
extraArgs = { | ||
"cloud-provider" = "external" | ||
"rotate-server-certificates" = true | ||
} | ||
clusterDNS = concat( | ||
[cidrhost(local.service_ipv4_cidr, 10)] | ||
) | ||
nodeIP = { | ||
validSubnets = [ | ||
local.node_ipv4_cidr | ||
worker_yaml = [ | ||
for index in range(0, var.control_plane_count) : yamlencode({ | ||
machine = { | ||
install = { | ||
extraKernelArgs = [ | ||
"ipv6.disable=${var.enable_ipv6 ? 0 : 1}", | ||
] | ||
} | ||
} | ||
network = { | ||
interfaces = [ | ||
{ | ||
interface = "eth0" | ||
dhcp = false | ||
addresses : [ | ||
local.worker_public_ipv4_list[index], | ||
] | ||
routes = [ | ||
{ | ||
network = "172.31.1.1/32" | ||
}, | ||
{ | ||
network = "0.0.0.0/0" | ||
gateway : "172.31.1.1" | ||
} | ||
kubelet = { | ||
extraArgs = { | ||
"cloud-provider" = "external" | ||
"rotate-server-certificates" = true | ||
} | ||
clusterDNS = concat( | ||
[cidrhost(local.service_ipv4_cidr, 10)] | ||
) | ||
nodeIP = { | ||
validSubnets = [ | ||
local.node_ipv4_cidr | ||
] | ||
} | ||
] | ||
extraHostEntries = local.extra_host_entries | ||
} | ||
sysctls = { | ||
"net.core.somaxconn" = "65535" | ||
"net.core.netdev_max_backlog" = "4096" | ||
} | ||
time = { | ||
servers = [ | ||
"ntp1.hetzner.de", | ||
"ntp2.hetzner.com", | ||
"ntp3.hetzner.net", | ||
"time.cloudflare.com" | ||
] | ||
} | ||
} | ||
cluster = { | ||
network = { | ||
dnsDomain = local.cluster_domain | ||
podSubnets = [ | ||
local.pod_ipv4_cidr | ||
] | ||
serviceSubnets = [ | ||
local.service_ipv4_cidr | ||
] | ||
} | ||
network = { | ||
interfaces = [ | ||
{ | ||
interface = "eth0" | ||
dhcp = false | ||
addresses : [ | ||
local.worker_public_ipv4_list[index], | ||
var.enable_ipv6 ? local.worker_public_ipv6_list[index] : null | ||
] | ||
routes = concat([ | ||
{ | ||
network = "172.31.1.1/32" | ||
}, | ||
{ | ||
network = "0.0.0.0/0" | ||
gateway : "172.31.1.1" | ||
} | ||
], | ||
var.enable_ipv6 ? [ | ||
{ | ||
network = local.worker_public_ipv6_subnet_list[index] | ||
gateway : "fe80::1" | ||
} | ||
] : [] | ||
) | ||
} | ||
] | ||
extraHostEntries = local.extra_host_entries | ||
} | ||
sysctls = { | ||
"net.core.somaxconn" = "65535" | ||
"net.core.netdev_max_backlog" = "4096" | ||
} | ||
time = { | ||
servers = [ | ||
"ntp1.hetzner.de", | ||
"ntp2.hetzner.com", | ||
"ntp3.hetzner.net", | ||
"time.cloudflare.com" | ||
] | ||
} | ||
} | ||
proxy = { | ||
disabled = true | ||
cluster = { | ||
network = { | ||
dnsDomain = local.cluster_domain | ||
podSubnets = [ | ||
local.pod_ipv4_cidr | ||
] | ||
serviceSubnets = [ | ||
local.service_ipv4_cidr | ||
] | ||
} | ||
proxy = { | ||
disabled = true | ||
} | ||
} | ||
} | ||
}) | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters