Skip to content

Commit

Permalink
add ENABLE_V4_EGRESS
Browse files Browse the repository at this point in the history
  • Loading branch information
jdn5126 committed Sep 21, 2023
1 parent 66d4440 commit 2d42e24
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,16 @@ This environment variable must be set for both the `aws-vpc-cni-init` and `aws-n

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.

#### `ENABLE_V4_EGRESS` (v1.15.1+)

Type: Boolean as a String

Default: `true`

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.

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. 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 IPv4 traffic.

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

Type: Integer as a String
Expand Down
2 changes: 1 addition & 1 deletion cmd/aws-vpc-cni-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func configureIPv6Settings(procSys procsyswrapper.ProcSys, primaryIF string) err
val, _ := procSys.Get(entry)
log.Infof("Updated %s to %s", entry, val)
}
// Check if IPv6 egress supporting is enabled in IPv4 cluster
// Check if IPv6 egress support is enabled in IPv4 cluster.
ipv6EgressEnabled := utils.GetBoolAsStringEnvVar(envEgressV6, defaultEnableIPv6Egress)
if enableIPv6 || ipv6EgressEnabled {
entry := "net/ipv6/conf/all/forwarding"
Expand Down
5 changes: 4 additions & 1 deletion cmd/aws-vpc-cni/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const (
defaultPluginLogLevel = "Debug"
defaultEnableIPv6 = false
defaultEnableIPv6Egress = false
defaultEnableIPv4Egress = true
defaultRandomizeSNAT = "prng"
awsConflistFile = "/10-aws.conflist"
vpcCniInitDonePath = "/vpc-cni-init/done"
Expand All @@ -100,6 +101,7 @@ const (
envEnBandwidthPlugin = "ENABLE_BANDWIDTH_PLUGIN"
envEnIPv6 = "ENABLE_IPv6"
envEnIPv6Egress = "ENABLE_V6_EGRESS"
envEnIPv4Egress = "ENABLE_V4_EGRESS"
envRandomizeSNAT = "AWS_VPC_K8S_CNI_RANDOMIZESNAT"
envIPCooldownPeriod = "IP_COOLDOWN_PERIOD"
envDisablePodV6 = "DISABLE_POD_V6"
Expand Down Expand Up @@ -249,7 +251,8 @@ func generateJSON(jsonFile string, outFile string, getPrimaryIP func(ipv4 bool)
egressIPAMSubnet = egressPluginIpamSubnetV4
egressIPAMDst = egressPluginIpamDstV4
egressIPAMDataDir = egressPluginIpamDataDirV4
egressEnabled = true // enable IPv4 egress by default of IPv6 cluster
// Enable IPv4 egress when "ENABLE_V4_EGRESS" is "true" (default)
egressEnabled = utils.GetBoolAsStringEnvVar(envEnIPv4Egress, defaultEnableIPv4Egress)
egressPluginLogFile = utils.GetEnv(envEgressV4PluginLogFile, defaultEgressV4PluginLogFile)
nodeIP, err = getPrimaryIP(true)
// Node should have a IPv4 address even in IPv6 cluster
Expand Down

0 comments on commit 2d42e24

Please sign in to comment.