Skip to content

Commit 7029aec

Browse files
committed
qat: Document AppArmor anntotation configurability in operatop deployments
Signed-off-by: Oleg Zhurakivskyy <[email protected]>
1 parent f9bc72f commit 7029aec

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

cmd/qat_plugin/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ When using the operator for deploying the plugin with provisioning config, use `
148148

149149
There's also a possibility for a node specific congfiguration through passing a nodename via `NODE_NAME` into initcontainer's environment and passing a node specific profile (`qat-$NODE_NAME.conf`) via ConfigMap volume mount.
150150

151+
CR annotations in [deviceplugin_v1_qatdeviceplugin.yaml](../../deployments/operator/samples/deviceplugin_v1_qatdeviceplugin.yaml) propagate to the DaemonSet annotations. By default, the operator based deployment sets AppArmor policy to `"unconfined"` but this can be overridden by setting the AppArmor annotation to a new value in the CR annotations.
152+
153+
For non-operator plugin deployments such annotations can be dropped with the kustomization if required.
151154

152155
### Verify Plugin Registration
153156

deployments/operator/samples/deviceplugin_v1_qatdeviceplugin.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ apiVersion: deviceplugin.intel.com/v1
22
kind: QatDevicePlugin
33
metadata:
44
name: qatdeviceplugin-sample
5-
# example apparmor annotation
6-
# see more details here:
5+
annotations:
6+
container.apparmor.security.beta.kubernetes.io/intel-qat-plugin: unconfined
7+
# see more details on AppArmor here:
78
# - https://kubernetes.io/docs/tutorials/clusters/apparmor/#securing-a-pod
89
# - https://github.com/intel/intel-device-plugins-for-kubernetes/issues/381
9-
# annotations:
10-
# container.apparmor.security.beta.kubernetes.io/intel-qat-plugin: unconfined
1110
spec:
1211
image: intel/intel-qat-plugin:0.28.0
1312
initImage: intel/intel-qat-initcontainer:0.28.0

deployments/qat_plugin/base/intel-qat-plugin.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ metadata:
44
name: intel-qat-plugin
55
labels:
66
app: intel-qat-plugin
7+
annotations:
8+
container.apparmor.security.beta.kubernetes.io/intel-qat-plugin: unconfined
79
spec:
810
selector:
911
matchLabels:
@@ -12,6 +14,8 @@ spec:
1214
metadata:
1315
labels:
1416
app: intel-qat-plugin
17+
annotations:
18+
container.apparmor.security.beta.kubernetes.io/intel-qat-plugin: unconfined
1519
spec:
1620
automountServiceAccountToken: false
1721
containers:

pkg/controllers/qat/controller_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,16 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
164164
func TestNewDaemonSetQAT(t *testing.T) {
165165
c := &controller{}
166166

167-
plugin := &devicepluginv1.QatDevicePlugin{}
167+
plugin := &devicepluginv1.QatDevicePlugin{
168+
ObjectMeta: metav1.ObjectMeta{
169+
Annotations: map[string]string{
170+
"container.apparmor.security.beta.kubernetes.io/intel-qat-plugin": "unconfined",
171+
},
172+
},
173+
}
168174
plugin.Name = "testing"
169175
plugin.Spec.InitImage = "intel/intel-qat-initcontainer:" + controllers.ImageMinVersion.String()
176+
170177
expected := c.newDaemonSetExpected(plugin)
171178
actual := c.NewDaemonSet(plugin)
172179

0 commit comments

Comments
 (0)