mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #128646 from pohly/dra-kubelet-separate-beta-api
DRA kubelet: separate beta and alpha gRPC APIs
This commit is contained in:
commit
33c64b380a
@ -128,7 +128,7 @@ func (p *Plugin) NodePrepareResources(
|
||||
response, err = nodeClient.NodePrepareResources(ctx, req)
|
||||
case drapbv1alpha4.NodeService:
|
||||
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
||||
response, err = nodeClient.NodePrepareResources(ctx, req)
|
||||
response, err = drapbv1alpha4.V1Alpha4ClientWrapper{NodeClient: nodeClient}.NodePrepareResources(ctx, req)
|
||||
default:
|
||||
// Shouldn't happen, validateSupportedServices should only
|
||||
// return services we support here.
|
||||
@ -161,7 +161,7 @@ func (p *Plugin) NodeUnprepareResources(
|
||||
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
||||
case drapbv1alpha4.NodeService:
|
||||
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
||||
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
||||
response, err = drapbv1alpha4.V1Alpha4ClientWrapper{NodeClient: nodeClient}.NodeUnprepareResources(ctx, req)
|
||||
default:
|
||||
// Shouldn't happen, validateSupportedServices should only
|
||||
// return services we support here.
|
||||
|
@ -34,7 +34,6 @@ import (
|
||||
)
|
||||
|
||||
type fakeGRPCServer struct {
|
||||
drapbv1beta1.UnimplementedDRAPluginServer
|
||||
}
|
||||
|
||||
var _ drapbv1beta1.DRAPluginServer = &fakeGRPCServer{}
|
||||
@ -84,7 +83,7 @@ func setupFakeGRPCServer(service string) (string, tearDown, error) {
|
||||
case drapbv1beta1.DRAPluginService:
|
||||
drapbv1beta1.RegisterDRAPluginServer(s, fakeGRPCServer)
|
||||
case drapbv1alpha4.NodeService:
|
||||
drapbv1alpha4.RegisterNodeServer(s, fakeGRPCServer)
|
||||
drapbv1alpha4.RegisterNodeServer(s, drapbv1alpha4.V1Beta1ServerWrapper{DRAPluginServer: fakeGRPCServer})
|
||||
default:
|
||||
return "", nil, fmt.Errorf("unsupported gRPC service: %s", service)
|
||||
}
|
||||
|
@ -272,12 +272,12 @@ type draPlugin struct {
|
||||
// If the plugin will be used to publish resources, [KubeClient] and [NodeName]
|
||||
// options are mandatory.
|
||||
//
|
||||
// By default, the DRA driver gets registered so that the plugin is compatible
|
||||
// with Kubernetes >= 1.32. To be compatible with Kubernetes >= 1.31, a driver
|
||||
// has to ask specifically to register only the alpha gRPC API, i.e. use:
|
||||
//
|
||||
// Start(..., NodeV1beta1(false))
|
||||
func Start(ctx context.Context, nodeServer interface{}, opts ...Option) (result DRAPlugin, finalErr error) {
|
||||
// The DRA driver decides which gRPC interfaces it implements. At least one
|
||||
// implementation of [drapbv1alpha4.NodeServer] or [drapbv1beta1.DRAPluginServer]
|
||||
// is required. Implementing drapbv1beta1.DRAPluginServer is recommended for
|
||||
// DRA driver targeting Kubernetes >= 1.32. To be compatible with Kubernetes 1.31,
|
||||
// DRA drivers must implement only [drapbv1alpha4.NodeServer].
|
||||
func Start(ctx context.Context, nodeServers []interface{}, opts ...Option) (result DRAPlugin, finalErr error) {
|
||||
logger := klog.FromContext(ctx)
|
||||
o := options{
|
||||
logger: klog.Background(),
|
||||
@ -338,15 +338,17 @@ func Start(ctx context.Context, nodeServer interface{}, opts ...Option) (result
|
||||
// Run the node plugin gRPC server first to ensure that it is ready.
|
||||
var supportedServices []string
|
||||
plugin, err := startGRPCServer(klog.NewContext(ctx, klog.LoggerWithName(logger, "dra")), o.grpcVerbosity, o.unaryInterceptors, o.streamInterceptors, o.draEndpoint, func(grpcServer *grpc.Server) {
|
||||
if nodeServer, ok := nodeServer.(drapbv1alpha4.NodeServer); ok && o.nodeV1alpha4 {
|
||||
logger.V(5).Info("registering v1alpha4.Node gGRPC service")
|
||||
drapbv1alpha4.RegisterNodeServer(grpcServer, nodeServer)
|
||||
supportedServices = append(supportedServices, drapbv1alpha4.NodeService)
|
||||
}
|
||||
if nodeServer, ok := nodeServer.(drapbv1beta1.DRAPluginServer); ok && o.nodeV1beta1 {
|
||||
logger.V(5).Info("registering v1beta1.DRAPlugin gRPC service")
|
||||
drapbv1beta1.RegisterDRAPluginServer(grpcServer, nodeServer)
|
||||
supportedServices = append(supportedServices, drapbv1beta1.DRAPluginService)
|
||||
for _, nodeServer := range nodeServers {
|
||||
if nodeServer, ok := nodeServer.(drapbv1alpha4.NodeServer); ok && o.nodeV1alpha4 {
|
||||
logger.V(5).Info("registering v1alpha4.Node gGRPC service")
|
||||
drapbv1alpha4.RegisterNodeServer(grpcServer, nodeServer)
|
||||
supportedServices = append(supportedServices, drapbv1alpha4.NodeService)
|
||||
}
|
||||
if nodeServer, ok := nodeServer.(drapbv1beta1.DRAPluginServer); ok && o.nodeV1beta1 {
|
||||
logger.V(5).Info("registering v1beta1.DRAPlugin gRPC service")
|
||||
drapbv1beta1.RegisterDRAPluginServer(grpcServer, nodeServer)
|
||||
supportedServices = append(supportedServices, drapbv1beta1.DRAPluginService)
|
||||
}
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
|
187
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/conversion.go
Normal file
187
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/conversion.go
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
Copyright 2024 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha4
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kubelet/pkg/apis/dra/v1beta1"
|
||||
)
|
||||
|
||||
var (
|
||||
localSchemeBuilder runtime.SchemeBuilder
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// V1Beta1ServerWrapper implements the [NodeServer] interface by wrapping a [v1beta1.DRAPluginServer].
|
||||
type V1Beta1ServerWrapper struct {
|
||||
v1beta1.DRAPluginServer
|
||||
}
|
||||
|
||||
var _ NodeServer = V1Beta1ServerWrapper{}
|
||||
|
||||
func (w V1Beta1ServerWrapper) NodePrepareResources(ctx context.Context, req *NodePrepareResourcesRequest) (*NodePrepareResourcesResponse, error) {
|
||||
var convertedReq v1beta1.NodePrepareResourcesRequest
|
||||
if err := Convert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
resp, err := w.DRAPluginServer.NodePrepareResources(ctx, &convertedReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp NodePrepareResourcesResponse
|
||||
if err := Convert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
func (w V1Beta1ServerWrapper) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest) (*NodeUnprepareResourcesResponse, error) {
|
||||
var convertedReq v1beta1.NodeUnprepareResourcesRequest
|
||||
if err := Convert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
resp, err := w.DRAPluginServer.NodeUnprepareResources(ctx, &convertedReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp NodeUnprepareResourcesResponse
|
||||
if err := Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
// V1Alpha4ServerWrapper implements the [v1beta1.DRAPluginServer] interface by wrapping a [NodeServer].
|
||||
type V1Alpha4ServerWrapper struct {
|
||||
NodeServer
|
||||
}
|
||||
|
||||
var _ v1beta1.DRAPluginServer = V1Alpha4ServerWrapper{}
|
||||
|
||||
func (w V1Alpha4ServerWrapper) NodePrepareResources(ctx context.Context, req *v1beta1.NodePrepareResourcesRequest) (*v1beta1.NodePrepareResourcesResponse, error) {
|
||||
var convertedReq NodePrepareResourcesRequest
|
||||
if err := Convert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
resp, err := w.NodeServer.NodePrepareResources(ctx, &convertedReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp v1beta1.NodePrepareResourcesResponse
|
||||
if err := Convert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
func (w V1Alpha4ServerWrapper) NodeUnprepareResources(ctx context.Context, req *v1beta1.NodeUnprepareResourcesRequest) (*v1beta1.NodeUnprepareResourcesResponse, error) {
|
||||
var convertedReq NodeUnprepareResourcesRequest
|
||||
if err := Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
resp, err := w.NodeServer.NodeUnprepareResources(ctx, &convertedReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp v1beta1.NodeUnprepareResourcesResponse
|
||||
if err := Convert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
// V1Beta1ClientWrapper implements the [NodeClient] interface by wrapping a [v1beta1.DRAPluginClient].
|
||||
type V1Beta1ClientWrapper struct {
|
||||
v1beta1.DRAPluginClient
|
||||
}
|
||||
|
||||
var _ NodeClient = V1Beta1ClientWrapper{}
|
||||
|
||||
func (w V1Beta1ClientWrapper) NodePrepareResources(ctx context.Context, req *NodePrepareResourcesRequest, options ...grpc.CallOption) (*NodePrepareResourcesResponse, error) {
|
||||
var convertedReq v1beta1.NodePrepareResourcesRequest
|
||||
if err := Convert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
resp, err := w.DRAPluginClient.NodePrepareResources(ctx, &convertedReq, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp NodePrepareResourcesResponse
|
||||
if err := Convert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
func (w V1Beta1ClientWrapper) NodeUnprepareResources(ctx context.Context, req *NodeUnprepareResourcesRequest, options ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) {
|
||||
var convertedReq v1beta1.NodeUnprepareResourcesRequest
|
||||
if err := Convert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
resp, err := w.DRAPluginClient.NodeUnprepareResources(ctx, &convertedReq, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp NodeUnprepareResourcesResponse
|
||||
if err := Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
// V1Alpha4ClientWrapper implements the [v1beta1.DRAPluginClient] interface by wrapping a [NodeClient].
|
||||
type V1Alpha4ClientWrapper struct {
|
||||
NodeClient
|
||||
}
|
||||
|
||||
var _ v1beta1.DRAPluginClient = V1Alpha4ClientWrapper{}
|
||||
|
||||
func (w V1Alpha4ClientWrapper) NodePrepareResources(ctx context.Context, req *v1beta1.NodePrepareResourcesRequest, options ...grpc.CallOption) (*v1beta1.NodePrepareResourcesResponse, error) {
|
||||
var convertedReq NodePrepareResourcesRequest
|
||||
if err := Convert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesRequest from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
resp, err := w.NodeClient.NodePrepareResources(ctx, &convertedReq, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp v1beta1.NodePrepareResourcesResponse
|
||||
if err := Convert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodePrepareResourcesResponse from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
||||
|
||||
func (w V1Alpha4ClientWrapper) NodeUnprepareResources(ctx context.Context, req *v1beta1.NodeUnprepareResourcesRequest, options ...grpc.CallOption) (*v1beta1.NodeUnprepareResourcesResponse, error) {
|
||||
var convertedReq NodeUnprepareResourcesRequest
|
||||
if err := Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(req, &convertedReq, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesRequest from v1beta1 to v1alpha4: %w", err)
|
||||
}
|
||||
resp, err := w.NodeClient.NodeUnprepareResources(ctx, &convertedReq, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var convertedResp v1beta1.NodeUnprepareResourcesResponse
|
||||
if err := Convert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(resp, &convertedResp, nil); err != nil {
|
||||
return nil, fmt.Errorf("internal error converting NodeUnprepareResourcesResponse from v1alpha4 to v1beta1: %w", err)
|
||||
}
|
||||
return &convertedResp, nil
|
||||
}
|
21
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/doc.go
Normal file
21
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/doc.go
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2024 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1alpha4 contains a legacy implementation of the DRA gRPC
|
||||
// interface. Support for it in kubelet is provided via conversion.
|
||||
//
|
||||
// +k8s:conversion-gen=k8s.io/kubelet/pkg/apis/dra/v1beta1
|
||||
package v1alpha4
|
324
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/zz_generated.conversion.go
generated
Normal file
324
staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha4/zz_generated.conversion.go
generated
Normal file
@ -0,0 +1,324 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha4
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1beta1 "k8s.io/kubelet/pkg/apis/dra/v1beta1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*Claim)(nil), (*v1beta1.Claim)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_Claim_To_v1beta1_Claim(a.(*Claim), b.(*v1beta1.Claim), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.Claim)(nil), (*Claim)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Claim_To_v1alpha4_Claim(a.(*v1beta1.Claim), b.(*Claim), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*Device)(nil), (*v1beta1.Device)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_Device_To_v1beta1_Device(a.(*Device), b.(*v1beta1.Device), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.Device)(nil), (*Device)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_Device_To_v1alpha4_Device(a.(*v1beta1.Device), b.(*Device), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodePrepareResourceResponse)(nil), (*v1beta1.NodePrepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(a.(*NodePrepareResourceResponse), b.(*v1beta1.NodePrepareResourceResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodePrepareResourceResponse)(nil), (*NodePrepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodePrepareResourceResponse_To_v1alpha4_NodePrepareResourceResponse(a.(*v1beta1.NodePrepareResourceResponse), b.(*NodePrepareResourceResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodePrepareResourcesRequest)(nil), (*v1beta1.NodePrepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(a.(*NodePrepareResourcesRequest), b.(*v1beta1.NodePrepareResourcesRequest), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodePrepareResourcesRequest)(nil), (*NodePrepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(a.(*v1beta1.NodePrepareResourcesRequest), b.(*NodePrepareResourcesRequest), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodePrepareResourcesResponse)(nil), (*v1beta1.NodePrepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(a.(*NodePrepareResourcesResponse), b.(*v1beta1.NodePrepareResourcesResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodePrepareResourcesResponse)(nil), (*NodePrepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(a.(*v1beta1.NodePrepareResourcesResponse), b.(*NodePrepareResourcesResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourceResponse)(nil), (*v1beta1.NodeUnprepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(a.(*NodeUnprepareResourceResponse), b.(*v1beta1.NodeUnprepareResourceResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodeUnprepareResourceResponse)(nil), (*NodeUnprepareResourceResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodeUnprepareResourceResponse_To_v1alpha4_NodeUnprepareResourceResponse(a.(*v1beta1.NodeUnprepareResourceResponse), b.(*NodeUnprepareResourceResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourcesRequest)(nil), (*v1beta1.NodeUnprepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(a.(*NodeUnprepareResourcesRequest), b.(*v1beta1.NodeUnprepareResourcesRequest), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodeUnprepareResourcesRequest)(nil), (*NodeUnprepareResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(a.(*v1beta1.NodeUnprepareResourcesRequest), b.(*NodeUnprepareResourcesRequest), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*NodeUnprepareResourcesResponse)(nil), (*v1beta1.NodeUnprepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(a.(*NodeUnprepareResourcesResponse), b.(*v1beta1.NodeUnprepareResourcesResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.NodeUnprepareResourcesResponse)(nil), (*NodeUnprepareResourcesResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(a.(*v1beta1.NodeUnprepareResourcesResponse), b.(*NodeUnprepareResourcesResponse), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_Claim_To_v1beta1_Claim(in *Claim, out *v1beta1.Claim, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
out.UID = in.UID
|
||||
out.Name = in.Name
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_Claim_To_v1beta1_Claim is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_Claim_To_v1beta1_Claim(in *Claim, out *v1beta1.Claim, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_Claim_To_v1beta1_Claim(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Claim_To_v1alpha4_Claim(in *v1beta1.Claim, out *Claim, s conversion.Scope) error {
|
||||
out.Namespace = in.Namespace
|
||||
out.UID = in.UID
|
||||
out.Name = in.Name
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Claim_To_v1alpha4_Claim is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Claim_To_v1alpha4_Claim(in *v1beta1.Claim, out *Claim, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Claim_To_v1alpha4_Claim(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_Device_To_v1beta1_Device(in *Device, out *v1beta1.Device, s conversion.Scope) error {
|
||||
out.RequestNames = *(*[]string)(unsafe.Pointer(&in.RequestNames))
|
||||
out.PoolName = in.PoolName
|
||||
out.DeviceName = in.DeviceName
|
||||
out.CDIDeviceIDs = *(*[]string)(unsafe.Pointer(&in.CDIDeviceIDs))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_Device_To_v1beta1_Device is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_Device_To_v1beta1_Device(in *Device, out *v1beta1.Device, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_Device_To_v1beta1_Device(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Device_To_v1alpha4_Device(in *v1beta1.Device, out *Device, s conversion.Scope) error {
|
||||
out.RequestNames = *(*[]string)(unsafe.Pointer(&in.RequestNames))
|
||||
out.PoolName = in.PoolName
|
||||
out.DeviceName = in.DeviceName
|
||||
out.CDIDeviceIDs = *(*[]string)(unsafe.Pointer(&in.CDIDeviceIDs))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Device_To_v1alpha4_Device is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Device_To_v1alpha4_Device(in *v1beta1.Device, out *Device, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Device_To_v1alpha4_Device(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in *NodePrepareResourceResponse, out *v1beta1.NodePrepareResourceResponse, s conversion.Scope) error {
|
||||
out.Devices = *(*[]*v1beta1.Device)(unsafe.Pointer(&in.Devices))
|
||||
out.Error = in.Error
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in *NodePrepareResourceResponse, out *v1beta1.NodePrepareResourceResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodePrepareResourceResponse_To_v1beta1_NodePrepareResourceResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodePrepareResourceResponse_To_v1alpha4_NodePrepareResourceResponse(in *v1beta1.NodePrepareResourceResponse, out *NodePrepareResourceResponse, s conversion.Scope) error {
|
||||
out.Devices = *(*[]*Device)(unsafe.Pointer(&in.Devices))
|
||||
out.Error = in.Error
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodePrepareResourceResponse_To_v1alpha4_NodePrepareResourceResponse is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodePrepareResourceResponse_To_v1alpha4_NodePrepareResourceResponse(in *v1beta1.NodePrepareResourceResponse, out *NodePrepareResourceResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodePrepareResourceResponse_To_v1alpha4_NodePrepareResourceResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in *NodePrepareResourcesRequest, out *v1beta1.NodePrepareResourcesRequest, s conversion.Scope) error {
|
||||
out.Claims = *(*[]*v1beta1.Claim)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in *NodePrepareResourcesRequest, out *v1beta1.NodePrepareResourcesRequest, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodePrepareResourcesRequest_To_v1beta1_NodePrepareResourcesRequest(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(in *v1beta1.NodePrepareResourcesRequest, out *NodePrepareResourcesRequest, s conversion.Scope) error {
|
||||
out.Claims = *(*[]*Claim)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(in *v1beta1.NodePrepareResourcesRequest, out *NodePrepareResourcesRequest, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodePrepareResourcesRequest_To_v1alpha4_NodePrepareResourcesRequest(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in *NodePrepareResourcesResponse, out *v1beta1.NodePrepareResourcesResponse, s conversion.Scope) error {
|
||||
out.Claims = *(*map[string]*v1beta1.NodePrepareResourceResponse)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in *NodePrepareResourcesResponse, out *v1beta1.NodePrepareResourcesResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodePrepareResourcesResponse_To_v1beta1_NodePrepareResourcesResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(in *v1beta1.NodePrepareResourcesResponse, out *NodePrepareResourcesResponse, s conversion.Scope) error {
|
||||
out.Claims = *(*map[string]*NodePrepareResourceResponse)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(in *v1beta1.NodePrepareResourcesResponse, out *NodePrepareResourcesResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodePrepareResourcesResponse_To_v1alpha4_NodePrepareResourcesResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in *NodeUnprepareResourceResponse, out *v1beta1.NodeUnprepareResourceResponse, s conversion.Scope) error {
|
||||
out.Error = in.Error
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in *NodeUnprepareResourceResponse, out *v1beta1.NodeUnprepareResourceResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodeUnprepareResourceResponse_To_v1beta1_NodeUnprepareResourceResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodeUnprepareResourceResponse_To_v1alpha4_NodeUnprepareResourceResponse(in *v1beta1.NodeUnprepareResourceResponse, out *NodeUnprepareResourceResponse, s conversion.Scope) error {
|
||||
out.Error = in.Error
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodeUnprepareResourceResponse_To_v1alpha4_NodeUnprepareResourceResponse is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodeUnprepareResourceResponse_To_v1alpha4_NodeUnprepareResourceResponse(in *v1beta1.NodeUnprepareResourceResponse, out *NodeUnprepareResourceResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodeUnprepareResourceResponse_To_v1alpha4_NodeUnprepareResourceResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in *NodeUnprepareResourcesRequest, out *v1beta1.NodeUnprepareResourcesRequest, s conversion.Scope) error {
|
||||
out.Claims = *(*[]*v1beta1.Claim)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in *NodeUnprepareResourcesRequest, out *v1beta1.NodeUnprepareResourcesRequest, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodeUnprepareResourcesRequest_To_v1beta1_NodeUnprepareResourcesRequest(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(in *v1beta1.NodeUnprepareResourcesRequest, out *NodeUnprepareResourcesRequest, s conversion.Scope) error {
|
||||
out.Claims = *(*[]*Claim)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(in *v1beta1.NodeUnprepareResourcesRequest, out *NodeUnprepareResourcesRequest, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodeUnprepareResourcesRequest_To_v1alpha4_NodeUnprepareResourcesRequest(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in *NodeUnprepareResourcesResponse, out *v1beta1.NodeUnprepareResourcesResponse, s conversion.Scope) error {
|
||||
out.Claims = *(*map[string]*v1beta1.NodeUnprepareResourceResponse)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse is an autogenerated conversion function.
|
||||
func Convert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in *NodeUnprepareResourcesResponse, out *v1beta1.NodeUnprepareResourcesResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha4_NodeUnprepareResourcesResponse_To_v1beta1_NodeUnprepareResourcesResponse(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(in *v1beta1.NodeUnprepareResourcesResponse, out *NodeUnprepareResourcesResponse, s conversion.Scope) error {
|
||||
out.Claims = *(*map[string]*NodeUnprepareResourceResponse)(unsafe.Pointer(&in.Claims))
|
||||
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
|
||||
out.XXX_sizecache = in.XXX_sizecache
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse is an autogenerated conversion function.
|
||||
func Convert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(in *v1beta1.NodeUnprepareResourcesResponse, out *NodeUnprepareResourcesResponse, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_NodeUnprepareResourcesResponse_To_v1alpha4_NodeUnprepareResourcesResponse(in, out, s)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,6 @@ package v1beta1;
|
||||
option go_package = "k8s.io/kubelet/pkg/apis/dra/v1beta1";
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
import "k8s.io/kubelet/pkg/apis/dra/v1alpha4/api.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
@ -32,19 +31,87 @@ option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.goproto_unrecognized_all) = false;
|
||||
|
||||
// The v1beta1 DRAPlugin service has the exact same methods as the Node
|
||||
// service in the previous alpha, so gRPC serves can provide both
|
||||
// services with the same implementation.
|
||||
service DRAPlugin {
|
||||
// NodePrepareResources prepares several ResourceClaims
|
||||
// for use on the node. If an error is returned, the
|
||||
// response is ignored. Failures for individual claims
|
||||
// can be reported inside NodePrepareResourcesResponse.
|
||||
rpc NodePrepareResources (v1alpha3.NodePrepareResourcesRequest)
|
||||
returns (v1alpha3.NodePrepareResourcesResponse) {}
|
||||
rpc NodePrepareResources (NodePrepareResourcesRequest)
|
||||
returns (NodePrepareResourcesResponse) {}
|
||||
|
||||
// NodeUnprepareResources is the opposite of NodePrepareResources.
|
||||
// The same error handling rules apply,
|
||||
rpc NodeUnprepareResources (v1alpha3.NodeUnprepareResourcesRequest)
|
||||
returns (v1alpha3.NodeUnprepareResourcesResponse) {}
|
||||
rpc NodeUnprepareResources (NodeUnprepareResourcesRequest)
|
||||
returns (NodeUnprepareResourcesResponse) {}
|
||||
}
|
||||
|
||||
message NodePrepareResourcesRequest {
|
||||
// The list of ResourceClaims that are to be prepared.
|
||||
repeated Claim claims = 1;
|
||||
}
|
||||
|
||||
message NodePrepareResourcesResponse {
|
||||
// The ResourceClaims for which preparation was done
|
||||
// or attempted, with claim_uid as key.
|
||||
//
|
||||
// It is an error if some claim listed in NodePrepareResourcesRequest
|
||||
// does not get prepared. NodePrepareResources
|
||||
// will be called again for those that are missing.
|
||||
map<string, NodePrepareResourceResponse> claims = 1;
|
||||
}
|
||||
|
||||
message NodePrepareResourceResponse {
|
||||
// These are the additional devices that kubelet must
|
||||
// make available via the container runtime. A claim
|
||||
// may have zero or more requests and each request
|
||||
// may have zero or more devices.
|
||||
repeated Device devices = 1;
|
||||
// If non-empty, preparing the ResourceClaim failed.
|
||||
// Devices are ignored in that case.
|
||||
string error = 2;
|
||||
}
|
||||
|
||||
message Device {
|
||||
// The requests in the claim that this device is associated with.
|
||||
// Optional. If empty, the device is associated with all requests.
|
||||
repeated string request_names = 1;
|
||||
|
||||
// The pool which contains the device. Required.
|
||||
string pool_name = 2;
|
||||
|
||||
// The device itself. Required.
|
||||
string device_name = 3;
|
||||
|
||||
// A single device instance may map to several CDI device IDs.
|
||||
// None is also valid.
|
||||
repeated string cdi_device_ids = 4 [(gogoproto.customname) = "CDIDeviceIDs"];
|
||||
}
|
||||
|
||||
message NodeUnprepareResourcesRequest {
|
||||
// The list of ResourceClaims that are to be unprepared.
|
||||
repeated Claim claims = 1;
|
||||
}
|
||||
|
||||
message NodeUnprepareResourcesResponse {
|
||||
// The ResourceClaims for which preparation was reverted.
|
||||
// The same rules as for NodePrepareResourcesResponse.claims
|
||||
// apply.
|
||||
map<string, NodeUnprepareResourceResponse> claims = 1;
|
||||
}
|
||||
|
||||
message NodeUnprepareResourceResponse {
|
||||
// If non-empty, unpreparing the ResourceClaim failed.
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message Claim {
|
||||
// The ResourceClaim namespace (ResourceClaim.meta.Namespace).
|
||||
// This field is REQUIRED.
|
||||
string namespace = 1;
|
||||
// The UID of the Resource claim (ResourceClaim.meta.UUID).
|
||||
// This field is REQUIRED.
|
||||
string uid = 2 [(gogoproto.customname) = "UID"];
|
||||
// The name of the Resource claim (ResourceClaim.meta.Name)
|
||||
// This field is REQUIRED.
|
||||
string name = 3;
|
||||
}
|
||||
|
@ -14,35 +14,11 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1beta1 has the same Go API as v1alpha4. A DRA driver implementing
|
||||
// [v1beta1.DRAPluginServer] also implements [v1alpha4.NodeServer] and vice versa.
|
||||
//
|
||||
// The [k8s.io/dynamic-resource-allocation/kubeletplugin] helper will
|
||||
// automatically register both API versions unless explicitly configured
|
||||
// otherwise.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"k8s.io/kubelet/pkg/apis/dra/v1alpha4"
|
||||
)
|
||||
|
||||
type (
|
||||
NodePrepareResourcesRequest = v1alpha4.NodePrepareResourcesRequest
|
||||
NodePrepareResourcesResponse = v1alpha4.NodePrepareResourcesResponse
|
||||
NodePrepareResourceResponse = v1alpha4.NodePrepareResourceResponse
|
||||
NodeUnprepareResourcesRequest = v1alpha4.NodeUnprepareResourcesRequest
|
||||
NodeUnprepareResourcesResponse = v1alpha4.NodeUnprepareResourcesResponse
|
||||
NodeUnprepareResourceResponse = v1alpha4.NodeUnprepareResourceResponse
|
||||
Device = v1alpha4.Device
|
||||
Claim = v1alpha4.Claim
|
||||
)
|
||||
|
||||
const (
|
||||
// DRAPluginService needs to be listed in the "supported versions"
|
||||
// array during plugin registration by a DRA plugin which provides
|
||||
// an implementation of the v1beta1 DRAPlugin service.
|
||||
DRAPluginService = "v1beta1.DRAPlugin"
|
||||
)
|
||||
|
||||
// Ensure that the interfaces are equivalent.
|
||||
var _ DRAPluginServer = v1alpha4.NodeServer(nil)
|
||||
|
@ -39,6 +39,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/dynamic-resource-allocation/kubeletplugin"
|
||||
"k8s.io/klog/v2"
|
||||
drapbv1alpha4 "k8s.io/kubelet/pkg/apis/dra/v1alpha4"
|
||||
drapb "k8s.io/kubelet/pkg/apis/dra/v1beta1"
|
||||
)
|
||||
|
||||
@ -165,7 +166,15 @@ func StartPlugin(ctx context.Context, cdiDir, driverName string, kubeClient kube
|
||||
kubeletplugin.GRPCInterceptor(ex.recordGRPCCall),
|
||||
kubeletplugin.GRPCStreamInterceptor(ex.recordGRPCStream),
|
||||
)
|
||||
d, err := kubeletplugin.Start(ctx, ex, opts...)
|
||||
// Both APIs get provided, the legacy one via wrapping. The options
|
||||
// determine which one(s) really get served (by default, both).
|
||||
// The options are a bit redundant now because a single instance cannot
|
||||
// implement both, but that might be different in the future.
|
||||
nodeServers := []any{
|
||||
drapb.DRAPluginServer(ex), // Casting is done only for clarity here, it's not needed.
|
||||
drapbv1alpha4.V1Beta1ServerWrapper{DRAPluginServer: ex},
|
||||
}
|
||||
d, err := kubeletplugin.Start(ctx, nodeServers, opts...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("start kubelet plugin: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user