Skip to content

Commit 36223e4

Browse files
authored
Merge pull request #303 from mregmi/main
DSA: add L2 tests and test README for DSA
2 parents 1f579c3 + 6c49d3a commit 36223e4

File tree

5 files changed

+246
-0
lines changed

5 files changed

+246
-0
lines changed

security/dsa_rbac.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
---
4+
apiVersion: v1
5+
kind: ServiceAccount
6+
metadata:
7+
name: intel-dsa
8+
namespace: intel-dsa
9+
---
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: Role
12+
metadata:
13+
name: intel-dsa
14+
namespace: intel-dsa
15+
rules:
16+
- apiGroups:
17+
- security.openshift.io
18+
resources:
19+
- securitycontextconstraints
20+
resourceNames:
21+
- intel-dsa-scc
22+
verbs:
23+
- use
24+
---
25+
apiVersion: rbac.authorization.k8s.io/v1
26+
kind: RoleBinding
27+
metadata:
28+
name: intel-dsa
29+
roleRef:
30+
apiGroup: rbac.authorization.k8s.io
31+
kind: Role
32+
name: intel-dsa
33+
subjects:
34+
- kind: ServiceAccount
35+
name: intel-dsa
36+
namespace: intel-dsa

security/dsa_scc.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: security.openshift.io/v1
5+
allowHostDirVolumePlugin: false
6+
allowHostIPC: false
7+
allowHostNetwork: false
8+
allowHostPID: false
9+
allowHostPorts: false
10+
allowPrivilegeEscalation: false
11+
allowPrivilegedContainer: false
12+
allowedCapabilities:
13+
- SYS_RAWIO
14+
defaultAddCapabilities: null
15+
fsGroup:
16+
type: MustRunAs
17+
groups: []
18+
kind: SecurityContextConstraints
19+
metadata:
20+
annotations:
21+
kubernetes.io/description: 'SCC for Intel DSA based workload'
22+
name: intel-dsa-scc
23+
priority: null
24+
readOnlyRootFilesystem: false
25+
requiredDropCapabilities:
26+
- ALL
27+
runAsUser:
28+
type: RunAsAny
29+
seLinuxContext:
30+
type: MustRunAs
31+
supplementalGroups:
32+
type: RunAsAny
33+
seccompProfiles:
34+
- runtime/default
35+
volumes:
36+
- configMap
37+
- downwardAPI
38+
- emptyDir
39+
- ephemeral
40+
- persistentVolumeClaim
41+
- projected
42+
- secret

