Skip to content

Commit

Permalink
multicast: make igmp query interval configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Liu <biliu@vmware.com>
  • Loading branch information
liu4480 committed May 24, 2022
1 parent 22b9307 commit 99514c2
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 67 deletions.
1 change: 1 addition & 0 deletions build/charts/antrea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Kubernetes: `>= 1.16.0-0`
| kubeAPIServerOverride | string | `""` | Address of Kubernetes apiserver, to override any value provided in kubeconfig or InClusterConfig. |
| logVerbosity | int | `0` | |
| multicastInterfaces | list | `[]` | Names of the interfaces on Nodes that are used to forward multicast traffic. |
| igmpQueryInterval | int | `125`| The interval for antrea-agent to send IGMP query to Pods, time unit is second.
| noSNAT | bool | `false` | Whether or not to SNAT (using the Node IP) the egress traffic from a Pod to the external network. |
| nodeIPAM.clusterCIDRs | list | `[]` | CIDR ranges to use when allocating Pod IP addresses. |
| nodeIPAM.enable | bool | `false` | Enable Node IPAM in Antrea |
Expand Down
15 changes: 11 additions & 4 deletions build/charts/antrea/conf/antrea-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,19 @@ tlsMinVersion: {{ .Values.tlsMinVersion | quote }}
# 3. The Node IP
transportInterface: {{ .Values.transportInterface | quote }}

multicast:
{{- with .Values.multicast }}
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
{{- with .Values.multicastInterfaces }}
{{- toYaml . | nindent 2 }}
{{- end }}
multicastInterfaces:
{{- with .multicastInterfaces }}
{{- toYaml . | nindent 4 }}
{{- end }}

# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: {{ .igmpQueryInterval }}
{{- end}}

# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down
10 changes: 8 additions & 2 deletions build/charts/antrea/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ transportInterface: ""
# -- Network CIDRs of the interface on Node which is used for tunneling or
# routing the traffic across Nodes.
transportInterfaceCIDRs: []
# -- Names of the interfaces on Nodes that are used to forward multicast traffic.
multicastInterfaces: []

multicast:
# -- Names of the interfaces on Nodes that are used to forward multicast traffic.
multicastInterfaces: []
# -- The interval for antrea-agent to send IGMP query to pods, time uint is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125

