Repository: kubernetes/kubernetes
File: test/e2e/dra/dra.go (Go)

Code before:

		if withKubelet {
			// Serial because the example device plugin can only be deployed with one instance at a time.
			f.It("supports extended resources together with ResourceClaim", f.WithSerial(), func(ctx context.Context) {
				extendedResourceName := deployDevicePlugin(ctx, f, nodes.NodeNames[0:1])

				pod := b.PodExternal()
				resources := v1.ResourceList{extendedResourceName: resource.MustParse("1")}
				pod.Spec.Containers[0].Resources.Requests = resources
				pod.Spec.Containers[0].Resources.Limits = resources
				claim := b.ExternalClaim()
				b.Create(ctx, claim, pod)
				b.TestPod(ctx, f, pod)
			})
		}
	}

	singleNodeMultipleClaimsTests := func() {
		nodes := drautils.NewNodes(f, 1, 1)
		// Allow allocating more than one device so that multiple claims can be prepared on the same node.
		maxAllocations := 2
		driver := drautils.NewDriver(f, nodes, drautils.DriverResources(maxAllocations)) // All tests get their own driver instance.
		driver.WithKubelet = true
		b := drautils.NewBuilder(f, driver)

		ginkgo.It("requests an already allocated and a new claim for a pod", func(ctx context.Context) {
			// This test covers a situation when a pod references a mix of already-prepared and new claims.
			firstClaim := b.ExternalClaim()
			secondClaim := b.ExternalClaim()

			b.Create(ctx, firstClaim, secondClaim)

			// First pod uses only firstClaim
			firstPod := b.PodExternal()
			b.Create(ctx, firstPod)
			b.TestPod(ctx, f, firstPod)

			// Second pod uses firstClaim (already prepared) + secondClaim (new)
			secondPod := b.PodExternal()

			secondPod.Spec.ResourceClaims = []v1.PodResourceClaim{
				{
					Name:              "first",
					ResourceClaimName: &firstClaim.Name,
				},
				{
					Name:              "second",
					ResourceClaimName: &secondClaim.Name,
				},
			}


Review comment (suggestion):
It looks like you manually dropped the `KubeletMinVersion`:

https://github.com/kubernetes/kubernetes/blob/ea4f784f4b13a2fa5e71a11a894bac715629b9c6/test/e2e/dra/dra.go#L1109-L1111

Is that correct?

That's okay, but then we need to land this fix in v1.34.4 (or whatever the next patch release is) first.

=> https://github.com/kubernetes/kubernetes/pull/136480

Code after:

		if withKubelet {
			// Serial because the example device plugin can only be deployed with one instance at a time.
			f.It("supports extended resources together with ResourceClaim", f.WithSerial(), func(ctx context.Context) {
				extendedResourceName := deployDevicePlugin(ctx, f, nodes.NodeNames[0:1])

				pod := b.PodExternal()
				resources := v1.ResourceList{extendedResourceName: resource.MustParse("1")}
				pod.Spec.Containers[0].Resources.Requests = resources
				pod.Spec.Containers[0].Resources.Limits = resources
				claim := b.ExternalClaim()
				b.Create(ctx, claim, pod)
				b.TestPod(ctx, f, pod)
			})
		}
	}

	singleNodeMultipleClaimsTests := func() {
		nodes := drautils.NewNodes(f, 1, 1)
		// Allow allocating more than one device so that multiple claims can be prepared on the same node.
		maxAllocations := 2
		driver := drautils.NewDriver(f, nodes, drautils.DriverResources(maxAllocations)) // All tests get their own driver instance.
		driver.WithKubelet = true
		b := drautils.NewBuilder(f, driver)

		// https://github.com/kubernetes/kubernetes/issues/135901 was fixed and backported to Kubernetes 1.35.
		// An independent backport was introduced for 1.34: https://github.com/kubernetes/kubernetes/pull/136480;
		// in the meantime this KubeletMinVersion:1.35 is necessary because
		// the latest 1.34 release still has the problem.
		f.It("requests an already allocated and a new claim for a pod", f.WithLabel("KubeletMinVersion:1.35"), func(ctx context.Context) {
			// This test covers a situation when a pod references a mix of already-prepared and new claims.
			firstClaim := b.ExternalClaim()
			secondClaim := b.ExternalClaim()

			b.Create(ctx, firstClaim, secondClaim)

			// First pod uses only firstClaim
			firstPod := b.PodExternal()
			b.Create(ctx, firstPod)
			b.TestPod(ctx, f, firstPod)

			// Second pod uses firstClaim (already prepared) + secondClaim (new)
			secondPod := b.PodExternal()

			secondPod.Spec.ResourceClaims = []v1.PodResourceClaim{
				{
					Name:              "first",
					ResourceClaimName: &firstClaim.Name,
				},
				{
					Name:              "second",