Skip to content

Commit

Permalink
kubelet: support structured parameters for preparing resources
Browse files Browse the repository at this point in the history
If the resource handle has data from a structured parameter model, then we need
to pass that to the DRA driver kubelet plugin. Because Kubernetes uses
gogo/protobuf, we cannot use "optional" for that new optional field and have to
resort to "repeated" with a single repetition if present.

This is a new, backwards-compatible field.

That extending the resource.k8s.io changes the checksum of a kubelet checkpoint
is unfortunate. Updating the test cases is a stop-gap measure, the actual
solution will have to be something else before beta.

Kubernetes-commit: 6f1ddfcd2e36c76b4e28dbb0ea355441cc4caeb2
  • Loading branch information
pohly authored and k8s-publishing-bot committed Feb 20, 2024
1 parent 1196e07 commit 93ffcc7
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 67 deletions.
210 changes: 179 additions & 31 deletions pkg/apis/dra/v1alpha2/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions pkg/apis/dra/v1alpha2/api.proto
Expand Up @@ -22,6 +22,7 @@ package v1alpha2;
option go_package = "k8s.io/kubelet/pkg/apis/dra/v1alpha2";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "k8s.io/api/resource/v1alpha2/generated.proto";

option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
Expand Down Expand Up @@ -52,6 +53,12 @@ message NodePrepareResourceRequest {
// Resource handle (AllocationResult.ResourceHandles[*].Data)
// This field is REQUIRED.
string resource_handle = 4;
// Structured parameter resource handle (AllocationResult.ResourceHandles[*].StructuredData).
// This field is OPTIONAL. If present, it needs to be used
// instead of resource_handle. It will only have a single entry.
//
// Using "repeated" instead of "optional" is a workaround for https://github.com/gogo/protobuf/issues/713.
repeated k8s.io.api.resource.v1alpha2.StructuredResourceHandle structured_resource_handle = 5;
}

message NodePrepareResourceResponse {
Expand All @@ -74,6 +81,10 @@ message NodeUnprepareResourceRequest {
// Resource handle (AllocationResult.ResourceHandles[*].Data)
// This field is REQUIRED.
string resource_handle = 4;
// Structured parameter resource handle (AllocationResult.ResourceHandles[*].StructuredData).
// This field is OPTIONAL. If present, it needs to be used
// instead of resource_handle. It will only have a single entry.
repeated k8s.io.api.resource.v1alpha2.StructuredResourceHandle structured_resource_handle = 5;
}

message NodeUnprepareResourceResponse {
Expand Down

0 comments on commit 93ffcc7

Please sign in to comment.