-
Notifications
You must be signed in to change notification settings - Fork 49
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 HostDeviceNetwork basic support #126
Conversation
03bbd3b
to
ff532e6
Compare
b855226
to
4ddc2d2
Compare
can you add in the commit msg that you are fix #44 |
7f14ced
to
255a38a
Compare
Removed WIP to get more reviews. It's still required to remove duplicated code and add unit-tests |
manifests/stage-sriov-device-plugin/0020-sriov-dp-daemonset.yml
Outdated
Show resolved
Hide resolved
nodeSelector: | ||
beta.kubernetes.io/arch: amd64 | ||
tolerations: | ||
- key: node-role.kubernetes.io/master |
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 rdma shared DP we got the following tolerations:
tolerations:
# Allow this pod to be rescheduled while the node is in "critical add-ons only" mode.
# This, along with the annotation above marks this pod as a critical add-on.
- key: CriticalAddonsOnly
operator: Exists
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
these should be aligned.
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.
also i think we want:
nodeSelector:
feature.node.kubernetes.io/pci-15b3.present: "true"
as well.
) | ||
|
||
const ( | ||
stateHostDeviceNetworkName = "state-HostDevice-Network" |
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 realize we are not consistent here throughout the states perhaps we should settle on state-word-another-word
later on aligning the rest WDYT?
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.
+1. Let's keep consistency in the code
pkg/state/state_shared_dp.go
Outdated
// Either this state was not required to run or an update occurred and we need to remove | ||
// the resources that where created. | ||
// TODO: Support the latter case | ||
// TODO: Support default configuration should be applied |
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.
what are the default configurations ?
the original intention was that if this is nil then this state should be "undone" i.e removal of all yaml in this state's manifest folder
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 review all. I will continue later
} | ||
|
||
// +kubebuilder:object:root=true | ||
// kubebuilder:object:generate |
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.
what is kubebuilder:object:generate
why you don't +kubebuilder:object:generate= it ?
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.
It works using both patterns but I agree that it's good to use only on across the project
} | ||
|
||
// +kubebuilder:object:root=true | ||
// kubebuilder:object:generate |
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.
same as above
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec *HostDeviceNetworkSpec `json:"spec,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.
why the Spec is with *?
I don't see it like this in https://github.com/k8snetworkplumbingwg/sriov-network-operator/blob/master/api/v1/sriovibnetwork_types.go#L49
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
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: MacvlanNetwork is the Schema for the macvlannetworks API |
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.
s/HostDevice/MacvlanNetwork
s/macvlannetwork/hostdevicenetworks
Note for reviewers: Most of the comments are addressed and squashed into one commit. HostDeviceNetwork scope and unit-tests will be added as a separate commits in this PR |
ae437e0
to
09f598a
Compare
deployment/network-operator/templates/mellanox.com_v1alpha1_nicclusterpolicy_cr.yaml
Show resolved
Hide resolved
pkg/state/factory.go
Outdated
return nil, errors.Wrapf(err, "failed to create Shared Device plugin State") | ||
} | ||
sriovDpState, err := NewStateSriovDp( | ||
k8sAPIClient, scheme, filepath.Join(manifestBaseDir, "stage-sriov-device-plugin")) | ||
if err != nil { | ||
return nil, errors.Wrapf(err, "failed to create Device plugin 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.
s/Device plugin/SR-IOV Device plugin/
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
/retest-nic_operator |
type HostDeviceNetworkSpec struct { | ||
// Namespace of the NetworkAttachmentDefinition custom resource | ||
NetworkNamespace string `json:"networkNamespace,omitempty"` | ||
// Endpoint resource name for SR-IOV resource pool |
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 reword to host device resource pool
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 borrowed it from the SR-IOV network device plugin documentation, but this name it good too
description: Namespace of the NetworkAttachmentDefinition custom resource | ||
type: string | ||
resourceName: | ||
description: Endpoint resource name for SR-IOV resource pool |
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.
/SR-IOV/host device
Also please add Closes #44 to commit msg |
It's already added. I'll add it to the PR description too |
f2a4e1a
to
a2322a2
Compare
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.
@adrianchiris can you please take a look
884366c
to
5c73a4e
Compare
@@ -0,0 +1,86 @@ | |||
/* | |||
Copyright 2020 NVIDIA |
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.
s/2020/2021
pkg/state/state_sriov_dp_test.go
Outdated
@@ -0,0 +1,110 @@ | |||
/* | |||
Copyright 2020 NVIDIA |
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.
s/2020/2021
scripts/update-gh-pages.sh
Outdated
@@ -0,0 +1,209 @@ | |||
#!/bin/bash -e |
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 doesn't seem to be releated to PR also I see network-operator.0.3.1.tgz binary which should be removed
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. It was accidently added to the PR
This patch adds HostDeviceNetwork CRD support and basic transformation to NetworkAttachmentDefinition to allow Multus create secondary network. SR-IOV Network Device Plugin is deployed using Network Operator Helm chart with default configuration. This patch also optimize NetworkAttachmentDef link generation both for MacvlanNetwork and HostDeviceNetwork CRs. We should add link for NetworkAttachmentDef only if MacvlanNetwork or HostDeviceNetwork CR is in a 'Ready' state. It allows us to make less Kubernetes API calls. NOTE: temporary added "//nolint:dupl" before code will be refactored. Closes: Mellanox#44 Signed-off-by: Ivan Kolodiazhnyi <ikolodiazhny@nvidia.com>
This patch adds HostDeviceNetwork CRD support and basic
transformation to NetworkAttachmentDefinition to allow
Multus create secondary network.
SR-IOV Network Device Plugin is deployed using Network Operator
Helm chart with default configuration.
NOTE: temporary added "//nolint:dupl" before code will be
refactored.
Closes: #44