DRA kubelet: use unique protobuf package name

As mentioned in https://protobuf.dev/programming-guides/style, package names
"should be unique". For generated API pb files, Kubernetes uses
"k8s.io.api.<api group>.<version>". The same approach is now used for the
kubelet DRA v1beta1 API. This can be changed without a breaking change because
the API is still unreleased.

This avoids a conflict between the DevicePlugin and the DRA API when both get
used by kubelet:

    2024/11/10 12:51:40 proto: duplicate proto type registered: v1beta1.Device

The exact impact of that conflict is unknown but it seems better to
pro-actively avoid the problem.
This commit is contained in:
Patrick Ohly 2024-11-12 17:22:05 +01:00
parent 6b031e50b2
commit 6c27e8dc8f
3 changed files with 56 additions and 55 deletions

View File

@ -485,58 +485,59 @@ func (m *Claim) GetName() string {
}
func init() {
proto.RegisterType((*NodePrepareResourcesRequest)(nil), "v1beta1.NodePrepareResourcesRequest")
proto.RegisterType((*NodePrepareResourcesResponse)(nil), "v1beta1.NodePrepareResourcesResponse")
proto.RegisterMapType((map[string]*NodePrepareResourceResponse)(nil), "v1beta1.NodePrepareResourcesResponse.ClaimsEntry")
proto.RegisterType((*NodePrepareResourceResponse)(nil), "v1beta1.NodePrepareResourceResponse")
proto.RegisterType((*Device)(nil), "v1beta1.Device")
proto.RegisterType((*NodeUnprepareResourcesRequest)(nil), "v1beta1.NodeUnprepareResourcesRequest")
proto.RegisterType((*NodeUnprepareResourcesResponse)(nil), "v1beta1.NodeUnprepareResourcesResponse")
proto.RegisterMapType((map[string]*NodeUnprepareResourceResponse)(nil), "v1beta1.NodeUnprepareResourcesResponse.ClaimsEntry")
proto.RegisterType((*NodeUnprepareResourceResponse)(nil), "v1beta1.NodeUnprepareResourceResponse")
proto.RegisterType((*Claim)(nil), "v1beta1.Claim")
proto.RegisterType((*NodePrepareResourcesRequest)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodePrepareResourcesRequest")
proto.RegisterType((*NodePrepareResourcesResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodePrepareResourcesResponse")
proto.RegisterMapType((map[string]*NodePrepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodePrepareResourcesResponse.ClaimsEntry")
proto.RegisterType((*NodePrepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodePrepareResourceResponse")
proto.RegisterType((*Device)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.Device")
proto.RegisterType((*NodeUnprepareResourcesRequest)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodeUnprepareResourcesRequest")
proto.RegisterType((*NodeUnprepareResourcesResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodeUnprepareResourcesResponse")
proto.RegisterMapType((map[string]*NodeUnprepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodeUnprepareResourcesResponse.ClaimsEntry")
proto.RegisterType((*NodeUnprepareResourceResponse)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.NodeUnprepareResourceResponse")
proto.RegisterType((*Claim)(nil), "k8s.io.kubelet.pkg.apis.dra.v1beta1.Claim")
}
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
var fileDescriptor_00212fb1f9d3bf1c = []byte{
// 566 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xce, 0x36, 0x4d, 0x82, 0x27, 0xa1, 0x54, 0xab, 0x0a, 0x85, 0xb4, 0x38, 0x91, 0x5b, 0x42,
0x38, 0x10, 0x2b, 0xa9, 0x40, 0x55, 0xc5, 0xa5, 0x69, 0x2a, 0x14, 0x21, 0x55, 0xd5, 0x8a, 0x5e,
0x38, 0x10, 0x39, 0xf6, 0x12, 0x56, 0xf9, 0x59, 0xe3, 0xb5, 0x23, 0xf5, 0xc6, 0x23, 0xf0, 0x0e,
0xbc, 0x4c, 0xc5, 0xa9, 0x47, 0x4e, 0x85, 0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0x59, 0x8e, 0x7c, 0x30, 0x67,
0xde, 0xd3, 0x41, 0x4c, 0xcd, 0x84, 0x66, 0xcd, 0xf4, 0x14, 0x56, 0xb9, 0x6a, 0xbc, 0x05, 0x0a,
0xb7, 0x50, 0x60, 0x3b, 0x44, 0xa6, 0xfc, 0x02, 0xf0, 0x2d, 0x28, 0xc4, 0xbe, 0x2b, 0xdc, 0x63,
0xae, 0x25, 0xe7, 0xb5, 0xc2, 0x51, 0xb7, 0x63, 0xa5, 0x18, 0xc6, 0xb0, 0x32, 0x63, 0x1d, 0xbe,
0x6e, 0x7e, 0xcd, 0x83, 0xd2, 0xb1, 0x5a, 0x87, 0x83, 0xd8, 0xf3, 0x47, 0xf8, 0x33, 0x82, 0x8d,
0xac, 0xdf, 0x1b, 0xef, 0x2d, 0x71, 0x33, 0x70, 0x13, 0x55, 0x5b, 0x4b, 0xdf, 0x2d, 0x5a, 0x0e,
0x9f, 0x22, 0xb8, 0x99, 0x7d, 0xe0, 0xd8, 0x5c, 0xca, 0x2d, 0x42, 0x63, 0xfb, 0x1f, 0x38, 0x4e,
0xcb, 0x99, 0xad, 0xb3, 0x0b, 0x15, 0x7d, 0xbb, 0x50, 0x73, 0xef, 0x13, 0x15, 0x9d, 0x25, 0x2a,
0xfa, 0x92, 0xa8, 0xe8, 0x7b, 0xa2, 0xa2, 0x4f, 0x3f, 0xd4, 0xdc, 0x0b, 0xf9, 0x98, 0x18, 0x92,
0xc3, 0x08, 0xfa, 0x9e, 0x91, 0x72, 0x18, 0x6e, 0x68, 0x1b, 0x92, 0xa3, 0x57, 0xe4, 0x8f, 0xc4,
0xfd, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xda, 0x25, 0x38, 0x7d, 0x85, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -571,7 +572,7 @@ func NewDRAPluginClient(cc *grpc.ClientConn) DRAPluginClient {
func (c *dRAPluginClient) NodePrepareResources(ctx context.Context, in *NodePrepareResourcesRequest, opts ...grpc.CallOption) (*NodePrepareResourcesResponse, error) {
out := new(NodePrepareResourcesResponse)
err := c.cc.Invoke(ctx, "/v1beta1.DRAPlugin/NodePrepareResources", in, out, opts...)
err := c.cc.Invoke(ctx, "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources", in, out, opts...)
if err != nil {
return nil, err
}
@ -580,7 +581,7 @@ func (c *dRAPluginClient) NodePrepareResources(ctx context.Context, in *NodePrep
func (c *dRAPluginClient) NodeUnprepareResources(ctx context.Context, in *NodeUnprepareResourcesRequest, opts ...grpc.CallOption) (*NodeUnprepareResourcesResponse, error) {
out := new(NodeUnprepareResourcesResponse)
err := c.cc.Invoke(ctx, "/v1beta1.DRAPlugin/NodeUnprepareResources", in, out, opts...)
err := c.cc.Invoke(ctx, "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodeUnprepareResources", in, out, opts...)
if err != nil {
return nil, err
}
@ -624,7 +625,7 @@ func _DRAPlugin_NodePrepareResources_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/v1beta1.DRAPlugin/NodePrepareResources",
FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DRAPluginServer).NodePrepareResources(ctx, req.(*NodePrepareResourcesRequest))
@ -642,7 +643,7 @@ func _DRAPlugin_NodeUnprepareResources_Handler(srv interface{}, ctx context.Cont
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/v1beta1.DRAPlugin/NodeUnprepareResources",
FullMethod: "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodeUnprepareResources",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DRAPluginServer).NodeUnprepareResources(ctx, req.(*NodeUnprepareResourcesRequest))
@ -651,7 +652,7 @@ func _DRAPlugin_NodeUnprepareResources_Handler(srv interface{}, ctx context.Cont
}
var _DRAPlugin_serviceDesc = grpc.ServiceDesc{
ServiceName: "v1beta1.DRAPlugin",
ServiceName: "k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin",
HandlerType: (*DRAPluginServer)(nil),
Methods: []grpc.MethodDesc{
{

View File

@ -18,7 +18,7 @@ limitations under the License.
syntax = "proto3";
package v1beta1;
package k8s.io.kubelet.pkg.apis.dra.v1beta1;
option go_package = "k8s.io/kubelet/pkg/apis/dra/v1beta1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";

View File

@ -65,8 +65,8 @@ import (
)
const (
NodePrepareResourcesMethod = "/v1beta1.DRAPlugin/NodePrepareResources"
NodeUnprepareResourcesMethod = "/v1beta1.DRAPlugin/NodeUnprepareResources"
NodePrepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodePrepareResources"
NodeUnprepareResourcesMethod = "/k8s.io.kubelet.pkg.apis.dra.v1beta1.DRAPlugin/NodeUnprepareResources"
)
type Nodes struct {