@@ -25,15 +25,16 @@ import (
25
25
resourceapi "k8s.io/api/resource/v1alpha3"
26
26
"k8s.io/apimachinery/pkg/types"
27
27
"k8s.io/apimachinery/pkg/util/sets"
28
- "k8s.io/kubernetes/pkg/kubelet/cm/dra/state"
28
+ checkpointapi "k8s.io/kubernetes/pkg/kubelet/cm/dra/checkpoint/v1"
29
+ state "k8s.io/kubernetes/pkg/kubelet/cm/dra/state"
29
30
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
30
31
)
31
32
32
33
// ClaimInfo holds information required
33
34
// to prepare and unprepare a resource claim.
34
35
// +k8s:deepcopy-gen=true
35
36
type ClaimInfo struct {
36
- state .ClaimInfoState
37
+ checkpointapi .ClaimInfoState
37
38
prepared bool
38
39
}
39
40
@@ -47,18 +48,18 @@ type claimInfoCache struct {
47
48
// newClaimInfoFromClaim creates a new claim info from a resource claim.
48
49
// It verifies that the kubelet can handle the claim.
49
50
func newClaimInfoFromClaim (claim * resourceapi.ResourceClaim ) (* ClaimInfo , error ) {
50
- claimInfoState := state .ClaimInfoState {
51
+ claimInfoState := checkpointapi .ClaimInfoState {
51
52
ClaimUID : claim .UID ,
52
53
ClaimName : claim .Name ,
53
54
Namespace : claim .Namespace ,
54
55
PodUIDs : sets .New [string ](),
55
- DriverState : make (map [string ]state .DriverState ),
56
+ DriverState : make (map [string ]checkpointapi .DriverState ),
56
57
}
57
58
if claim .Status .Allocation == nil {
58
59
return nil , errors .New ("not allocated" )
59
60
}
60
61
for _ , result := range claim .Status .Allocation .Devices .Results {
61
- claimInfoState .DriverState [result .Driver ] = state .DriverState {}
62
+ claimInfoState .DriverState [result .Driver ] = checkpointapi .DriverState {}
62
63
}
63
64
info := & ClaimInfo {
64
65
ClaimInfoState : claimInfoState ,
@@ -68,7 +69,7 @@ func newClaimInfoFromClaim(claim *resourceapi.ResourceClaim) (*ClaimInfo, error)
68
69
}
69
70
70
71
// newClaimInfoFromClaim creates a new claim info from a checkpointed claim info state object.
71
- func newClaimInfoFromState (state * state .ClaimInfoState ) * ClaimInfo {
72
+ func newClaimInfoFromState (state * checkpointapi .ClaimInfoState ) * ClaimInfo {
72
73
info := & ClaimInfo {
73
74
ClaimInfoState : * state .DeepCopy (),
74
75
prepared : false ,
@@ -77,9 +78,9 @@ func newClaimInfoFromState(state *state.ClaimInfoState) *ClaimInfo {
77
78
}
78
79
79
80
// setCDIDevices adds a set of CDI devices to the claim info.
80
- func (info * ClaimInfo ) addDevice (driverName string , device state .Device ) {
81
+ func (info * ClaimInfo ) addDevice (driverName string , device checkpointapi .Device ) {
81
82
if info .DriverState == nil {
82
- info .DriverState = make (map [string ]state .DriverState )
83
+ info .DriverState = make (map [string ]checkpointapi .DriverState )
83
84
}
84
85
driverState := info .DriverState [driverName ]
85
86
driverState .Devices = append (driverState .Devices , device )
@@ -188,7 +189,7 @@ func (cache *claimInfoCache) hasPodReference(UID types.UID) bool {
188
189
189
190
// syncToCheckpoint syncs the full claim info cache state to a checkpoint.
190
191
func (cache * claimInfoCache ) syncToCheckpoint () error {
191
- claimInfoStateList := make (state .ClaimInfoStateList , 0 , len (cache .claimInfo ))
192
+ claimInfoStateList := make (checkpointapi .ClaimInfoStateList , 0 , len (cache .claimInfo ))
192
193
for _ , infoClaim := range cache .claimInfo {
193
194
claimInfoStateList = append (claimInfoStateList , infoClaim .ClaimInfoState )
194
195
}
0 commit comments