mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #129810 from pohly/dra-test-driver-examples
DRA: fix test-driver examples
This commit is contained in:
commit
261236b9a3
@ -59,18 +59,14 @@ RUNTIME_CONFIG="resource.k8s.io/v1alpha3" FEATURE_GATES=DynamicResourceAllocatio
|
|||||||
```
|
```
|
||||||
|
|
||||||
In another:
|
In another:
|
||||||
```console
|
|
||||||
go run ./test/e2e/dra/test-driver --feature-gates ContextualLogging=true -v=5 controller
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In yet another:
|
|
||||||
```console
|
|
||||||
sudo mkdir -p /var/run/cdi && sudo chmod a+rwx /var/run/cdi /var/lib/kubelet/plugins_registry
|
sudo mkdir -p /var/run/cdi && sudo chmod a+rwx /var/run/cdi /var/lib/kubelet/plugins_registry
|
||||||
go run ./test/e2e/dra/test-driver --feature-gates ContextualLogging=true -v=5 kubelet-plugin --node-name=127.0.0.1
|
KUBECONFIG=/var/run/kubernetes/admin.kubeconfig go run ./test/e2e/dra/test-driver -v=5 kubelet-plugin --node-name=127.0.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
And finally:
|
And finally:
|
||||||
```console
|
```console
|
||||||
|
$ export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
|
||||||
$ kubectl create -f test/e2e/dra/test-driver/deploy/example/resourceclass.yaml
|
$ kubectl create -f test/e2e/dra/test-driver/deploy/example/resourceclass.yaml
|
||||||
resourceclass/example created
|
resourceclass/example created
|
||||||
$ kubectl create -f test/e2e/dra/test-driver/deploy/example/pod-inline.yaml
|
$ kubectl create -f test/e2e/dra/test-driver/deploy/example/pod-inline.yaml
|
||||||
|
@ -184,6 +184,7 @@ func NewCommand() *cobra.Command {
|
|||||||
fs = kubeletPluginFlagSets.FlagSet("CDI")
|
fs = kubeletPluginFlagSets.FlagSet("CDI")
|
||||||
cdiDir := fs.String("cdi-dir", "/var/run/cdi", "directory for dynamically created CDI JSON files")
|
cdiDir := fs.String("cdi-dir", "/var/run/cdi", "directory for dynamically created CDI JSON files")
|
||||||
nodeName := fs.String("node-name", "", "name of the node that the kubelet plugin is responsible for")
|
nodeName := fs.String("node-name", "", "name of the node that the kubelet plugin is responsible for")
|
||||||
|
numDevices := fs.Int("num-devices", 4, "number of devices to simulate per node")
|
||||||
fs = kubeletPlugin.Flags()
|
fs = kubeletPlugin.Flags()
|
||||||
for _, f := range kubeletPluginFlagSets.FlagSets {
|
for _, f := range kubeletPluginFlagSets.FlagSets {
|
||||||
fs.AddFlagSet(f)
|
fs.AddFlagSet(f)
|
||||||
@ -203,7 +204,7 @@ func NewCommand() *cobra.Command {
|
|||||||
return errors.New("--node-name not set")
|
return errors.New("--node-name not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin, err := StartPlugin(cmd.Context(), *cdiDir, *driverName, clientset, *nodeName, FileOperations{},
|
plugin, err := StartPlugin(cmd.Context(), *cdiDir, *driverName, clientset, *nodeName, FileOperations{NumDevices: *numDevices},
|
||||||
kubeletplugin.PluginSocketPath(*endpoint),
|
kubeletplugin.PluginSocketPath(*endpoint),
|
||||||
kubeletplugin.RegistrarSocketPath(path.Join(*pluginRegistrationPath, *driverName+"-reg.sock")),
|
kubeletplugin.RegistrarSocketPath(path.Join(*pluginRegistrationPath, *driverName+"-reg.sock")),
|
||||||
kubeletplugin.KubeletPluginSocketPath(*draAddress),
|
kubeletplugin.KubeletPluginSocketPath(*draAddress),
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
# This storage class intentionally doesn't match any nodes.
|
|
||||||
# When using it instead of a functional one, scheduling a pod leads to:
|
|
||||||
# Warning FailedScheduling 16s default-scheduler 0/1 nodes are available: 1 excluded via potential node filter in resource class.
|
|
||||||
|
|
||||||
apiVersion: resource.k8s.io/v1alpha3
|
|
||||||
kind: ResourceClass
|
|
||||||
metadata:
|
|
||||||
name: example
|
|
||||||
driverName: test-driver.cdi.k8s.io
|
|
||||||
suitableNodes:
|
|
||||||
nodeSelectorTerms:
|
|
||||||
- matchExpressions:
|
|
||||||
- key: no-such-label
|
|
||||||
operator: Exists
|
|
@ -1,5 +1,5 @@
|
|||||||
apiVersion: resource.k8s.io/v1alpha3
|
apiVersion: resource.k8s.io/v1beta1
|
||||||
kind: ResourceClass
|
kind: DeviceClass
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: example
|
||||||
spec:
|
spec:
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
# One external resource claim, one pod, two containers.
|
# One external resource claim, one pod, two containers.
|
||||||
# One container uses resource, one does not.
|
# One container uses resource, one does not.
|
||||||
apiVersion: v1
|
apiVersion: resource.k8s.io/v1beta1
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: external-claim-parameters
|
|
||||||
namespace: default
|
|
||||||
data:
|
|
||||||
a: b
|
|
||||||
---
|
|
||||||
apiVersion: resource.k8s.io/v1alpha3
|
|
||||||
kind: ResourceClaim
|
kind: ResourceClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: external-claim
|
name: external-claim
|
||||||
spec:
|
spec:
|
||||||
resourceClassName: example
|
devices:
|
||||||
parametersRef:
|
requests:
|
||||||
kind: ConfigMap
|
- name: my-device
|
||||||
name: external-claim-parameters
|
deviceClassName: example
|
||||||
|
config:
|
||||||
|
- opaque:
|
||||||
|
driver: test-driver.cdi.k8s.io
|
||||||
|
parameters:
|
||||||
|
a: b
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
@ -30,7 +27,7 @@ spec:
|
|||||||
command: ["sh", "-c", "set && mount && ls -la /dev/"]
|
command: ["sh", "-c", "set && mount && ls -la /dev/"]
|
||||||
resources:
|
resources:
|
||||||
claims:
|
claims:
|
||||||
- resource
|
- name: resource
|
||||||
- name: without-resource
|
- name: without-resource
|
||||||
image: registry.k8s.io/e2e-test-images/busybox:1.29-2
|
image: registry.k8s.io/e2e-test-images/busybox:1.29-2
|
||||||
command: ["sh", "-c", "set && mount && ls -la /dev/"]
|
command: ["sh", "-c", "set && mount && ls -la /dev/"]
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
apiVersion: v1
|
apiVersion: resource.k8s.io/v1beta1
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: pause-claim-parameters
|
|
||||||
namespace: default
|
|
||||||
data:
|
|
||||||
a: b
|
|
||||||
---
|
|
||||||
apiVersion: resource.k8s.io/v1alpha3
|
|
||||||
kind: ResourceClaimTemplate
|
kind: ResourceClaimTemplate
|
||||||
metadata:
|
metadata:
|
||||||
name: pause-template
|
name: pause-template
|
||||||
@ -16,10 +8,15 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: inline-resource
|
app: inline-resource
|
||||||
spec:
|
spec:
|
||||||
resourceClassName: example
|
devices:
|
||||||
parametersRef:
|
requests:
|
||||||
kind: ConfigMap
|
- name: my-device
|
||||||
name: pause-claim-parameters
|
deviceClassName: example
|
||||||
|
config:
|
||||||
|
- opaque:
|
||||||
|
driver: test-driver.cdi.k8s.io
|
||||||
|
parameters:
|
||||||
|
a: b
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
# One inline resource claim, one pod, two containers.
|
# One inline resource claim, one pod, two containers.
|
||||||
# One container uses resource, one does not.
|
# One container uses resource, one does not.
|
||||||
apiVersion: v1
|
apiVersion: resource.k8s.io/v1beta1
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: test-inline-claim-parameters
|
|
||||||
namespace: default
|
|
||||||
data:
|
|
||||||
a: b
|
|
||||||
---
|
|
||||||
apiVersion: resource.k8s.io/v1alpha3
|
|
||||||
kind: ResourceClaimTemplate
|
kind: ResourceClaimTemplate
|
||||||
metadata:
|
metadata:
|
||||||
name: test-inline-claim-template
|
name: test-inline-claim-template
|
||||||
@ -18,10 +10,15 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: inline-resource
|
app: inline-resource
|
||||||
spec:
|
spec:
|
||||||
resourceClassName: example
|
devices:
|
||||||
parametersRef:
|
requests:
|
||||||
kind: ConfigMap
|
- name: my-device
|
||||||
name: test-inline-claim-parameters
|
deviceClassName: example
|
||||||
|
config:
|
||||||
|
- opaque:
|
||||||
|
driver: test-driver.cdi.k8s.io
|
||||||
|
parameters:
|
||||||
|
a: b
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
# One external resource claim, two pods, two containers in each pod.
|
# One external resource claim, two pods, two containers in each pod.
|
||||||
# Pods share the same resource.
|
# Pods share the same resource.
|
||||||
# One container uses resource, one does not.
|
# One container uses resource, one does not.
|
||||||
apiVersion: v1
|
apiVersion: resource.k8s.io/v1beta1
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: shared-claim-parameters
|
|
||||||
data:
|
|
||||||
a: b
|
|
||||||
---
|
|
||||||
apiVersion: resource.k8s.io/v1alpha3
|
|
||||||
kind: ResourceClaim
|
kind: ResourceClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: shared-claim
|
name: shared-claim
|
||||||
spec:
|
spec:
|
||||||
resourceClassName: example
|
devices:
|
||||||
parametersRef:
|
requests:
|
||||||
kind: ConfigMap
|
- name: my-device
|
||||||
name: shared-claim-parameters
|
deviceClassName: example
|
||||||
|
config:
|
||||||
|
- opaque:
|
||||||
|
driver: test-driver.cdi.k8s.io
|
||||||
|
parameters:
|
||||||
|
a: b
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
Loading…
Reference in New Issue
Block a user