-
Notifications
You must be signed in to change notification settings - Fork 373
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
Support OVS bridge creation for secondary network #5279
Conversation
df05751
to
4fd4c8b
Compare
48a365d
to
0876de0
Compare
3b202b7
to
3033f4d
Compare
cmd/antrea-agent/options.go
Outdated
@@ -597,7 +597,7 @@ func (o *Options) validateK8sNodeOptions() error { | |||
o.dnsServerOverride = hostPort | |||
} | |||
|
|||
return nil | |||
return o.validateSecondaryNetworkConfig() |
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 should follow the same convention as above, and wrap the error:
if err := o.validateAntreaProxyConfig(encapMode); err != nil {
return fmt.Errorf("proxy config is invalid: %w", err)
}
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 err := o.validateEgressConfig(encapMode); err != nil {
return fmt.Errorf("failed to validate egress config: %v", err)
}
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.
Done
defer mockNewOVSBridge(mockOVSBridgeClient)() | ||
defer mockInterfaceByName()() |
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.
You can use the new t.Cleanup
functionality here, to simplify calling the functions and ensure that cleanup always happens correctly. For example:
func mockInterfaceByName(t *testing.T) func() {
prevFunc := interfaceByNameFn
interfaceByNameFn = func(name string) (*net.Interface, error) {
if name == nonExistingInterface {
return nil, errors.New("interface not found")
}
return nil, nil
}
t.Cleanup(func() { interfaceByNameFn = prevFunc })
}
// in caller
mockInterfaceByName(t)
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.
Done
Add OVS bridge configuration to the secondary network configuration in antrea-agent.conf, which specifies the OVS bridges for Pod secondary networks and also physical interfaces of the bridges. At the moment, only a single bridge is supported and at most one physical interface can be configured on the bridge. antrea-agent will automatically create the OVS bridge and connects the physical interface (if specified) to the bridge, when the bridge is specified in the secondary network configuration and does not exist on the host. Signed-off-by: Jianjun Shen <shenj@vmware.com>
Rebased on top of #5341. |
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
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-all |
/test-conformance |
Add OVS bridge configuration to the secondary network configuration in antrea-agent.conf, which specifies the OVS bridges for Pod secondary networks and also physical interfaces of the bridges. At the moment, only a single bridge is supported and at most one physical interface can be configured on the bridge. antrea-agent will automatically create the OVS bridge and connects the physical interface (if specified) to the bridge, when the bridge is specified in the secondary network configuration and does not exist on the host.
Issue: #5278