Skip to content

Commit c8d5e73

Browse files
authored
Added demon-set to kustomization and readme update (#30)
* Example readme and yamls corrections Signed-off-by: Punith Kenchappa <[email protected]> * fix not found of power-dra-kubeletplugin and cdi file Signed-off-by: Punith Kenchappa <[email protected]> * Added path and exec permission to container file and readme modification for uninstall Signed-off-by: Punith Kenchappa <[email protected]> * Copy power-dra-kubeletplugin to bin in container file and readme modification Signed-off-by: Punith Kenchappa <[email protected]> * changed from ex-power-dra to power-dra-driver to match namespace Signed-off-by: Punith Kenchappa <[email protected]> * fixed issues and added resource slice Signed-off-by: Punith Kenchappa <[email protected]> * fixed issues and readme Signed-off-by: Punith Kenchappa <[email protected]> * changed from ex-power-dra to power-dra-driver to match namespace Signed-off-by: Punith Kenchappa <[email protected]> * fixed issues for nx device classes Signed-off-by: Punith Kenchappa <[email protected]> * added demon-set to kustomization and readme update Signed-off-by: Punith Kenchappa <[email protected]> --------- Signed-off-by: Punith Kenchappa <[email protected]>
1 parent ec5543b commit c8d5e73

File tree

6 files changed

+54
-15
lines changed

6 files changed

+54
-15
lines changed

example/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
The scenarios are:
99
1. `two-pods-two-distinct-nx-gzip` - Two pods, one container each, Each container asking for access to the nx-gzip
1010

11+
2. Run the example demo test using `oc apply -f example/demo/nx-test.yaml`
12+
1113
These examples are inspired by https://github.com/kubernetes-sigs/dra-example-driver/tree/main/demo

example/demo/nx-test.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@ spec:
3030
containers:
3131
- name: ctr0
3232
image: quay.io/powercloud/power-dra-driver:main
33-
command: ["bash", "-c"]
34-
args: ["export; trap 'exit 0' TERM; sleep 9999 & wait"]
33+
command: ["/opt/power-dra/bin/power-dra-kubeletplugin"]
34+
args:
35+
- "--node-name=worker-0"
3536
resources:
3637
claims:
3738
- name: nx-gzip
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
runAsNonRoot: false
42+
runAsUser: 0
43+
capabilities:
44+
drop: ["ALL"]
45+
seccompProfile:
46+
type: RuntimeDefault
3847
resourceClaims:
3948
- name: nx-gzip
4049
resourceClaimTemplateName: nx-gzip-template-0
@@ -43,19 +52,28 @@ spec:
4352
apiVersion: v1
4453
kind: Pod
4554
metadata:
46-
namespace: ex-power-dra
55+
namespace: ex-dra-driver
4756
name: pod1
4857
spec:
4958
nodeSelector:
5059
kubernetes.io/hostname: worker-0
5160
containers:
5261
- name: ctr0
5362
image: quay.io/powercloud/power-dra-driver:main
54-
command: ["bash", "-c"]
55-
args: ["export; trap 'exit 0' TERM; sleep 9999 & wait"]
63+
command: ["/opt/power-dra/bin/power-dra-kubeletplugin"]
64+
args:
65+
- "--node-name=worker-0"
5666
resources:
5767
claims:
5868
- name: nx-gzip
69+
securityContext:
70+
allowPrivilegeEscalation: false
71+
runAsNonRoot: false
72+
runAsUser: 0
73+
capabilities:
74+
drop: ["ALL"]
75+
seccompProfile:
76+
type: RuntimeDefault
5977
resourceClaims:
6078
- name: nx-gzip
6179
resourceClaimTemplateName: nx-gzip-template-1

example/two-pods-two-distinct-nx-gzip/05-deployment-first.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ spec:
2020
- name: driver
2121
image: quay.io/powercloud/power-dra-driver:main
2222
imagePullPolicy: IfNotPresent
23-
command: [ "/bin/sleep" ]
24-
args: [ "infinity" ]
23+
command: ["/opt/power-dra/bin/power-dra-kubeletplugin"]
24+
args:
25+
- "--node-name=worker-0"
2526
resources:
2627
limits:
2728
memory: 100Mi

example/two-pods-two-distinct-nx-gzip/06-deployment-second.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ spec:
2222
- name: driver
2323
image: quay.io/powercloud/power-dra-driver:main
2424
imagePullPolicy: IfNotPresent
25-
command: [ "/bin/sleep" ]
26-
args: [ "infinity" ]
25+
command: ["/opt/power-dra/bin/power-dra-kubeletplugin"]
26+
args:
27+
- "--node-name=worker-0"
2728
resources:
2829
claims:
2930
- name: nx-gzip

example/two-pods-two-distinct-nx-gzip/07-demon-set.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,33 @@ spec:
1414
labels:
1515
app: nx-device-plugin
1616
spec:
17+
securityContext:
18+
fsGroup: 0
1719
containers:
1820
- name: nx-device-plugin
1921
image: quay.io/powercloud/power-dra-driver:main
2022
imagePullPolicy: IfNotPresent
23+
command: ["/opt/power-dra/bin/power-dra-kubeletplugin"]
24+
args:
25+
- "--node-name=worker-0"
26+
- "--cdi-root=/cdi"
2127
securityContext:
22-
privileged: true
28+
allowPrivilegeEscalation: false
29+
runAsNonRoot: false
30+
runAsUser: 0
31+
capabilities:
32+
drop: ["ALL"]
33+
seccompProfile:
34+
type: RuntimeDefault
2335
volumeMounts:
2436
- name: device-plugins
25-
mountPath: /var/lib/kubelet/device-plugins
37+
mountPath: /var/lib/kubelet/plugins
38+
- name: cdi-dir
39+
mountPath: /cdi
2640
volumes:
2741
- name: device-plugins
2842
hostPath:
29-
path: /var/lib/kubelet/device-plugins
30-
type: Directory
43+
path: /var/lib/kubelet/plugins
44+
type: DirectoryOrCreate
45+
- name: cdi-dir
46+
emptyDir: {}

example/two-pods-two-distinct-nx-gzip/kustomization.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
metadata:
4-
name: ex-power-dra
4+
name: ex-dra-driver
55

6-
namespace: ex-power-dra
6+
namespace: ex-dra-driver
77

88
generatorOptions:
99
disableNameSuffixHash: true
@@ -15,3 +15,4 @@ resources:
1515
- 04-resource-slice-template.yaml
1616
- 05-deployment-first.yaml
1717
- 06-deployment-second.yaml
18+
- 07-demon-set.yaml

0 commit comments

Comments
 (0)