17
17
package v1alpha1
18
18
19
19
import (
20
+ "github.com/NVIDIA/k8s-dra-driver/api/utils/sharing"
21
+ "github.com/NVIDIA/k8s-dra-driver/api/utils/types"
22
+
20
23
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
24
)
22
25
23
- // ClaimInfo holds the identifying information about a claim.
24
- type ClaimInfo struct {
25
- Namespace string `json:"namespace"`
26
- Name string `json:"name"`
27
- UID string `json:"uid"`
28
- }
29
-
30
26
// MigDevicePlacement represents the placement of a MIG device within a GPU.
31
27
type MigDevicePlacement struct {
32
28
Start int `json:"start"`
@@ -43,6 +39,8 @@ type AllocatableGpu struct {
43
39
Brand string `json:"brand"`
44
40
Architecture string `json:"architecture"`
45
41
CUDAComputeCapability string `json:"cudaComputeCapability"`
42
+ DriverVersion string `json:"driverVersion"`
43
+ CUDADriverVersion string `json:"cudaDriverVersion"`
46
44
}
47
45
48
46
// AllocatableMigDevice represents an allocatable MIG device (and its possible placements) on a given type of GPU.
@@ -61,12 +59,12 @@ type AllocatableDevice struct {
61
59
// Type returns the type of AllocatableDevice this represents.
62
60
func (d AllocatableDevice ) Type () string {
63
61
if d .Gpu != nil {
64
- return GpuDeviceType
62
+ return types . GpuDeviceType
65
63
}
66
64
if d .Mig != nil {
67
- return MigDeviceType
65
+ return types . MigDeviceType
68
66
}
69
- return UnknownDeviceType
67
+ return types . UnknownDeviceType
70
68
}
71
69
72
70
// AllocatedGpu represents an allocated GPU.
@@ -83,32 +81,32 @@ type AllocatedMigDevice struct {
83
81
84
82
// AllocatedGpus represents a set of allocated GPUs.
85
83
type AllocatedGpus struct {
86
- Devices []AllocatedGpu `json:"devices"`
87
- Sharing * GpuSharing `json:"sharing,omitempty"`
84
+ Devices []AllocatedGpu `json:"devices"`
85
+ Sharing * sharing. GpuSharing `json:"sharing,omitempty"`
88
86
}
89
87
90
88
// AllocatedMigDevices represents a set of allocated MIG devices.
91
89
type AllocatedMigDevices struct {
92
- Devices []AllocatedMigDevice `json:"devices"`
93
- Sharing * MigDeviceSharing `json:"sharing,omitempty"`
90
+ Devices []AllocatedMigDevice `json:"devices"`
91
+ Sharing * sharing. MigDeviceSharing `json:"sharing,omitempty"`
94
92
}
95
93
96
94
// AllocatedDevices represents a set of allocated devices.
97
95
type AllocatedDevices struct {
98
- ClaimInfo * ClaimInfo `json:"claimInfo"`
96
+ ClaimInfo * types. ClaimInfo `json:"claimInfo"`
99
97
Gpu * AllocatedGpus `json:"gpu,omitempty"`
100
98
Mig * AllocatedMigDevices `json:"mig,omitempty"`
101
99
}
102
100
103
101
// Type returns the type of AllocatedDevices this represents.
104
102
func (r AllocatedDevices ) Type () string {
105
103
if r .Gpu != nil {
106
- return GpuDeviceType
104
+ return types . GpuDeviceType
107
105
}
108
106
if r .Mig != nil {
109
- return MigDeviceType
107
+ return types . MigDeviceType
110
108
}
111
- return UnknownDeviceType
109
+ return types . UnknownDeviceType
112
110
}
113
111
114
112
// PreparedGpu represents a prepared GPU on a node.
@@ -143,12 +141,12 @@ type PreparedDevices struct {
143
141
// Type returns the type of PreparedDevices this represents.
144
142
func (d PreparedDevices ) Type () string {
145
143
if d .Gpu != nil {
146
- return GpuDeviceType
144
+ return types . GpuDeviceType
147
145
}
148
146
if d .Mig != nil {
149
- return MigDeviceType
147
+ return types . MigDeviceType
150
148
}
151
- return UnknownDeviceType
149
+ return types . UnknownDeviceType
152
150
}
153
151
154
152
// NodeAllocationStateSpec is the spec for the NodeAllocationState CRD.
0 commit comments