package dra
import "k8s.io/kubernetes/test/e2e/dra"
Index ¶
- Constants
- type Driver
- func NewDriver(f *framework.Framework, nodes *Nodes, configureResources func() Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute) *Driver
- func NewDriverInstance(f *framework.Framework) *Driver
- func (d *Driver) CallCount(m MethodInstance) int64
- func (d *Driver) Fail(m MethodInstance, injectError bool)
- func (d *Driver) IsGone(ctx context.Context)
- func (d *Driver) NewGetSlices() framework.GetFunc[*resourceapi.ResourceSliceList]
- func (d *Driver) Nodenames() (nodenames []string)
- func (d *Driver) Run(nodes *Nodes, configureResources func() Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute)
- func (d *Driver) SetUp(nodes *Nodes, resources Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute)
- func (d *Driver) TearDown(ctx context.Context)
- type KubeletPlugin
- type MethodInstance
- type Nodes
- func NewNodes(f *framework.Framework, minNodes, maxNodes int) *Nodes
- func NewNodesNow(ctx context.Context, f *framework.Framework, minNodes, maxNodes int) *Nodes
- type Resources
Constants ¶
const ( NodePrepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources" NodeUnprepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodeUnprepareResources" )
Types ¶
type Driver ¶
type Driver struct { // NameSuffix can be set while registering a test to deploy different // drivers in the same test namespace. NameSuffix string // InstanceSuffix can be set while registering a test to deploy two different // instances of the same driver. Used to generate unique objects in the API server. // The socket path is still the same. InstanceSuffix string // RollingUpdate can be set to true to enable using different socket names // for different pods and thus seamless upgrades. Must be supported by the kubelet! RollingUpdate bool // Name gets derived automatically from the current test namespace and // (if set) the NameSuffix while setting up the driver for a test. Name string // Nodes contains entries for each node selected for a test when the test runs. // In addition, there is one entry for a fictional node. Nodes map[string]KubeletPlugin NodeV1alpha4 bool NodeV1beta1 bool // contains filtered or unexported fields }
func NewDriver ¶
func NewDriver(f *framework.Framework, nodes *Nodes, configureResources func() Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute) *Driver
NewDriver sets up controller (as client of the cluster) and kubelet plugin (via proxy) before the test runs. It cleans up after the test.
Call this outside of ginkgo.It, then use the instance inside ginkgo.It.
func NewDriverInstance ¶
NewDriverInstance is a variant of NewDriver where the driver is inactive and must be started explicitly with Run. May be used inside ginkgo.It.
func (*Driver) CallCount ¶
func (d *Driver) CallCount(m MethodInstance) int64
func (*Driver) Fail ¶
func (d *Driver) Fail(m MethodInstance, injectError bool)
func (*Driver) IsGone ¶
IsGone checks that the kubelet is done with the driver. This is done by waiting for the kubelet to remove the driver's ResourceSlices, which takes at least 5 minutes because of the delay in the kubelet. Only use this in slow tests...
func (*Driver) NewGetSlices ¶
func (d *Driver) NewGetSlices() framework.GetFunc[*resourceapi.ResourceSliceList]
NewGetSlices generates a function for gomega.Eventually/Consistently which returns the ResourceSliceList.
func (*Driver) Nodenames ¶
func (*Driver) Run ¶
func (d *Driver) Run(nodes *Nodes, configureResources func() Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute)
func (*Driver) SetUp ¶
func (d *Driver) SetUp(nodes *Nodes, resources Resources, devicesPerNode ...map[string]map[resourceapi.QualifiedName]resourceapi.DeviceAttribute)
func (*Driver) TearDown ¶
type KubeletPlugin ¶
type KubeletPlugin struct { *app.ExamplePlugin ClientSet kubernetes.Interface }
type MethodInstance ¶
type Nodes ¶
type Nodes struct { NodeNames []string // contains filtered or unexported fields }
func NewNodes ¶
NewNodes selects nodes to run the test on.
Call this outside of ginkgo.It, then use the instance inside ginkgo.It.
func NewNodesNow ¶
NewNodesNow is a variant of NewNodes which can be used inside a ginkgo.It.
type Resources ¶
type Resources struct { NodeLocal bool // Nodes is a fixed list of node names on which resources are // available. Mutually exclusive with NodeLabels. Nodes []string // Number of devices called "device-000", "device-001", ... on each node or in the cluster. MaxAllocations int // Tainted causes all devices to be published with a NoExecute taint. Tainted bool }
Source Files ¶
deploy.go dra.go
Directories ¶
Path | Synopsis |
---|---|
test/e2e/dra/test-driver | |
test/e2e/dra/test-driver/app | Package app does all of the work necessary to configure and run a Kubernetes app process. |
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 64 packages
- Last checked
- 6 hours ago –
Tools for package owners.