Skip to content

Commit e6974db

Browse files
authored
add ENABLE_V4_EGRESS (#2577)
1 parent 66d4440 commit e6974db

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,17 @@ Specifies whether PODs in an IPv4 cluster support IPv6 egress. If env is set to
670670

671671
This environment variable must be set for both the `aws-vpc-cni-init` and `aws-node` containers in order for this feature to work properly. This feature also requires that the node has an IPv6 address assigned to its primary ENI, as this address is used for SNAT to IPv6 endpoints outside of the cluster. If the configuration prerequisites are not met, the `egress-cni` plugin is not enabled and an error log is printed in the `aws-node` container.
672672

673-
Note that enabling/disabling this feature only affects whether newly created pods have an IPv6 interface created. Therefore, it is recommended that you reboot existing nodes after enabling/disabling this feature. Also note that if you are using this feature in conjunction with `ENABLE_POD_ENI` (Security Groups for Pods), the security group rules will NOT be applied to egressing IPv6 traffic.
673+
Note that enabling/disabling this feature only affects whether newly created pods have an IPv6 interface created. Therefore, it is recommended that you reboot existing nodes after enabling/disabling this feature.
674+
675+
#### `ENABLE_V4_EGRESS` (v1.15.1+)
676+
677+
Type: Boolean as a String
678+
679+
Default: `true`
680+
681+
Specifies whether PODs in an IPv6 cluster support IPv4 egress. If env is set to `true`, range `169.254.172.0/22` is reserved for IPv4 egress. When enabled, traffic egressing an IPv6 pod destined to an IPv4 endpoint will be SNAT'ed via the node IPv4 address.
682+
683+
Note that enabling/disabling this feature only affects whether newly created pods have an IPv4 interface created. Therefore, it is recommended that you reboot existing nodes after enabling/disabling this feature.
674684

675685
#### `IP_COOLDOWN_PERIOD` (v1.15.0+)
676686

cmd/aws-vpc-cni-init/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func configureIPv6Settings(procSys procsyswrapper.ProcSys, primaryIF string) err
114114
val, _ := procSys.Get(entry)
115115
log.Infof("Updated %s to %s", entry, val)
116116
}
117-
// Check if IPv6 egress supporting is enabled in IPv4 cluster
117+
// Check if IPv6 egress support is enabled in IPv4 cluster.
118118
ipv6EgressEnabled := utils.GetBoolAsStringEnvVar(envEgressV6, defaultEnableIPv6Egress)
119119
if enableIPv6 || ipv6EgressEnabled {
120120
entry := "net/ipv6/conf/all/forwarding"

cmd/aws-vpc-cni/main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const (
7575
defaultPluginLogLevel = "Debug"
7676
defaultEnableIPv6 = false
7777
defaultEnableIPv6Egress = false
78+
defaultEnableIPv4Egress = true
7879
defaultRandomizeSNAT = "prng"
7980
awsConflistFile = "/10-aws.conflist"
8081
vpcCniInitDonePath = "/vpc-cni-init/done"
@@ -100,6 +101,7 @@ const (
100101
envEnBandwidthPlugin = "ENABLE_BANDWIDTH_PLUGIN"
101102
envEnIPv6 = "ENABLE_IPv6"
102103
envEnIPv6Egress = "ENABLE_V6_EGRESS"
104+
envEnIPv4Egress = "ENABLE_V4_EGRESS"
103105
envRandomizeSNAT = "AWS_VPC_K8S_CNI_RANDOMIZESNAT"
104106
envIPCooldownPeriod = "IP_COOLDOWN_PERIOD"
105107
envDisablePodV6 = "DISABLE_POD_V6"
@@ -249,7 +251,8 @@ func generateJSON(jsonFile string, outFile string, getPrimaryIP func(ipv4 bool)
249251
egressIPAMSubnet = egressPluginIpamSubnetV4
250252
egressIPAMDst = egressPluginIpamDstV4
251253
egressIPAMDataDir = egressPluginIpamDataDirV4
252-
egressEnabled = true // enable IPv4 egress by default of IPv6 cluster
254+
// Enable IPv4 egress when "ENABLE_V4_EGRESS" is "true" (default)
255+
egressEnabled = utils.GetBoolAsStringEnvVar(envEnIPv4Egress, defaultEnableIPv4Egress)
253256
egressPluginLogFile = utils.GetEnv(envEgressV4PluginLogFile, defaultEgressV4PluginLogFile)
254257
nodeIP, err = getPrimaryIP(true)
255258
// Node should have a IPv4 address even in IPv6 cluster

0 commit comments

Comments
 (0)