mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #127397 from kannon92/cleanup-dra-deterministic-name
remove 1.27 deterministic support for resource claims
This commit is contained in:
commit
e367afe3bb
@ -678,23 +678,20 @@ func (ec *Controller) findPodResourceClaim(pod *v1.Pod, podClaim v1.PodResourceC
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
deterministicName := pod.Name + "-" + podClaim.Name // Kubernetes <= 1.27 behavior.
|
||||
for _, claimObj := range claims {
|
||||
claim, ok := claimObj.(*resourceapi.ResourceClaim)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected object of type %T returned by claim cache", claimObj)
|
||||
}
|
||||
podClaimName, ok := claim.Annotations[podResourceClaimAnnotation]
|
||||
if ok && podClaimName != podClaim.Name {
|
||||
// No annotation? Then it cannot be an automatically generated claim
|
||||
// and we need to ignore it.
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
// No annotation? It might a ResourceClaim created for
|
||||
// the pod with a previous Kubernetes release where the
|
||||
// ResourceClaim name was deterministic, in which case
|
||||
// we have to use it and update the new pod status
|
||||
// field accordingly.
|
||||
if !ok && claim.Name != deterministicName {
|
||||
// Not the claim for this particular pod claim?
|
||||
if podClaimName != podClaim.Name {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -190,19 +190,6 @@ func TestSyncHandler(t *testing.T) {
|
||||
},
|
||||
expectedMetrics: expectedMetrics{0, 0},
|
||||
},
|
||||
{
|
||||
name: "find-existing-claim-by-name",
|
||||
pods: []*v1.Pod{testPodWithResource},
|
||||
key: podKey(testPodWithResource),
|
||||
claims: []*resourceapi.ResourceClaim{testClaim},
|
||||
expectedClaims: []resourceapi.ResourceClaim{*testClaim},
|
||||
expectedStatuses: map[string][]v1.PodResourceClaimStatus{
|
||||
testPodWithResource.Name: {
|
||||
{Name: testPodWithResource.Spec.ResourceClaims[0].Name, ResourceClaimName: &testClaim.Name},
|
||||
},
|
||||
},
|
||||
expectedMetrics: expectedMetrics{0, 0},
|
||||
},
|
||||
{
|
||||
name: "find-created-claim-in-cache",
|
||||
pods: []*v1.Pod{testPodWithResource},
|
||||
|
Loading…
Reference in New Issue
Block a user