tests/l2/dsa/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
### Verify Intel® Data Streaming Accelerator (DSA) Technology provisioning
2+
This workload runs [accel-config](https://github.com/intel/idxd-config) sample tests using RedHat built and distributed accel-config RPM packages from the rhel-9-for-x86_64-baseos-rpms repo. Refer to the [accel config readme](https://github.com/intel/idxd-config/blob/stable/README.md) for more details.
3+
4+
* Build the workload container image
5+
6+
Please replace the credentials in buildconfig yaml with your RedHat account login credentials.
7+
8+
```
9+
$ oc apply -f https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/tests/l2/dsa/dsa_build.yaml
10+
```
11+
12+
* Create SCC intel-dsa-scc for Intel DSA based workload, if this SCC is not created
13+
14+
```
15+
$ oc apply -f https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/security/dsa_scc.yaml
16+
```
17+
18+
* Create the intel-dsa service account to use intel-dsa-scc
19+
20+
```
21+
$ oc apply -f https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/security/dsa_rbac.yaml
22+
```
23+
24+
* Deploy the accel-config workload job with intel-dsa service account
25+
26+
```
27+
$ oc apply -f https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/tests/l2/dsa/dsa_job.yaml
28+
```
29+
30+
* Check the results.
31+
```
32+
$ oc get pods
33+
intel-dsa-workload-244xm 0/1 Completed 0 3m12s
34+
```
35+
36+
* sample test logs
37+
```
38+
$ oc logs intel-dsa-workload-244xm
39+
dsa0/wq0.1
40+
dsa0
41+
Testing with 'block on fault' flag ON
42+
Performing dedicated WQ NOOP testing
43+
Testing 1 bytes
44+
[ info] alloc wq 1 dedicated size 16 addr 0x7f0cde00b000 batch sz 0x400 xfer sz 0x80000000
45+
[ info] testnoop: tflags 0x1 num_desc 1
46+
[ info] preparing descriptor for noop
47+
[ info] Submitted all noop jobs
48+
[ info] verifying task result for 0x2041620
49+
[ info] test with op 0 passed
50+
Testing 4096 bytes
51+
[ info] alloc wq 1 dedicated size 16 addr 0x7fd4881da000 batch sz 0x400 xfer sz 0x80000000
52+
[ info] testnoop: tflags 0x1 num_desc 1
53+
[ info] preparing descriptor for noop
54+
[ info] Submitted all noop jobs
55+
[ info] verifying task result for 0x82f620
56+
[ info] test with op 0 passed
57+
Testing 65536 bytes
58+
[ info] alloc wq 1 dedicated size 16 addr 0x7f462bbed000 batch sz 0x400 xfer sz 0x80000000
59+
[ info] testnoop: tflags 0x1 num_desc 1
60+
[ info] preparing descriptor for noop
61+
[ info] Submitted all noop jobs
62+
[ info] verifying task result for 0xe4e620
63+
[ info] test with op 0 passed
64+
Testing 1048576 bytes
65+
[ info] alloc wq 1 dedicated size 16 addr 0x7fac2ac0c000 batch sz 0x400 xfer sz 0x80000000
66+
[ info] testnoop: tflags 0x1 num_desc 1
67+
[ info] preparing descriptor for noop
68+
[ info] Submitted all noop jobs
69+
[ info] verifying task result for 0xf21620
70+
[ info] test with op 0 passed
71+
Testing 2097152 bytes
72+
[ info] alloc wq 1 dedicated size 16 addr 0x7f7426a5c000 batch sz 0x400 xfer sz 0x80000000
73+
[ info] testnoop: tflags 0x1 num_desc 1
74+
[ info] preparing descriptor for noop
75+
[ info] Submitted all noop jobs
76+
[ info] verifying task result for 0xeec620
77+
[ info] test with op 0 passed
78+
Performing shared WQ NOOP testing
79+
```

tests/l2/dsa/dsa_build.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: image.openshift.io/v1
5+
kind: ImageStream
6+
metadata:
7+
name: intel-dsa-workload
8+
namespace: intel-dsa
9+
spec: {}
10+
---
11+
apiVersion: build.openshift.io/v1
12+
kind: BuildConfig
13+
metadata:
14+
name: intel-dsa-workload
15+
namespace: intel-dsa
16+
spec:
17+
triggers:
18+
- type: "ConfigChange"
19+
- type: "ImageChange"
20+
runPolicy: "Serial"
21+
source:
22+
type: Dockerfile
23+
dockerfile: |
24+
25+
ARG BUILDER=registry.access.redhat.com/ubi9:latest
26+
FROM ${BUILDER}
27+
RUN subscription-manager register --username=${USERNAME} --password=${PASSWORD} && \
28+
subscription-manager attach --auto && \
29+
dnf repolist --disablerepo=* && \
30+
subscription-manager repos --enable rhel-9-for-x86_64-baseos-rpms --enable codeready-builder-for-rhel-9-x86_64-rpms && \
31+
dnf -y update && \
32+
dnf install -y gcc g++ make cmake autoconf automake libtool pkg-config \
33+
git asciidoc xmlto libuuid-devel json-c-devel zlib-devel openssl-devel \
34+
pciutils accel-config
35+
RUN git clone -b accel-config-v4.1.8 https://github.com/intel/idxd-config && \
36+
cd idxd-config && ./autogen.sh && ./configure CFLAGS='-g -O2' --prefix=/usr \
37+
--sysconfdir=/etc --libdir=/usr/lib64 --enable-test=yes && make && make install
38+
strategy:
39+
type: Docker
40+
noCache: true
41+
dockerStrategy:
42+
buildArgs:
43+
- name: "BUILDER"
44+
value: "registry.access.redhat.com/ubi9:latest"
45+
env:
46+
- name: "USERNAME"
47+
valueFrom:
48+
secretKeyRef:
49+
key: username
50+
name: rh-auth
51+
- name: "PASSWORD"
52+
valueFrom:
53+
secretKeyRef:
54+
key: password
55+
name: rh-auth
56+
57+
output:
58+
to:
59+
kind: ImageStreamTag
60+
name: intel-dsa-workload:latest

tests/l2/dsa/dsa_job.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: batch/v1
5+
kind: Job
6+
metadata:
7+
name: intel-dsa-workload
8+
namespace: intel-dsa
9+
spec:
10+
template:
11+
spec:
12+
restartPolicy: Never
13+
containers:
14+
- name: intel-dsa-job
15+
image: image-registry.openshift-image-registry.svc:5000/intel-dsa/intel-dsa-workload:latest
16+
imagePullPolicy: IfNotPresent
17+
workingDir: "/usr/libexec/accel-config/test/"
18+
command:
19+
- "./dsa_user_test_runner.sh"
20+
args:
21+
- "--skip-config"
22+
capabilities:
23+
add:
24+
[SYS_RAWIO]
25+
resources:
26+
limits:
27+
dsa.intel.com/wq-user-dedicated: 1
28+
restartPolicy: Never
29+
serviceAccountName: intel-dsa

0 commit comments

Comments
 (0)