Skip to content

Commit 9a78e44

Browse files
authored
Merge pull request #970 from mregmi/upstream_ready
changes related to selinux and permissions for openshift
2 parents 23eacb3 + 78d2fe2 commit 9a78e44

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

deployments/operator/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,11 @@ rules:
245245
- get
246246
- list
247247
- watch
248+
- apiGroups:
249+
- security.openshift.io
250+
resources:
251+
- securitycontextconstraints
252+
resourceNames:
253+
- privileged
254+
verbs:
255+
- use

deployments/sgx_plugin/base/intel-sgx-plugin.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ spec:
1717
- name: intel-sgx-plugin
1818
image: intel/intel-sgx-plugin:devel
1919
securityContext:
20+
seLinuxOptions:
21+
type: "container_device_plugin_t"
2022
readOnlyRootFilesystem: true
2123
allowPrivilegeEscalation: false
2224
imagePullPolicy: IfNotPresent

pkg/controllers/sgx/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ func setInitContainer(spec *v1.PodSpec, imageName string) {
106106
ImagePullPolicy: "IfNotPresent",
107107
Name: "intel-sgx-initcontainer",
108108
SecurityContext: &v1.SecurityContext{
109+
SELinuxOptions: &v1.SELinuxOptions{
110+
Type: "container_device_plugin_init_t",
111+
},
109112
ReadOnlyRootFilesystem: &yes,
110113
},
111114
VolumeMounts: []v1.VolumeMount{

pkg/controllers/sgx/controller_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
7171
Image: devicePlugin.Spec.Image,
7272
ImagePullPolicy: "IfNotPresent",
7373
SecurityContext: &v1.SecurityContext{
74+
SELinuxOptions: &v1.SELinuxOptions{
75+
Type: "container_device_plugin_t",
76+
},
7477
ReadOnlyRootFilesystem: &yes,
7578
AllowPrivilegeEscalation: &no,
7679
},

0 commit comments

Comments
 (0)