-
Notifications
You must be signed in to change notification settings - Fork 114
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
OVS HWOL: support multiple MCPs #125
OVS HWOL: support multiple MCPs #125
Conversation
This PR replaces #106 |
f5c463c
to
224afd3
Compare
It's better to put the operator-sdk upgrade changes in separate PR. |
New PR for operator-sdk project update: #129 |
224afd3
to
dc87455
Compare
dc87455
to
2ce71df
Compare
|
func (r *SriovNetworkNodeConfigReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { | ||
_ = context.Background() | ||
// // Fetch SriovNetworkNodeConfigList | ||
configList := &sriovnetworkv1.SriovNetworkNodeConfigList{} |
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.
If we have a one-to-one mapping, we don't need to fetch all the SriovNetworkNodeConfigList CRs here.
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
// OVS HWOL configurations are generated automatically by Operator | ||
// Labels in NodeSelector are ANDed when selecting Kubernetes Nodes | ||
// On OpenShift: | ||
// NodeSelector matches on Labels defined in MachineConfigPoolSpec.NodeSelector |
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.
Shall we just omit this flag for openshift? It would be more clear if we have a one-to-one mapping between the SriovNetworkNodeConfig CR and MCP CR.
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 removed the NodeSelector
field, and focus this PR on openshift support.
NodeSelector can be added later for k8s implementation.
} | ||
} | ||
|
||
update, err := utils.WriteSwitchdevConfFile(state) |
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 think we shall only invoke WriteSwitchdevConfFile
when the swichdev is enabled on one PF. So maybe add IsSwitchdevModeSpec
check here.
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
err = r.Get(context.TODO(), types.NamespacedName{Name: mcName}, foundMC) | ||
if err != nil { | ||
if !errors.IsNotFound(err) { | ||
err = r.Delete(context.TODO(), foundMC) |
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 shall be invoked when the MC CR is found without error. It shall be moved to line 177.
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.
Fixed
// NodeSelector matches on Labels defined in MachineConfigPoolSpec.NodeSelector | ||
// OVS HWOL MachineConfigs are generated and applied to Nodes in MachineConfigPool | ||
// Labels in NodeSelector are ANDed when matching on MachineConfigPoolSpec.NodeSelector | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` |
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.
Shall we also add the logic to check the NodeSelector
in the k8s_plugin for the Kubernetes scenario?
2ce71df
to
b4f2945
Compare
/hold |
bb82c48
to
4bd9cc9
Compare
/unhold |
4bd9cc9
to
24116da
Compare
mcpMap := make(map[string]bool) | ||
|
||
mcpList := &mcfgv1.MachineConfigPoolList{} | ||
err := r.List(context.TODO(), mcpList, &client.ListOptions{}) |
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.
Why we fetch the whole list of MCPs, instead of getting the MCP by Spec.OvsHardwareOffloadConfig.Name
? We have a one-to-one mapping between SriovNetworkPoolConfig, MCP CR here, don't we?
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, changed to get MCP according to Spec.OvsHardwareOffloadConfig.Name.
24116da
to
d4786b7
Compare
foundMC := &mcfgv1.MachineConfig{} | ||
mcp := &mcfgv1.MachineConfigPool{} | ||
|
||
if mcpName == "" { |
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.
Shall we move the MCP name validation to the operator webhook?
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.
Will add the webhook check in a separate PR.
return nil | ||
} | ||
|
||
err := r.Get(context.TODO(), types.NamespacedName{Name: mcpName}, mcp) |
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 variable mcp
is not used after getting? Is that only for checking the existence of the MCP?
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.
Yes, only for checking the existence of MCP.
d4786b7
to
add7d5b
Compare
One node can only be added in one custom MCP pool by design of MCO. Since current ovs-hw-offload MCs are applied to hardcoded MCP ovs-hw-offload-worker, other existing custome MCPs cannot be enabled with ovs hw offload configuration. This commits allows ovs-hw-offload MCs be applied to multiple MCPs as specified in default SriovNetworkNodeConfig.
add7d5b
to
463afa9
Compare
Rebased on master |
/lgtm |
Introduced a new CRD SriovNetworkPoolConfig for pool (not device)
related configurations such as OVS HWOL. This may be extended
to support future features that require pool specific configuration.
For example, SmartNIC offload, Accelerated bridge offload etc.
Removed MCO plugins and moved the writing of switchdev device config
file into generic plugin (shared by OpenShift and Kubernetes deployment).
Removed the writing of switchdev device config file from K8s plugin.
For configuring OVS HWOL on OpenShift, the steps are changed to:
For configuring OVS HWOL on Kubernetes, the steps are not changed.