-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an agent config parameter for enabling flexible IPAM (bridging mode) #3297
Conversation
@gran-vmv @annakhm @tnqn @antoninbas : my intention is to separate the Antrea IPAM and the datapath changes to support "flexible IPAM" Pods, and later we can enable Antrea IPAM for other use cases like secondary network. I do not have a good idea how to name the parameter for the latter, and now call it "enableBridgingName", given the forwarding pipeline is like VLAN bridging. But please share if you have a better name. |
Codecov Report
@@ Coverage Diff @@
## main #3297 +/- ##
===========================================
- Coverage 59.04% 41.82% -17.22%
===========================================
Files 331 199 -132
Lines 28420 24099 -4321
===========================================
- Hits 16781 10080 -6701
- Misses 9798 12987 +3189
+ Partials 1841 1032 -809
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -98,6 +99,15 @@ featureGates: | |||
# - wireGuard: Enable WireGuard for tunnel traffic encryption. | |||
#trafficEncryptionMode: none | |||
|
|||
# Eanble bridging mode of Pod network on Nodes, in which the Node's transport interface is connected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: s/Eanble/Enable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -31,8 +31,9 @@ featureGates: | |||
# Enable controlling SNAT IPs of Pod egress traffic. | |||
# Egress: false | |||
|
|||
# Enable flexible IPAM mode for Antrea. This mode allows to assign IP Ranges to Namespaces, | |||
# Deployments and StatefulSets via IP Pool annotation. | |||
# Enable AntreaIPAM. AntreaIPAM is required by the bridging mode, and can assign IPs to bridging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe:
can assign IPs to Pods connected in bridging mode
BTW, is "bridging mode" a standard term and does it mean something different from "bridge mode"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the last comment, I do not have a good idea on how to name this mode/parameter. I call it bridging mode, just because the datapath behavior is like L2 bridging. And I welcome suggestions for a better name.
I think "bridge" vs "bridging" is like "switch" vs "switching".
return nil | ||
} | ||
if !features.DefaultFeatureGate.Enabled(features.AntreaIPAM) { | ||
klog.InfoS("The enableBridgingMode option is set to true, but it will be ignored because the AntreaIPAM feature gate is disabled") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious about why we simply log a warning here, while we fail with an error if noSNAT is disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I returned an error originally, but then saw enableNodePortLocal just log a message and ignore the config if NodePortLocal feature gate is not enabled. Start to think it might be a rational if feature gate is for activating/deactivating a separate feature.
But let me know what you think.
# mode Pods from the IPPools configured for Namespaces, Deployments, StatefulSets, or individual | ||
# Pods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is the right place to mention it but as it is phrased at the moment, it makes it sound like AntreaIPAM
only make sense in bridging mode. While it may be the case now, I believe that the intention of this PR is to support other use cases for AntreaIPAM
, which won't require bridging mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can remove "from the IPPools configured for Namespaces, Deployments, StatefulSets, or individual Pods".
if !o.config.NoSNAT { | ||
return fmt.Errorf("AntreaIPAM requires noSNAT") | ||
} | ||
if !o.config.EnableBridgingMode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break existing setup when upgrading a FlexibleIPAM cluster. Is this acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I feel it is ok, assuming no one really uses the feature in production yet, and users can set EnableBridgingMode to true in the ConfigMap when upgrading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. And we should notify users this change in Release Note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnqn Any comments about this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with this, this is an Alpha feature
@@ -53,6 +53,9 @@ func (o *Options) checkUnsupportedFeatures() error { | |||
if encryptionMode != config.TrafficEncryptionModeNone { | |||
unsupported = append(unsupported, "TrafficEncryptionMode: "+encryptionMode.String()) | |||
} | |||
if o.config.EnableBridgingMode { | |||
unsupported = append(unsupported, "EnableBridgingMode") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future release, FlexibleIPAM feature may support Windows. However, it is already bridging mode
forced to be enabled on Windows, although some details and functions are slightly different.
Maybe we need to distinguish between basic bridging mode on Windows
and advanced bridging mode with FlexibleIPAM
when naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bridging mode
means connecting uplink to bridge + Pod flexible IPAM. Again, if you have a better name, please share.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/config/agent/config.go
Outdated
@@ -102,14 +102,21 @@ type AgentConfig struct { | |||
TrafficEncryptionMode string `yaml:"trafficEncryptionMode,omitempty"` | |||
// WireGuard related configurations. | |||
WireGuard WireGuardConfig `yaml:"wireGuard"` | |||
// Eanble bridging mode of Pod network on Nodes, in which the Node's transport interface is connected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Eanble bridging mode of Pod network on Nodes, in which the Node's transport interface is connected | |
// Enable bridging mode of Pod network on Nodes, in which the Node's transport interface is connected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought I pushed the fix, but seems not..
// to the OVS bridge, and cross-Node/VLAN traffic from AntreaIPAM Pods (Pods whose IP addresses are | ||
// allocated by AntreaIPAM from IPPools) is sent to the underlay network via the uplink, and | ||
// forwarded/routed by the underlay network. | ||
// This option requires the `AntreaIPAM` feature gate to be enabled. At this moment, it supports only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this part. EnableBridgingMode requires AntreaIPAM or AntreaIPAM requires EnableBridgingMode? I think technically EnableBridgingMode can just work without AntreaIPAM enabled, but just doesn't make any difference from function's perspective?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current situation is:
- AntreaIPAM is a feature gate for both AntreaIPAM and bridging mode (connecting uplink to bridge, flexible IPAM for Pods, and datapath changes for such Pods).
- EnableBridgingMode is a config option to enable bridging mode.
- We do not have a config option to enable IPAM (probably it is not needed in my mind as IPAM itself does add much overhead to controller or agent?).
ad439f9
to
0421429
Compare
# Enable flexible IPAM mode for Antrea. This mode allows to assign IP Ranges to Namespaces, | ||
# Deployments and StatefulSets via IP Pool annotation. | ||
# Enable AntreaIPAM. AntreaIPAM is required by the bridging mode and can assign IPs to Pods in | ||
# bridging mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we still mention what is purpose for this feature (to allocate IPs via pools?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Let me add that.
0421429
to
24b33bf
Compare
/test-all |
/test-all |
NPL e2e failed.
|
/test-e2e |
In the current implementation, enabling the AntreaIPAM feature gate will enable both AntreaIPAM which allocates IPs from IPPools, and Node side datapath configurations to support traffic forwarding of AntreaIPAM Pods whose IPs are allocated from IPPools by AntreaIPAM. This commit adds a separate config parameter - enableBridgingMode - to Antrea Agent, to enable/disable support for AntreaIPAM Pods on a Node. Only when enableBridgingMode is set to true, Antrea Agent connects the uplink interface to the OVS bridge, requests IP allocation from AntreaIPAM and implements traffic forwarding for AntreaIPAM (bridging mode) Pods. This change is also needed to extend AntreaIPAM for other IPAM use cases, in addition to IPAM for bridging mode Pods. Signed-off-by: Jianjun Shen <shenj@vmware.com>
24b33bf
to
fd8347b
Compare
Ah, my change introduced a bug when creating localPodInformer. Already fixed it. Thanks for reporting it! @gran-vmv |
/test-e2e |
/test-conformance |
/test-windows-all |
/test-hw-offload |
/test-multicluster-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/test-e2e |
@antoninbas @tnqn : are you good with the name "bridging mode"? |
yes, no issue on my side |
@tnqn @antoninbas are you good with the upgrade issue I mentioned at #3297 (comment) ? |
I will create a new PR to update IPAM documentation and describe the new config parameter. |
…de) (antrea-io#3297) In the current implementation, enabling the AntreaIPAM feature gate will enable both AntreaIPAM which allocates IPs from IPPools, and Node side datapath configurations to support traffic forwarding of AntreaIPAM Pods whose IPs are allocated from IPPools by AntreaIPAM. This commit adds a separate config parameter - enableBridgingMode - to Antrea Agent, to enable/disable support for AntreaIPAM Pods on a Node. Only when enableBridgingMode is set to true, Antrea Agent connects the uplink interface to the OVS bridge, requests IP allocation from AntreaIPAM and implements traffic forwarding for AntreaIPAM (bridging mode) Pods. This change is also needed to extend AntreaIPAM for other IPAM use cases, in addition to IPAM for bridging mode Pods. Signed-off-by: Jianjun Shen <shenj@vmware.com>
In the current implementation, enabling the AntreaIPAM feature gate will
enable both AntreaIPAM which allocates IPs from IPPools, and Node side
datapath configurations to support traffic forwarding of AntreaIPAM Pods
whose IPs are allocated from IPPools by AntreaIPAM.
This commit adds a separate config parameter - enableBridgingMode - to
antrea-agent, to enable/disable support for AntreaIPAM Pods on a Node.
Only when enableBridgingMode is set to true, Antrea Agent connects the
uplink interface to the OVS bridge, requests IP allocation from
AntreaIPAM and implements traffic forwarding for AntreaIPAM (bridging
mode) Pods. This change is also needed to extend AntreaIPAM for other
IPAM use cases, in addition to IPAM for bridging mode Pods.
Signed-off-by: Jianjun Shen shenj@vmware.com