# -- Default MTU to use for the host gateway interface and the network interface
# of each Pod. By default, antrea-agent will discover the MTU of the Node's
# primary interface and adjust it to accommodate for tunnel encapsulation
Expand Down
11 changes: 8 additions & 3 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ data:
# 3. The Node IP
transportInterface: ""
multicast:
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
multicastInterfaces:
# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125
# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down Expand Up @@ -3486,7 +3491,7 @@ spec:
kubectl.kubernetes.io/default-container: antrea-agent
# Automatically restart Pods with a RollingUpdate if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 4554a36b927c6e64fdbc53b4d4c64673d48c9c829ec444e3be6e699ade8481b6
checksum/config: 3b457b52eff11631f8afc718f43769caa51133a1c30a2bc858972e4ea79fd753
labels:
app: antrea
component: antrea-agent
Expand Down Expand Up @@ -3726,7 +3731,7 @@ spec:
annotations:
# Automatically restart Pod if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 4554a36b927c6e64fdbc53b4d4c64673d48c9c829ec444e3be6e699ade8481b6
checksum/config: 3b457b52eff11631f8afc718f43769caa51133a1c30a2bc858972e4ea79fd753
labels:
app: antrea
component: antrea-controller
Expand Down
11 changes: 8 additions & 3 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ data:
# 3. The Node IP
transportInterface: ""
multicast:
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
multicastInterfaces:
# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125
# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down Expand Up @@ -3486,7 +3491,7 @@ spec:
kubectl.kubernetes.io/default-container: antrea-agent
# Automatically restart Pods with a RollingUpdate if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 4554a36b927c6e64fdbc53b4d4c64673d48c9c829ec444e3be6e699ade8481b6
checksum/config: 3b457b52eff11631f8afc718f43769caa51133a1c30a2bc858972e4ea79fd753
labels:
app: antrea
component: antrea-agent
Expand Down Expand Up @@ -3728,7 +3733,7 @@ spec:
annotations:
# Automatically restart Pod if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 4554a36b927c6e64fdbc53b4d4c64673d48c9c829ec444e3be6e699ade8481b6
checksum/config: 3b457b52eff11631f8afc718f43769caa51133a1c30a2bc858972e4ea79fd753
labels:
app: antrea
component: antrea-controller
Expand Down
11 changes: 8 additions & 3 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ data:
# 3. The Node IP
transportInterface: ""
multicast:
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
multicastInterfaces:
# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125
# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down Expand Up @@ -3486,7 +3491,7 @@ spec:
kubectl.kubernetes.io/default-container: antrea-agent
# Automatically restart Pods with a RollingUpdate if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: edef4c00e4f28a10dc1e077086ef68641a9a3b53d0fe7d47ff3dafc2ce5d5c9b
checksum/config: 78dbecf55ff93beb84ac29a187f617bd3853af405520b92cadd7a4d98c5b5ed3
labels:
app: antrea
component: antrea-agent
Expand Down Expand Up @@ -3726,7 +3731,7 @@ spec:
annotations:
# Automatically restart Pod if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: edef4c00e4f28a10dc1e077086ef68641a9a3b53d0fe7d47ff3dafc2ce5d5c9b
checksum/config: 78dbecf55ff93beb84ac29a187f617bd3853af405520b92cadd7a4d98c5b5ed3
labels:
app: antrea
component: antrea-controller
Expand Down
11 changes: 8 additions & 3 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,14 @@ data:
# 3. The Node IP
transportInterface: ""
multicast:
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
multicastInterfaces:
# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125
# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down Expand Up @@ -3499,7 +3504,7 @@ spec:
kubectl.kubernetes.io/default-container: antrea-agent
# Automatically restart Pods with a RollingUpdate if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 50cc962db93c0354f5eaa088e51d690e779692979cbafac0c3e27a88fc2c0c7c
checksum/config: 0d141884a1852335a8a14916850b5b9d8924f0b205a6b9bf179399381bf04fea
checksum/ipsec-secret: d0eb9c52d0cd4311b6d252a951126bf9bea27ec05590bed8a394f0f792dcb2a4
labels:
app: antrea
Expand Down Expand Up @@ -3775,7 +3780,7 @@ spec:
annotations:
# Automatically restart Pod if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: 50cc962db93c0354f5eaa088e51d690e779692979cbafac0c3e27a88fc2c0c7c
checksum/config: 0d141884a1852335a8a14916850b5b9d8924f0b205a6b9bf179399381bf04fea
labels:
app: antrea
component: antrea-controller
Expand Down
11 changes: 8 additions & 3 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ data:
# 3. The Node IP
transportInterface: ""
multicast:
# The names of the interfaces on Nodes that are used to forward multicast traffic.
# Defaults to transport interface if not set.
multicastInterfaces:
multicastInterfaces:
# The interval for antrea-agent to send IGMP query to Pods, time unit is second.
# Defaults to 125 seconds.
igmpQueryInterval: 125
# The network CIDRs of the interface on Node which is used for tunneling or routing the traffic across
# Nodes. If there are multiple interfaces configured the same network CIDR, the first one is used. The
Expand Down Expand Up @@ -3486,7 +3491,7 @@ spec:
kubectl.kubernetes.io/default-container: antrea-agent
# Automatically restart Pods with a RollingUpdate if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: f7414e9171ab246b09dc380bc7934ebac81af7a5ef7bd3f73d661b6301040768
checksum/config: 37d55103cfa223781c44d6d05c7094cc8038fc6c4c03770bca35065acd4ba81a
labels:
app: antrea
component: antrea-agent
Expand Down Expand Up @@ -3726,7 +3731,7 @@ spec:
annotations:
# Automatically restart Pod if the ConfigMap changes
# See https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
checksum/config: f7414e9171ab246b09dc380bc7934ebac81af7a5ef7bd3f73d661b6301040768
checksum/config: 37d55103cfa223781c44d6d05c7094cc8038fc6c4c03770bca35065acd4ba81a
labels:
app: antrea
component: antrea-controller
Expand Down
5 changes: 3 additions & 2 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,10 @@ func run(o *Options) error {
nodeConfig,
ifaceStore,
multicastSocket,
sets.NewString(append(o.config.MulticastInterfaces, nodeConfig.NodeTransportInterfaceName)...),
sets.NewString(append(o.config.Multicast.MulticastInterfaces, nodeConfig.NodeTransportInterfaceName)...),
ovsBridgeClient,
podUpdateChannel)
podUpdateChannel,
o.igmpQueryInterval)
if err := mcastController.Initialize(); err != nil {
return err
}
Expand Down
15 changes: 13 additions & 2 deletions cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
defaultFlowPollInterval = 5 * time.Second
defaultActiveFlowExportTimeout = 30 * time.Second
defaultIdleFlowExportTimeout = 15 * time.Second
defaultIGMPQueryInterval = 125 * time.Second
defaultStaleConnectionTimeout = 5 * time.Minute
defaultNPLPortRange = "61000-62000"
)
Expand All @@ -68,8 +69,10 @@ type Options struct {
idleFlowTimeout time.Duration
// Stale connection timeout to delete connections if they are not exported.
staleConnectionTimeout time.Duration
nplStartPort int
nplEndPort int
// IGMP query interval
igmpQueryInterval time.Duration
nplStartPort int
nplEndPort int
}

