Skip to content

Commit c3259ee

Browse files
committed
Add SELinux Labels for DSA and IAA
Proper SELinux labels are required for the plugins to run in SELinux enabled clusters like openshift. These labels are custom made for plugins and are part of container-selinux package. Signed-off-by: Manish Regmi <manish.regmi@intel.com>
1 parent 89986b9 commit c3259ee

File tree

8 files changed

+20
-0
lines changed

8 files changed

+20
-0
lines changed

deployments/dsa_plugin/base/intel-dsa-plugin.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ spec:
2424
image: intel/intel-dsa-plugin:devel
2525
imagePullPolicy: IfNotPresent
2626
securityContext:
27+
seLinuxOptions:
28+
type: "container_device_plugin_t"
2729
readOnlyRootFilesystem: true
2830
allowPrivilegeEscalation: false
2931
volumeMounts:

deployments/dsa_plugin/overlays/dsa_initcontainer/dsa_initcontainer.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ spec:
1414
fieldPath: spec.nodeName
1515
image: intel/intel-idxd-config-initcontainer:devel
1616
securityContext:
17+
seLinuxOptions:
18+
type: "container_device_plugin_init_t"
1719
readOnlyRootFilesystem: true
1820
privileged: true
1921
volumeMounts:

deployments/iaa_plugin/base/intel-iaa-plugin.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ spec:
2424
image: intel/intel-iaa-plugin:devel
2525
imagePullPolicy: IfNotPresent
2626
securityContext:
27+
seLinuxOptions:
28+
type: "container_device_plugin_t"
2729
readOnlyRootFilesystem: true
2830
allowPrivilegeEscalation: false
2931
volumeMounts:

deployments/iaa_plugin/overlays/iaa_initcontainer/iaa_initcontainer.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ spec:
1616
value: "iaa"
1717
image: intel/intel-idxd-config-initcontainer:devel
1818
securityContext:
19+
seLinuxOptions:
20+
type: "container_device_plugin_init_t"
1921
readOnlyRootFilesystem: true
2022
privileged: true
2123
volumeMounts:

pkg/controllers/dsa/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.DsaDevicePlugin) {
130130
},
131131
},
132132
SecurityContext: &v1.SecurityContext{
133+
SELinuxOptions: &v1.SELinuxOptions{
134+
Type: "container_device_plugin_init_t",
135+
},
133136
ReadOnlyRootFilesystem: &yes,
134137
Privileged: &yes,
135138
},

pkg/controllers/dsa/controller_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
7979
Image: devicePlugin.Spec.Image,
8080
ImagePullPolicy: "IfNotPresent",
8181
SecurityContext: &v1.SecurityContext{
82+
SELinuxOptions: &v1.SELinuxOptions{
83+
Type: "container_device_plugin_t",
84+
},
8285
ReadOnlyRootFilesystem: &yes,
8386
AllowPrivilegeEscalation: &no,
8487
},

pkg/controllers/iaa/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin) {
129129
},
130130
},
131131
SecurityContext: &v1.SecurityContext{
132+
SELinuxOptions: &v1.SELinuxOptions{
133+
Type: "container_device_plugin_init_t",
134+
},
132135
ReadOnlyRootFilesystem: &yes,
133136
Privileged: &yes,
134137
},

pkg/controllers/iaa/controller_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
7979
Image: devicePlugin.Spec.Image,
8080
ImagePullPolicy: "IfNotPresent",
8181
SecurityContext: &v1.SecurityContext{
82+
SELinuxOptions: &v1.SELinuxOptions{
83+
Type: "container_device_plugin_t",
84+
},
8285
ReadOnlyRootFilesystem: &yes,
8386
AllowPrivilegeEscalation: &no,
8487
},

0 commit comments

Comments
 (0)