Skip to content

Commit b2c575e

Browse files
committed
OpenShiftP-281: add test-case example with two pods access to nx-gzip
Signed-off-by: Paul Bastide <[email protected]>
1 parent b7ec94f commit b2c575e

File tree

7 files changed

+148
-0
lines changed

7 files changed

+148
-0
lines changed

example/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
1. Create namespace `oc new-project ex-dra-driver`
4+
2. Install Scenario - `kustomize build examples/<scenario> | oc apply -f -`
5+
3. Uninstall Scenario - `kustomize build examples/<scenario> | oc delete -f -`
6+
7+
8+
The scenarios are:
9+
1. `two-pods-two-distinct-nx-gzip` - Two pods, one container each, Each container asking for access to the nx-gzip
10+
11+
These examples are inspired by https://github.com/kubernetes-sigs/dra-example-driver/tree/main/demo
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: ex-sa
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
name: ex-sa-rbac
5+
namespace: ex-dra-driver
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: system:openshift:scc:restricted
10+
subjects:
11+
- kind: ServiceAccount
12+
name: ex-sa
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: resource.k8s.io/v1beta1
2+
kind: ResourceClaimTemplate
3+
metadata:
4+
namespace: gpu-test1
5+
name: nx-gzip
6+
spec:
7+
spec:
8+
devices:
9+
requests:
10+
- name: nx-gzip
11+
deviceClassName: nx.device.power.ibm.com
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ex-power-dra
5+
labels:
6+
app: ex-power-dra
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: ex-power-dra
11+
template:
12+
metadata:
13+
labels:
14+
app: ex-power-dra
15+
spec:
16+
containers:
17+
- name: driver
18+
image: quay.io/powercloud/power-dra-driver:latest
19+
imagePullPolicy: IfNotPresent
20+
command: [ "/bin/sleep" ]
21+
args: [ "infinity" ]
22+
resources:
23+
limits:
24+
memory: 100Mi
25+
requests:
26+
cpu: 100m
27+
memory: 100Mi
28+
claims:
29+
- name: nx-gzip
30+
serviceAccount: ex-sa
31+
serviceAccountName: ex-sa
32+
securityContext:
33+
privileged: false
34+
runAsUser: 1000
35+
capabilities:
36+
drop:
37+
- ALL
38+
runAsNonRoot: true
39+
readOnlyRootFilesystem: true
40+
allowPrivilegeEscalation: false
41+
resourceClaims:
42+
- name: nx-gzip
43+
resourceClaimTemplateName: nx-gzip
44+
serviceAccount: ex-sa
45+
serviceAccountName: ex-sa
46+
updateStrategy:
47+
type: RollingUpdate
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ex-power-dra
5+
labels:
6+
app: ex-power-dra
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: ex-power-dra
11+
template:
12+
metadata:
13+
labels:
14+
app: ex-power-dra
15+
spec:
16+
containers:
17+
- name: driver
18+
image: quay.io/powercloud/power-dra-driver:latest
19+
imagePullPolicy: IfNotPresent
20+
command: [ "/bin/sleep" ]
21+
args: [ "infinity" ]
22+
resources:
23+
limits:
24+
memory: 100Mi
25+
requests:
26+
cpu: 100m
27+
memory: 100Mi
28+
claims:
29+
- name: nx-gzip
30+
serviceAccount: ex-sa
31+
serviceAccountName: ex-sa
32+
securityContext:
33+
privileged: false
34+
runAsUser: 1000
35+
capabilities:
36+
drop:
37+
- ALL
38+
runAsNonRoot: true
39+
readOnlyRootFilesystem: true
40+
allowPrivilegeEscalation: false
41+
resourceClaims:
42+
- name: nx-gzip
43+
resourceClaimTemplateName: nx-gzip
44+
serviceAccount: ex-sa
45+
serviceAccountName: ex-sa
46+
updateStrategy:
47+
type: RollingUpdate
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
metadata:
4+
name: ex-power-dra
5+
6+
namespace: ex-power-dra
7+
8+
generatorOptions:
9+
disableNameSuffixHash: true
10+
11+
resources:
12+
- 01-sa.yaml
13+
- 02-rbac.yaml
14+
- 03-resource-claim-template.yaml
15+
- 04-deployment-first.yaml
16+
- 05-deployment-second.yaml

0 commit comments

Comments
 (0)