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 25, 2022
1 parent 22b9307 commit 4f73825
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 66 deletions.
3 changes: 2 additions & 1 deletion build/charts/antrea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Kubernetes: `>= 1.16.0-0`
| ipsec.psk | string | `"changeme"` | Preshared Key (PSK) for IKE authentication. It will be stored in a secret and passed to antrea-agent as an environment variable. |
| 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. |
| multicast.igmpQueryInterval | string | `"125s"` | The interval at which the antrea-agent sends IGMP queries to Pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". |
| multicast.multicastInterfaces | list | `[]` | Names of the interfaces on Nodes that are used to forward multicast traffic. |
| 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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: {{ .igmpQueryInterval | quote }}
{{- 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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"

# -- 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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"
# 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: 0cc20edc3fc882f0ea9bd3450fbab504858feeff47e1d3f09d8f6ebacd741dbe
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: 0cc20edc3fc882f0ea9bd3450fbab504858feeff47e1d3f09d8f6ebacd741dbe
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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"
# 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: 0cc20edc3fc882f0ea9bd3450fbab504858feeff47e1d3f09d8f6ebacd741dbe
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: 0cc20edc3fc882f0ea9bd3450fbab504858feeff47e1d3f09d8f6ebacd741dbe
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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"
# 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: 6b6be76fd37d8fdac7783fcd026b6f34e993630c12c339b1dafa99ba5b36cf00
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: 6b6be76fd37d8fdac7783fcd026b6f34e993630c12c339b1dafa99ba5b36cf00
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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"
# 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: d289c621cfdc7aee9e8320c0398e76f302591b0adc12156d470320ee9839c073
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: d289c621cfdc7aee9e8320c0398e76f302591b0adc12156d470320ee9839c073
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 at which the antrea-agent sends IGMP queries to Pods.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
igmpQueryInterval: "125s"
# 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: 976e8c918d8c411df17238dd333a51f9adfdfafe2d6d480d7652f16be02fff3c
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: 976e8c918d8c411df17238dd333a51f9adfdfafe2d6d480d7652f16be02fff3c
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
24 changes: 24 additions & 0 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,6 +69,7 @@ type Options struct {
idleFlowTimeout time.Duration
// Stale connection timeout to delete connections if they are not exported.
staleConnectionTimeout time.Duration
igmpQueryInterval time.Duration
nplStartPort int
nplEndPort int
}
Expand Down Expand Up @@ -161,6 +163,9 @@ func (o *Options) validate(args []string) error {
if err := o.validateFlowExporterConfig(); err != nil {
return fmt.Errorf("failed to validate flow exporter config: %v", err)
}
if err := o.validateMulticastConfig(); err != nil {
return fmt.Errorf("failed to validate multicast config: %v", err)
}
if features.DefaultFeatureGate.Enabled(features.Egress) {
for _, cidr := range o.config.Egress.ExceptCIDRs {
_, _, err := net.ParseCIDR(cidr)
Expand Down Expand Up @@ -271,6 +276,12 @@ func (o *Options) setDefaults() {
o.config.NodePortLocal.PortRange = defaultNPLPortRange
}
}

if features.DefaultFeatureGate.Enabled(features.Multicast) {
if o.config.Multicast.IGMPQueryInterval == "" {
o.igmpQueryInterval = defaultIGMPQueryInterval
}
}
}

func (o *Options) validateAntreaProxyConfig() error {
Expand Down Expand Up @@ -351,6 +362,19 @@ func (o *Options) validateFlowExporterConfig() error {
return nil
}

func (o *Options) validateMulticastConfig() error {
if features.DefaultFeatureGate.Enabled(features.Multicast) {
var err error
if o.config.Multicast.IGMPQueryInterval != "" {
o.igmpQueryInterval, err = time.ParseDuration(o.config.Multicast.IGMPQueryInterval)
if err != nil {
return err
}
}
}
return nil
}

func (o *Options) validateAntreaIPAMConfig() error {
if !o.config.EnableBridgingMode {
return nil
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,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}")
fi

if $ALLFEATURES; then
Expand Down
Loading

0 comments on commit 4f73825

Please sign in to comment.