Skip to content

Commit e367afe

Browse files
authored
Merge pull request kubernetes#127397 from kannon92/cleanup-dra-deterministic-name
remove 1.27 deterministic support for resource claims
2 parents 6f15839 + 03da672 commit e367afe

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

pkg/controller/resourceclaim/controller.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,23 +678,20 @@ func (ec *Controller) findPodResourceClaim(pod *v1.Pod, podClaim v1.PodResourceC
678678
if err != nil {
679679
return nil, err
680680
}
681-
deterministicName := pod.Name + "-" + podClaim.Name // Kubernetes <= 1.27 behavior.
682681
for _, claimObj := range claims {
683682
claim, ok := claimObj.(*resourceapi.ResourceClaim)
684683
if !ok {
685684
return nil, fmt.Errorf("unexpected object of type %T returned by claim cache", claimObj)
686685
}
687686
podClaimName, ok := claim.Annotations[podResourceClaimAnnotation]
688-
if ok && podClaimName != podClaim.Name {
687+
// No annotation? Then it cannot be an automatically generated claim
688+
// and we need to ignore it.
689+
if !ok {
689690
continue
690691
}
691692

692-
// No annotation? It might a ResourceClaim created for
693-
// the pod with a previous Kubernetes release where the
694-
// ResourceClaim name was deterministic, in which case
695-
// we have to use it and update the new pod status
696-
// field accordingly.
697-
if !ok && claim.Name != deterministicName {
693+
// Not the claim for this particular pod claim?
694+
if podClaimName != podClaim.Name {
698695
continue
699696
}
700697

pkg/controller/resourceclaim/controller_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,6 @@ func TestSyncHandler(t *testing.T) {
190190
},
191191
expectedMetrics: expectedMetrics{0, 0},
192192
},
193-
{
194-
name: "find-existing-claim-by-name",
195-
pods: []*v1.Pod{testPodWithResource},
196-
key: podKey(testPodWithResource),
197-
claims: []*resourceapi.ResourceClaim{testClaim},
198-
expectedClaims: []resourceapi.ResourceClaim{*testClaim},
199-
expectedStatuses: map[string][]v1.PodResourceClaimStatus{
200-
testPodWithResource.Name: {
201-
{Name: testPodWithResource.Spec.ResourceClaims[0].Name, ResourceClaimName: &testClaim.Name},
202-
},
203-
},
204-
expectedMetrics: expectedMetrics{0, 0},
205-
},
206193
{
207194
name: "find-created-claim-in-cache",
208195
pods: []*v1.Pod{testPodWithResource},

0 commit comments

Comments
 (0)