func newOptions() *Options {
Expand Down Expand Up @@ -271,6 +274,14 @@ func (o *Options) setDefaults() {
o.config.NodePortLocal.PortRange = defaultNPLPortRange
}
}

if features.DefaultFeatureGate.Enabled(features.Multicast) {
if o.config.Multicast.IGMPQueryInterval == 0 {
o.igmpQueryInterval = defaultIGMPQueryInterval
} else {
o.igmpQueryInterval = time.Duration(o.config.Multicast.IGMPQueryInterval) * time.Second
}
}
}

func (o *Options) validateAntreaProxyConfig() error {
Expand Down
7 changes: 6 additions & 1 deletion hack/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Generate a YAML manifest for Antrea using Helm and print it to stdout.
--help, -h Print this message and exit
--multicast Generates a manifest for multicast.
--multicast-interfaces Multicast interface names (default is empty)
--igmpquery-interval Interval to send IGMP query, time unit is second (default is 125)
--extra-helm-values-file Optional extra helm values file to override the default config values
In 'release' mode, environment variables IMG_NAME and IMG_TAG must be set.
Expand Down Expand Up @@ -201,6 +202,10 @@ case $key in
MULTICAST_INTERFACES="$2"
shift 2
;;
--igmpquery-interval)
IGMPQUERY_INTERVAL="$2"
shift 2
;;
--extra-helm-values-file)
if [[ ! -f "$2" ]]; then
echoerr "Helm values file $2 does not exist."
Expand Down Expand Up @@ -307,7 +312,7 @@ if $FLEXIBLE_IPAM; then
fi

if $MULTICAST; then
HELM_VALUES+=("trafficEncapMode=noEncap" "featureGates.Multicast=true" "multicastInterfaces={$MULTICAST_INTERFACES}")
HELM_VALUES+=("trafficEncapMode=noEncap" "featureGates.Multicast=true" "multicast.multicastInterfaces={$MULTICAST_INTERFACES}" "multicast.igmpQueryInterval=${IGMPQUERY_INTERVAL}")
fi

if $ALLFEATURES; then
Expand Down
Loading

0 comments on commit 99514c2

Please sign in to comment.