Documentation
¶
Index ¶
- func CreateDeviceClass(ctx context.Context, client kubernetes.Interface, ...) error
- func CreateResourceClaim(ctx context.Context, client kubernetes.Interface, namespace string, ...) error
- func CreateResourceClaimTemplate(ctx context.Context, client kubernetes.Interface, namespace string, ...) error
- func DeleteDeviceClass(ctx context.Context, client kubernetes.Interface, name string) error
- func DeleteResourceClaim(ctx context.Context, client kubernetes.Interface, namespace, name string) error
- func DeleteResourceClaimTemplate(ctx context.Context, client kubernetes.Interface, namespace, name string) error
- type CounterValidator
- func (cv *CounterValidator) CountPartitionDevices(ctx context.Context) (int, error)
- func (cv *CounterValidator) GetNodeWithDevices(ctx context.Context) (string, error)
- func (cv *CounterValidator) GetResourceSlicesByType(ctx context.Context) (counterSlices, deviceSlices []resourceapi.ResourceSlice, err error)
- func (cv *CounterValidator) HasSharedCounters(ctx context.Context) bool
- func (cv *CounterValidator) ValidateDeviceConsumesCounters(ctx context.Context) error
- func (cv *CounterValidator) ValidateSharedCounters(ctx context.Context, expectedCounters []string) error
- type DriverConfig
- type ResourceBuilder
- func (rb *ResourceBuilder) BuildDeviceClass(name string) *resourceapi.DeviceClass
- func (rb *ResourceBuilder) BuildLongRunningPodWithClaim(name, claimName, img string) *corev1.Pod
- func (rb *ResourceBuilder) BuildPodWithClaim(name, claimName, img string) *corev1.Pod
- func (rb *ResourceBuilder) BuildPodWithInlineClaim(name string) *corev1.Pod
- func (rb *ResourceBuilder) BuildResourceClaim(name, deviceClassName string, count int) *resourceapi.ResourceClaim
- func (rb *ResourceBuilder) BuildResourceClaimTemplate(name, deviceClassName string, count int) *resourceapi.ResourceClaimTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDeviceClass ¶
func CreateDeviceClass(ctx context.Context, client kubernetes.Interface, deviceClass *resourceapi.DeviceClass) error
CreateDeviceClass creates a DeviceClass using the typed client.
func CreateResourceClaim ¶
func CreateResourceClaim(ctx context.Context, client kubernetes.Interface, namespace string, claim *resourceapi.ResourceClaim) error
CreateResourceClaim creates a ResourceClaim using the typed client.
func CreateResourceClaimTemplate ¶
func CreateResourceClaimTemplate(ctx context.Context, client kubernetes.Interface, namespace string, template *resourceapi.ResourceClaimTemplate) error
CreateResourceClaimTemplate creates a ResourceClaimTemplate using the typed client.
func DeleteDeviceClass ¶
DeleteDeviceClass deletes a DeviceClass
func DeleteResourceClaim ¶
func DeleteResourceClaim(ctx context.Context, client kubernetes.Interface, namespace, name string) error
DeleteResourceClaim deletes a ResourceClaim
func DeleteResourceClaimTemplate ¶
func DeleteResourceClaimTemplate(ctx context.Context, client kubernetes.Interface, namespace, name string) error
DeleteResourceClaimTemplate deletes a ResourceClaimTemplate
Types ¶
type CounterValidator ¶
type CounterValidator struct {
// contains filtered or unexported fields
}
CounterValidator provides helpers for validating ResourceSlice counter structures introduced by the DRAPartitionableDevices feature (KEP-4815). It separates ResourceSlices into counter slices (SharedCounters only) and device slices (Devices with ConsumesCounters), matching the two-slice model that partitionable drivers publish.
func NewCounterValidator ¶
func NewCounterValidator(client kubernetes.Interface, driverName string) *CounterValidator
NewCounterValidator creates a validator for the given driver.
func (*CounterValidator) CountPartitionDevices ¶
func (cv *CounterValidator) CountPartitionDevices(ctx context.Context) (int, error)
CountPartitionDevices returns the number of partition devices across all device slices for the driver. The upstream dra-example-driver names partition devices as "gpu-N-partition-M" when gpuPartitions > 0, so the substring "partition" reliably identifies them within this driver's naming convention.
func (*CounterValidator) GetNodeWithDevices ¶
func (cv *CounterValidator) GetNodeWithDevices(ctx context.Context) (string, error)
GetNodeWithDevices returns the name of a schedulable worker node where the driver is publishing devices. It avoids master/control-plane nodes whose taints would prevent regular test pods from being scheduled there. Falls back to any node with devices if no untainted node is found.
func (*CounterValidator) GetResourceSlicesByType ¶
func (cv *CounterValidator) GetResourceSlicesByType(ctx context.Context) (counterSlices, deviceSlices []resourceapi.ResourceSlice, err error)
GetResourceSlicesByType lists all ResourceSlices for the driver and separates them into counter slices (have SharedCounters but no Devices) and device slices (have Devices, may have ConsumesCounters on individual devices).
func (*CounterValidator) HasSharedCounters ¶
func (cv *CounterValidator) HasSharedCounters(ctx context.Context) bool
HasSharedCounters returns true if the driver is publishing ResourceSlices that contain SharedCounters.
func (*CounterValidator) ValidateDeviceConsumesCounters ¶
func (cv *CounterValidator) ValidateDeviceConsumesCounters(ctx context.Context) error
ValidateDeviceConsumesCounters verifies that every device in the driver's device slices has at least one ConsumesCounters entry pointing to a named CounterSet.
func (*CounterValidator) ValidateSharedCounters ¶
func (cv *CounterValidator) ValidateSharedCounters(ctx context.Context, expectedCounters []string) error
ValidateSharedCounters verifies that at least one counter slice exists and that every CounterSet in those slices contains the expected counters with non-zero values. Returns an error describing the first violation found.
type DriverConfig ¶
type DriverConfig struct {
DriverName string
DefaultClass string
RequestName string
ContainerImage string
ContainerCommand []string
LongRunCommand []string
}
DriverConfig holds driver-specific parameters for building DRA test resources
type ResourceBuilder ¶
type ResourceBuilder struct {
// contains filtered or unexported fields
}
ResourceBuilder helps build DRA resource objects
func NewResourceBuilder ¶
func NewResourceBuilder(namespace string, config DriverConfig) *ResourceBuilder
NewResourceBuilder creates a new builder
func (*ResourceBuilder) BuildDeviceClass ¶
func (rb *ResourceBuilder) BuildDeviceClass(name string) *resourceapi.DeviceClass
BuildDeviceClass creates a DeviceClass for the configured driver
func (*ResourceBuilder) BuildLongRunningPodWithClaim ¶
func (rb *ResourceBuilder) BuildLongRunningPodWithClaim(name, claimName, img string) *corev1.Pod
BuildLongRunningPodWithClaim creates a long-running Pod for testing
func (*ResourceBuilder) BuildPodWithClaim ¶
func (rb *ResourceBuilder) BuildPodWithClaim(name, claimName, img string) *corev1.Pod
BuildPodWithClaim creates a Pod that uses a ResourceClaim
func (*ResourceBuilder) BuildPodWithInlineClaim ¶
func (rb *ResourceBuilder) BuildPodWithInlineClaim(name string) *corev1.Pod
BuildPodWithInlineClaim creates a Pod with inline ResourceClaim
func (*ResourceBuilder) BuildResourceClaim ¶
func (rb *ResourceBuilder) BuildResourceClaim(name, deviceClassName string, count int) *resourceapi.ResourceClaim
BuildResourceClaim creates a ResourceClaim requesting devices
func (*ResourceBuilder) BuildResourceClaimTemplate ¶
func (rb *ResourceBuilder) BuildResourceClaimTemplate(name, deviceClassName string, count int) *resourceapi.ResourceClaimTemplate
BuildResourceClaimTemplate creates a ResourceClaimTemplate