mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
DRA kubelet: rename gRPC server from Node to DRAPlugin in v1beta1
The version bump is an opportunity to pick a name that is a bit more descriptive. It matches the "DevicePlugin" service name.
This commit is contained in:
parent
63a7865736
commit
437be1e651
@ -52,7 +52,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type fakeDRADriverGRPCServer struct {
|
type fakeDRADriverGRPCServer struct {
|
||||||
drapb.UnimplementedNodeServer
|
drapb.UnimplementedDRAPluginServer
|
||||||
driverName string
|
driverName string
|
||||||
timeout *time.Duration
|
timeout *time.Duration
|
||||||
prepareResourceCalls atomic.Uint32
|
prepareResourceCalls atomic.Uint32
|
||||||
@ -161,7 +161,7 @@ func setupFakeDRADriverGRPCServer(ctx context.Context, shouldTimeout bool, plugi
|
|||||||
fakeDRADriverGRPCServer.timeout = &timeout
|
fakeDRADriverGRPCServer.timeout = &timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
drapb.RegisterNodeServer(s, fakeDRADriverGRPCServer)
|
drapb.RegisterDRAPluginServer(s, fakeDRADriverGRPCServer)
|
||||||
|
|
||||||
go func(ctx context.Context) {
|
go func(ctx context.Context) {
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -134,7 +134,7 @@ func (p *Plugin) NodePrepareResources(
|
|||||||
var response *drapbv1beta1.NodePrepareResourcesResponse
|
var response *drapbv1beta1.NodePrepareResourcesResponse
|
||||||
switch supportedAPI {
|
switch supportedAPI {
|
||||||
case apiV1beta1:
|
case apiV1beta1:
|
||||||
nodeClient := drapbv1beta1.NewNodeClient(conn)
|
nodeClient := drapbv1beta1.NewDRAPluginClient(conn)
|
||||||
response, err = nodeClient.NodePrepareResources(ctx, req)
|
response, err = nodeClient.NodePrepareResources(ctx, req)
|
||||||
case apiV1alpha4:
|
case apiV1alpha4:
|
||||||
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
||||||
@ -142,7 +142,7 @@ func (p *Plugin) NodePrepareResources(
|
|||||||
default:
|
default:
|
||||||
// Try it, fall back if necessary.
|
// Try it, fall back if necessary.
|
||||||
supportedAPI = apiV1beta1
|
supportedAPI = apiV1beta1
|
||||||
nodeClient := drapbv1beta1.NewNodeClient(conn)
|
nodeClient := drapbv1beta1.NewDRAPluginClient(conn)
|
||||||
response, err = nodeClient.NodePrepareResources(ctx, req)
|
response, err = nodeClient.NodePrepareResources(ctx, req)
|
||||||
if err != nil && status.Convert(err).Code() == codes.Unimplemented {
|
if err != nil && status.Convert(err).Code() == codes.Unimplemented {
|
||||||
supportedAPI = apiV1alpha4
|
supportedAPI = apiV1alpha4
|
||||||
@ -179,7 +179,7 @@ func (p *Plugin) NodeUnprepareResources(
|
|||||||
var response *drapbv1beta1.NodeUnprepareResourcesResponse
|
var response *drapbv1beta1.NodeUnprepareResourcesResponse
|
||||||
switch supportedAPI {
|
switch supportedAPI {
|
||||||
case apiV1beta1:
|
case apiV1beta1:
|
||||||
nodeClient := drapbv1beta1.NewNodeClient(conn)
|
nodeClient := drapbv1beta1.NewDRAPluginClient(conn)
|
||||||
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
||||||
case apiV1alpha4:
|
case apiV1alpha4:
|
||||||
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
nodeClient := drapbv1alpha4.NewNodeClient(conn)
|
||||||
@ -187,7 +187,7 @@ func (p *Plugin) NodeUnprepareResources(
|
|||||||
default:
|
default:
|
||||||
// Try it, fall back if necessary.
|
// Try it, fall back if necessary.
|
||||||
supportedAPI = apiV1beta1
|
supportedAPI = apiV1beta1
|
||||||
nodeClient := drapbv1beta1.NewNodeClient(conn)
|
nodeClient := drapbv1beta1.NewDRAPluginClient(conn)
|
||||||
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
response, err = nodeClient.NodeUnprepareResources(ctx, req)
|
||||||
if err != nil && status.Convert(err).Code() == codes.Unimplemented {
|
if err != nil && status.Convert(err).Code() == codes.Unimplemented {
|
||||||
supportedAPI = apiV1alpha4
|
supportedAPI = apiV1alpha4
|
||||||
|
@ -36,10 +36,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type fakeV1alpha4GRPCServer struct {
|
type fakeV1alpha4GRPCServer struct {
|
||||||
drapb.UnimplementedNodeServer
|
drapb.UnimplementedDRAPluginServer
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ drapb.NodeServer = &fakeV1alpha4GRPCServer{}
|
var _ drapb.DRAPluginServer = &fakeV1alpha4GRPCServer{}
|
||||||
|
|
||||||
func (f *fakeV1alpha4GRPCServer) NodePrepareResources(ctx context.Context, in *drapb.NodePrepareResourcesRequest) (*drapb.NodePrepareResourcesResponse, error) {
|
func (f *fakeV1alpha4GRPCServer) NodePrepareResources(ctx context.Context, in *drapb.NodePrepareResourcesRequest) (*drapb.NodePrepareResourcesResponse, error) {
|
||||||
return &drapb.NodePrepareResourcesResponse{Claims: map[string]*drapb.NodePrepareResourceResponse{"claim-uid": {
|
return &drapb.NodePrepareResourcesResponse{Claims: map[string]*drapb.NodePrepareResourceResponse{"claim-uid": {
|
||||||
@ -84,7 +84,7 @@ func setupFakeGRPCServer(version string) (string, tearDown, error) {
|
|||||||
switch version {
|
switch version {
|
||||||
case v1alpha4Version:
|
case v1alpha4Version:
|
||||||
fakeGRPCServer := &fakeV1alpha4GRPCServer{}
|
fakeGRPCServer := &fakeV1alpha4GRPCServer{}
|
||||||
drapb.RegisterNodeServer(s, fakeGRPCServer)
|
drapb.RegisterDRAPluginServer(s, fakeGRPCServer)
|
||||||
default:
|
default:
|
||||||
return "", nil, fmt.Errorf("unsupported version: %s", version)
|
return "", nil, fmt.Errorf("unsupported version: %s", version)
|
||||||
}
|
}
|
||||||
|
@ -333,13 +333,13 @@ func Start(ctx context.Context, nodeServer interface{}, opts ...Option) (result
|
|||||||
implemented := false
|
implemented := false
|
||||||
plugin, err := startGRPCServer(klog.NewContext(ctx, klog.LoggerWithName(logger, "dra")), o.grpcVerbosity, o.unaryInterceptors, o.streamInterceptors, o.draEndpoint, func(grpcServer *grpc.Server) {
|
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 {
|
if nodeServer, ok := nodeServer.(drapbv1alpha4.NodeServer); ok && o.nodeV1alpha4 {
|
||||||
logger.V(5).Info("registering drapbv1alpha4.NodeServer")
|
logger.V(5).Info("registering v1alpha4.Node gGRPC service")
|
||||||
drapbv1alpha4.RegisterNodeServer(grpcServer, nodeServer)
|
drapbv1alpha4.RegisterNodeServer(grpcServer, nodeServer)
|
||||||
implemented = true
|
implemented = true
|
||||||
}
|
}
|
||||||
if nodeServer, ok := nodeServer.(drapbv1beta1.NodeServer); ok && o.nodeV1beta1 {
|
if nodeServer, ok := nodeServer.(drapbv1beta1.DRAPluginServer); ok && o.nodeV1beta1 {
|
||||||
logger.V(5).Info("registering drapbv1beta1.NodeServer")
|
logger.V(5).Info("registering v1beta1.DRAPlugin gRPC service")
|
||||||
drapbv1beta1.RegisterNodeServer(grpcServer, nodeServer)
|
drapbv1beta1.RegisterDRAPluginServer(grpcServer, nodeServer)
|
||||||
implemented = true
|
implemented = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -45,23 +45,23 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|||||||
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
|
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
|
||||||
|
|
||||||
var fileDescriptor_00212fb1f9d3bf1c = []byte{
|
var fileDescriptor_00212fb1f9d3bf1c = []byte{
|
||||||
// 243 bytes of a gzipped FileDescriptorProto
|
// 250 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0x2c, 0xc8, 0xd4,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0x2c, 0xc8, 0xd4,
|
||||||
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0x94, 0xd2,
|
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0x94, 0xd2,
|
||||||
0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7,
|
0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7,
|
||||||
0x07, 0xcb, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0x27, 0xa5, 0x97, 0x6d,
|
0x07, 0xcb, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0x27, 0xa5, 0x97, 0x6d,
|
||||||
0x51, 0xac, 0x97, 0x99, 0xaf, 0x9f, 0x5d, 0x9a, 0x94, 0x9a, 0x93, 0x5a, 0xa2, 0x5f, 0x90, 0x9d,
|
0x51, 0xac, 0x97, 0x99, 0xaf, 0x9f, 0x5d, 0x9a, 0x94, 0x9a, 0x93, 0x5a, 0xa2, 0x5f, 0x90, 0x9d,
|
||||||
0xae, 0x9f, 0x58, 0x90, 0x59, 0xac, 0x9f, 0x52, 0x94, 0xa8, 0x5f, 0x66, 0x98, 0x98, 0x53, 0x90,
|
0xae, 0x9f, 0x58, 0x90, 0x59, 0xac, 0x9f, 0x52, 0x94, 0xa8, 0x5f, 0x66, 0x98, 0x98, 0x53, 0x90,
|
||||||
0x91, 0x68, 0xa2, 0x0f, 0xb7, 0xc7, 0xe8, 0x1e, 0x23, 0x17, 0x8b, 0x5f, 0x7e, 0x4a, 0xaa, 0x50,
|
0x91, 0x68, 0xa2, 0x0f, 0xb7, 0xc7, 0xe8, 0x31, 0x23, 0x17, 0xa7, 0x4b, 0x90, 0x63, 0x40, 0x4e,
|
||||||
0x3a, 0x97, 0x08, 0x88, 0x0e, 0x28, 0x4a, 0x2d, 0x48, 0x2c, 0x4a, 0x0d, 0x4a, 0x2d, 0xce, 0x2f,
|
0x69, 0x7a, 0x66, 0x9e, 0x50, 0x3a, 0x97, 0x88, 0x5f, 0x7e, 0x4a, 0x6a, 0x40, 0x51, 0x6a, 0x41,
|
||||||
0x2d, 0x4a, 0x4e, 0x2d, 0x16, 0x52, 0xd5, 0x83, 0xea, 0x32, 0xd6, 0xc3, 0x26, 0x1f, 0x94, 0x5a,
|
0x62, 0x51, 0x6a, 0x50, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0xb1, 0x90, 0xaa, 0x1e, 0x54,
|
||||||
0x58, 0x9a, 0x5a, 0x5c, 0x22, 0xa5, 0x46, 0x48, 0x59, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x12,
|
0xab, 0xb1, 0x1e, 0x36, 0xf9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x29, 0x35, 0x42, 0xca,
|
||||||
0x83, 0x50, 0x2e, 0x97, 0x18, 0x48, 0x45, 0x68, 0x5e, 0x01, 0xba, 0x55, 0xea, 0xa8, 0x66, 0x60,
|
0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x95, 0x18, 0x84, 0x72, 0xb9, 0xc4, 0x40, 0x2a, 0x42, 0xf3,
|
||||||
0xaa, 0x80, 0x59, 0xa6, 0x41, 0x58, 0x21, 0xcc, 0x3a, 0x27, 0xc7, 0x13, 0x0f, 0xe5, 0x18, 0x6f,
|
0x0a, 0xd0, 0xad, 0x52, 0x47, 0x35, 0x03, 0x53, 0x05, 0xcc, 0x32, 0x0d, 0xc2, 0x0a, 0x61, 0xd6,
|
||||||
0x3c, 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c,
|
0x39, 0x39, 0x9e, 0x78, 0x28, 0xc7, 0x78, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13,
|
||||||
0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x8c, 0x3f, 0xb8, 0xc0, 0x51, 0x90,
|
0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86,
|
||||||
0xc4, 0x06, 0x0e, 0x2a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0x45, 0x28, 0xd3, 0x9f,
|
0x28, 0x65, 0xfc, 0x61, 0x06, 0x8e, 0x87, 0x24, 0x36, 0x70, 0x78, 0x19, 0x03, 0x02, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x00,
|
0xff, 0xff, 0xfc, 0xcd, 0x40, 0xde, 0xa4, 0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -72,10 +72,10 @@ var _ grpc.ClientConn
|
|||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
const _ = grpc.SupportPackageIsVersion4
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
// NodeClient is the client API for Node service.
|
// DRAPluginClient is the client API for DRAPlugin service.
|
||||||
//
|
//
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
type NodeClient interface {
|
type DRAPluginClient interface {
|
||||||
// NodePrepareResources prepares several ResourceClaims
|
// NodePrepareResources prepares several ResourceClaims
|
||||||
// for use on the node. If an error is returned, the
|
// for use on the node. If an error is returned, the
|
||||||
// response is ignored. Failures for individual claims
|
// response is ignored. Failures for individual claims
|
||||||
@ -86,34 +86,34 @@ type NodeClient interface {
|
|||||||
NodeUnprepareResources(ctx context.Context, in *v1alpha4.NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodeUnprepareResourcesResponse, error)
|
NodeUnprepareResources(ctx context.Context, in *v1alpha4.NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodeUnprepareResourcesResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type nodeClient struct {
|
type dRAPluginClient struct {
|
||||||
cc *grpc.ClientConn
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNodeClient(cc *grpc.ClientConn) NodeClient {
|
func NewDRAPluginClient(cc *grpc.ClientConn) DRAPluginClient {
|
||||||
return &nodeClient{cc}
|
return &dRAPluginClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nodeClient) NodePrepareResources(ctx context.Context, in *v1alpha4.NodePrepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodePrepareResourcesResponse, error) {
|
func (c *dRAPluginClient) NodePrepareResources(ctx context.Context, in *v1alpha4.NodePrepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodePrepareResourcesResponse, error) {
|
||||||
out := new(v1alpha4.NodePrepareResourcesResponse)
|
out := new(v1alpha4.NodePrepareResourcesResponse)
|
||||||
err := c.cc.Invoke(ctx, "/v1beta1.Node/NodePrepareResources", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/v1beta1.DRAPlugin/NodePrepareResources", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nodeClient) NodeUnprepareResources(ctx context.Context, in *v1alpha4.NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodeUnprepareResourcesResponse, error) {
|
func (c *dRAPluginClient) NodeUnprepareResources(ctx context.Context, in *v1alpha4.NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*v1alpha4.NodeUnprepareResourcesResponse, error) {
|
||||||
out := new(v1alpha4.NodeUnprepareResourcesResponse)
|
out := new(v1alpha4.NodeUnprepareResourcesResponse)
|
||||||
err := c.cc.Invoke(ctx, "/v1beta1.Node/NodeUnprepareResources", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/v1beta1.DRAPlugin/NodeUnprepareResources", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeServer is the server API for Node service.
|
// DRAPluginServer is the server API for DRAPlugin service.
|
||||||
type NodeServer interface {
|
type DRAPluginServer interface {
|
||||||
// NodePrepareResources prepares several ResourceClaims
|
// NodePrepareResources prepares several ResourceClaims
|
||||||
// for use on the node. If an error is returned, the
|
// for use on the node. If an error is returned, the
|
||||||
// response is ignored. Failures for individual claims
|
// response is ignored. Failures for individual claims
|
||||||
@ -124,68 +124,68 @@ type NodeServer interface {
|
|||||||
NodeUnprepareResources(context.Context, *v1alpha4.NodeUnprepareResourcesRequest) (*v1alpha4.NodeUnprepareResourcesResponse, error)
|
NodeUnprepareResources(context.Context, *v1alpha4.NodeUnprepareResourcesRequest) (*v1alpha4.NodeUnprepareResourcesResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedNodeServer can be embedded to have forward compatible implementations.
|
// UnimplementedDRAPluginServer can be embedded to have forward compatible implementations.
|
||||||
type UnimplementedNodeServer struct {
|
type UnimplementedDRAPluginServer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*UnimplementedNodeServer) NodePrepareResources(ctx context.Context, req *v1alpha4.NodePrepareResourcesRequest) (*v1alpha4.NodePrepareResourcesResponse, error) {
|
func (*UnimplementedDRAPluginServer) NodePrepareResources(ctx context.Context, req *v1alpha4.NodePrepareResourcesRequest) (*v1alpha4.NodePrepareResourcesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodePrepareResources not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method NodePrepareResources not implemented")
|
||||||
}
|
}
|
||||||
func (*UnimplementedNodeServer) NodeUnprepareResources(ctx context.Context, req *v1alpha4.NodeUnprepareResourcesRequest) (*v1alpha4.NodeUnprepareResourcesResponse, error) {
|
func (*UnimplementedDRAPluginServer) NodeUnprepareResources(ctx context.Context, req *v1alpha4.NodeUnprepareResourcesRequest) (*v1alpha4.NodeUnprepareResourcesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeUnprepareResources not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method NodeUnprepareResources not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterNodeServer(s *grpc.Server, srv NodeServer) {
|
func RegisterDRAPluginServer(s *grpc.Server, srv DRAPluginServer) {
|
||||||
s.RegisterService(&_Node_serviceDesc, srv)
|
s.RegisterService(&_DRAPlugin_serviceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Node_NodePrepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _DRAPlugin_NodePrepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(v1alpha4.NodePrepareResourcesRequest)
|
in := new(v1alpha4.NodePrepareResourcesRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(NodeServer).NodePrepareResources(ctx, in)
|
return srv.(DRAPluginServer).NodePrepareResources(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/v1beta1.Node/NodePrepareResources",
|
FullMethod: "/v1beta1.DRAPlugin/NodePrepareResources",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(NodeServer).NodePrepareResources(ctx, req.(*v1alpha4.NodePrepareResourcesRequest))
|
return srv.(DRAPluginServer).NodePrepareResources(ctx, req.(*v1alpha4.NodePrepareResourcesRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Node_NodeUnprepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _DRAPlugin_NodeUnprepareResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(v1alpha4.NodeUnprepareResourcesRequest)
|
in := new(v1alpha4.NodeUnprepareResourcesRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
return srv.(NodeServer).NodeUnprepareResources(ctx, in)
|
return srv.(DRAPluginServer).NodeUnprepareResources(ctx, in)
|
||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/v1beta1.Node/NodeUnprepareResources",
|
FullMethod: "/v1beta1.DRAPlugin/NodeUnprepareResources",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(NodeServer).NodeUnprepareResources(ctx, req.(*v1alpha4.NodeUnprepareResourcesRequest))
|
return srv.(DRAPluginServer).NodeUnprepareResources(ctx, req.(*v1alpha4.NodeUnprepareResourcesRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _Node_serviceDesc = grpc.ServiceDesc{
|
var _DRAPlugin_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "v1beta1.Node",
|
ServiceName: "v1beta1.DRAPlugin",
|
||||||
HandlerType: (*NodeServer)(nil),
|
HandlerType: (*DRAPluginServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
MethodName: "NodePrepareResources",
|
MethodName: "NodePrepareResources",
|
||||||
Handler: _Node_NodePrepareResources_Handler,
|
Handler: _DRAPlugin_NodePrepareResources_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "NodeUnprepareResources",
|
MethodName: "NodeUnprepareResources",
|
||||||
Handler: _Node_NodeUnprepareResources_Handler,
|
Handler: _DRAPlugin_NodeUnprepareResources_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
|
@ -32,9 +32,10 @@ option (gogoproto.sizer_all) = true;
|
|||||||
option (gogoproto.unmarshaler_all) = true;
|
option (gogoproto.unmarshaler_all) = true;
|
||||||
option (gogoproto.goproto_unrecognized_all) = false;
|
option (gogoproto.goproto_unrecognized_all) = false;
|
||||||
|
|
||||||
// The v1beta1 Node service has the exact same methods as the previous alpha,
|
// The v1beta1 DRAPlugin service has the exact same methods as the Node
|
||||||
// so gRPC serves can provide both services with the same implementation.
|
// service in the previous alpha, so gRPC serves can provide both
|
||||||
service Node {
|
// services with the same implementation.
|
||||||
|
service DRAPlugin {
|
||||||
// NodePrepareResources prepares several ResourceClaims
|
// NodePrepareResources prepares several ResourceClaims
|
||||||
// for use on the node. If an error is returned, the
|
// for use on the node. If an error is returned, the
|
||||||
// response is ignored. Failures for individual claims
|
// response is ignored. Failures for individual claims
|
||||||
|
@ -37,4 +37,5 @@ type (
|
|||||||
Claim = v1alpha4.Claim
|
Claim = v1alpha4.Claim
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ NodeServer = v1alpha4.NodeServer(nil)
|
// Ensure that the interfaces are equivalent.
|
||||||
|
var _ DRAPluginServer = v1alpha4.NodeServer(nil)
|
||||||
|
@ -65,8 +65,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NodePrepareResourcesMethod = "/v1beta1.Node/NodePrepareResources"
|
NodePrepareResourcesMethod = "/v1beta1.DRAPlugin/NodePrepareResources"
|
||||||
NodeUnprepareResourcesMethod = "/v1beta1.Node/NodeUnprepareResources"
|
NodeUnprepareResourcesMethod = "/v1beta1.DRAPlugin/NodeUnprepareResources"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Nodes struct {
|
type Nodes struct {
|
||||||
|
@ -97,7 +97,7 @@ type Device struct {
|
|||||||
CDIDeviceID string
|
CDIDeviceID string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ drapb.NodeServer = &ExamplePlugin{}
|
var _ drapb.DRAPluginServer = &ExamplePlugin{}
|
||||||
|
|
||||||
// getJSONFilePath returns the absolute path where CDI file is/should be.
|
// getJSONFilePath returns the absolute path where CDI file is/should be.
|
||||||
func (ex *ExamplePlugin) getJSONFilePath(claimUID string, requestName string) string {
|
func (ex *ExamplePlugin) getJSONFilePath(claimUID string, requestName string) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user