Skip to content

Commit

Permalink
fix: Allow to deploy SR-IOV Device Plugin with SR-IOV Operator
Browse files Browse the repository at this point in the history
We need to allow to deploy two instances of device plugins to allow
run SR-IOV Network Operatro and use HostDeviceNetwork at the same time.

Signed-off-by: Ivan Kolodiazhnyi <[email protected]>
  • Loading branch information
e0ne committed Jan 2, 2025
1 parent 21bac8a commit 499f568
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sriovdp-config
name: network-operator-sriovdp-config-sriovdp-config
namespace: {{ .RuntimeSpec.Namespace }}
data:
config.json: '{{ .CrSpec.Config }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
namespace: {{ .RuntimeSpec.Namespace }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
namespace: {{ .RuntimeSpec.Namespace }}
rules:
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
namespace: {{ .RuntimeSpec.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
subjects:
- kind: ServiceAccount
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
{{end}}
10 changes: 5 additions & 5 deletions manifests/state-sriov-device-plugin/0030-sriov-dp-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
namespace: {{ .RuntimeSpec.Namespace }}
labels:
tier: node
app: sriovdp
spec:
selector:
matchLabels:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
template:
metadata:
labels:
name: sriov-device-plugin
name: network-operator-sriov-device-plugin
tier: node
app: sriovdp
spec:
Expand All @@ -47,7 +47,7 @@ spec:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
serviceAccountName: sriov-device-plugin
serviceAccountName: network-operator-sriov-device-plugin
{{- if .CrSpec.ImagePullSecrets }}
imagePullSecrets:
{{- range .CrSpec.ImagePullSecrets }}
Expand Down Expand Up @@ -122,7 +122,7 @@ spec:
type: DirectoryOrCreate
- name: config-volume
configMap:
name: sriovdp-config
name: network-operator-sriovdp-config
items:
- key: config.json
path: config.json
Expand Down
12 changes: 6 additions & 6 deletions pkg/state/state_sriov_dp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = Describe("SR-IOV Device Plugin State tests", func() {
By("Verify DaemonSet")
ds := &appsv1.DaemonSet{}
err = ts.client.Get(context.Background(), types.NamespacedName{Namespace: ts.namespace,
Name: "sriov-device-plugin"}, ds)
Name: "network-operator-sriov-device-plugin"}, ds)
Expect(err).NotTo(HaveOccurred())
assertCommonDaemonSetFields(ds, &cr.Spec.SriovDevicePlugin.ImageSpec, cr)
// expect privileged mode
Expand All @@ -70,7 +70,7 @@ var _ = Describe("SR-IOV Device Plugin State tests", func() {
By("Verify DaemonSet")
ds := &appsv1.DaemonSet{}
err = ts.client.Get(context.Background(), types.NamespacedName{Namespace: ts.namespace,
Name: "sriov-device-plugin"}, ds)
Name: "network-operator-sriov-device-plugin"}, ds)
Expect(err).NotTo(HaveOccurred())
assertCommonDaemonSetFields(ds, &cr.Spec.SriovDevicePlugin.ImageSpec, cr)
// expect privileged mode
Expand All @@ -90,7 +90,7 @@ var _ = Describe("SR-IOV Device Plugin State tests", func() {
By("Verify DaemonSet")
ds := &appsv1.DaemonSet{}
err = ts.client.Get(context.Background(), types.NamespacedName{Namespace: ts.namespace,
Name: "sriov-device-plugin"}, ds)
Name: "network-operator-sriov-device-plugin"}, ds)
Expect(err).NotTo(HaveOccurred())
assertCommonDaemonSetFields(ds, &cr.Spec.SriovDevicePlugin.ImageSpec, cr)
assertSriovDpPodTemplatesVolumeFields(&ds.Spec.Template, false)
Expand Down Expand Up @@ -121,7 +121,7 @@ var _ = Describe("SR-IOV Device Plugin State tests", func() {
By("Verify DaemonSet")
ds := &appsv1.DaemonSet{}
err = ts.client.Get(context.Background(), types.NamespacedName{Namespace: ts.namespace,
Name: "sriov-device-plugin"}, ds)
Name: "network-operator-sriov-device-plugin"}, ds)
Expect(err).NotTo(HaveOccurred())
assertCommonDaemonSetFields(ds, &cr.Spec.SriovDevicePlugin.ImageSpec, cr)
assertSriovDpPodTemplatesVolumeFields(&ds.Spec.Template, false)
Expand All @@ -134,7 +134,7 @@ var _ = Describe("SR-IOV Device Plugin State tests", func() {
By("Verify DaemonSet is deleted")
ds = &appsv1.DaemonSet{}
err = ts.client.Get(context.Background(), types.NamespacedName{Namespace: ts.namespace,
Name: "sriov-device-plugin"}, ds)
Name: "network-operator-sriov-device-plugin"}, ds)
Expect(errors.IsNotFound(err)).To(BeTrue())
})
})
Expand Down Expand Up @@ -196,7 +196,7 @@ func assertSriovDpPodTemplatesVolumeFields(tpl *v1.PodTemplateSpec, useCdi bool)
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: v1.LocalObjectReference{
Name: "sriovdp-config",
Name: "network-operator-sriovdp-config",
},
Items: []v1.KeyToPath{
{
Expand Down

0 comments on commit 499f568

Please sign in to comment.