Merge pull request #132773 from saschagrunert/protoc-plugin
Convert `k8s.io/kubelet/pkg/apis/pluginregistration` from gogo to protoc Kubernetes-commit: 1bc48d707cc1404cc684341c804a5e966c3367f7
This commit is contained in:
commit
44b1bb21d1
8
go.mod
8
go.mod
|
|
@ -13,11 +13,11 @@ require (
|
||||||
go.uber.org/goleak v1.3.0
|
go.uber.org/goleak v1.3.0
|
||||||
google.golang.org/grpc v1.72.1
|
google.golang.org/grpc v1.72.1
|
||||||
google.golang.org/protobuf v1.36.5
|
google.golang.org/protobuf v1.36.5
|
||||||
k8s.io/api v0.0.0-20250724024528-2596a6b386e2
|
k8s.io/api v0.0.0-20250724104226-1560b8c850a7
|
||||||
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf
|
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf
|
||||||
k8s.io/apiserver v0.0.0-20250723185939-b6a8cfb34902
|
k8s.io/apiserver v0.0.0-20250724150558-4f018447f7b6
|
||||||
k8s.io/client-go v0.0.0-20250724024901-5f1f878e5cd4
|
k8s.io/client-go v0.0.0-20250724184918-f4919f808e1e
|
||||||
k8s.io/component-base v0.0.0-20250717172125-4e07767df717
|
k8s.io/component-base v0.0.0-20250724065244-07ee182722a1
|
||||||
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa
|
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa
|
||||||
k8s.io/klog/v2 v2.130.1
|
k8s.io/klog/v2 v2.130.1
|
||||||
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
|
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
|
||||||
|
|
|
||||||
16
go.sum
16
go.sum
|
|
@ -166,16 +166,16 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
k8s.io/api v0.0.0-20250724024528-2596a6b386e2 h1:aeFV4AlRTSANFYdVlUVMDOXwkFXNkiIT9Lmif8U+MK4=
|
k8s.io/api v0.0.0-20250724104226-1560b8c850a7 h1:Y5FVeGr2IQ3fbv6GeQAeiZKIyBwxyr7Nv0tWJog9OEo=
|
||||||
k8s.io/api v0.0.0-20250724024528-2596a6b386e2/go.mod h1:70o+sJgHYrO2nPMKeEsmpidpEUMobuxHMhjK/ud9+og=
|
k8s.io/api v0.0.0-20250724104226-1560b8c850a7/go.mod h1:70o+sJgHYrO2nPMKeEsmpidpEUMobuxHMhjK/ud9+og=
|
||||||
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf h1:R1l0xAevbhH2Bg0iJuabo8/i9m31D1ehh2ZJPFKh9bc=
|
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf h1:R1l0xAevbhH2Bg0iJuabo8/i9m31D1ehh2ZJPFKh9bc=
|
||||||
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf/go.mod h1:v1p1Jsze3IHLy5gU17yVqR2qLO7jgYeX6mw3HZy2AEU=
|
k8s.io/apimachinery v0.0.0-20250723005633-58c4eb072ebf/go.mod h1:v1p1Jsze3IHLy5gU17yVqR2qLO7jgYeX6mw3HZy2AEU=
|
||||||
k8s.io/apiserver v0.0.0-20250723185939-b6a8cfb34902 h1:XJwc7NE8YDDeONFiZjfdBWP3b4TH6FV2ipldGMk7Z9Q=
|
k8s.io/apiserver v0.0.0-20250724150558-4f018447f7b6 h1:cdX/g0KowsKzVlg2i8zmBgcftXXI9jYySRu/EnQpgbI=
|
||||||
k8s.io/apiserver v0.0.0-20250723185939-b6a8cfb34902/go.mod h1:kI5+6k1Dm7a5KwFpxbz2uNQciSwZye/iiYER/2Dh0k4=
|
k8s.io/apiserver v0.0.0-20250724150558-4f018447f7b6/go.mod h1:Mf5ULoqgHWn6gSRBQ3pCj5tpW2wCot/XzgJ5zRAI38Q=
|
||||||
k8s.io/client-go v0.0.0-20250724024901-5f1f878e5cd4 h1:cUaPGCS7dfX5d85Q8ZJBD2rdK5C6tbWEtGFdBcH+bxo=
|
k8s.io/client-go v0.0.0-20250724184918-f4919f808e1e h1:Mx4XD6RjgDFsahWjFc3cLL3cUy4EobpMCcCA+zAYVh0=
|
||||||
k8s.io/client-go v0.0.0-20250724024901-5f1f878e5cd4/go.mod h1:kgDY5crqhNpktphA+cjWLcLLjrF5apg7TWTtaVyhUm8=
|
k8s.io/client-go v0.0.0-20250724184918-f4919f808e1e/go.mod h1:cgK+6wG3u4eub4z04TjSa9Y2WD320ZageTzIr5+E5Cg=
|
||||||
k8s.io/component-base v0.0.0-20250717172125-4e07767df717 h1:07oqkM0FzuGUw/bJw2rJubzccG7ShpGcTJ7SBDGp5Fc=
|
k8s.io/component-base v0.0.0-20250724065244-07ee182722a1 h1:OSPZY89+U2JKPaQnluxgzhsbY+L+gG/cxgYVFY5gYA0=
|
||||||
k8s.io/component-base v0.0.0-20250717172125-4e07767df717/go.mod h1:/ehREU84M2OxVgU8WfxuUIi4/c5XsT6rIsEGQfhgxEQ=
|
k8s.io/component-base v0.0.0-20250724065244-07ee182722a1/go.mod h1:w6VkDvQYhgRcM0VZp+pAMPfhFPflGqAAik6tDGgIyq0=
|
||||||
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa h1:L4yvqLnh4ve8h+JacYscIkdWaXglU3n7xFOY5sce4E0=
|
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa h1:L4yvqLnh4ve8h+JacYscIkdWaXglU3n7xFOY5sce4E0=
|
||||||
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa/go.mod h1:4qVUjidMg7/Z9YGZpqIDygbkPWkg3mkS1PvOx/kpHTE=
|
k8s.io/cri-api v0.0.0-20250723020434-76b7537840fa/go.mod h1:4qVUjidMg7/Z9YGZpqIDygbkPWkg3mkS1PvOx/kpHTE=
|
||||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,16 +4,6 @@ syntax = "proto3";
|
||||||
package pluginregistration; // This should have been v1.
|
package pluginregistration; // This should have been v1.
|
||||||
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1";
|
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option (gogoproto.goproto_stringer_all) = false;
|
|
||||||
option (gogoproto.stringer_all) = true;
|
|
||||||
option (gogoproto.goproto_getters_all) = true;
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
|
||||||
option (gogoproto.sizer_all) = true;
|
|
||||||
option (gogoproto.unmarshaler_all) = true;
|
|
||||||
option (gogoproto.goproto_unrecognized_all) = false;
|
|
||||||
|
|
||||||
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
||||||
message PluginInfo {
|
message PluginInfo {
|
||||||
// Type of the Plugin. CSIPlugin or DevicePlugin
|
// Type of the Plugin. CSIPlugin or DevicePlugin
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// To regenerate api.pb.go run `hack/update-codegen.sh protobindings`
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
|
// - protoc v4.23.4
|
||||||
|
// source: staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1/api.proto
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
Registration_GetInfo_FullMethodName = "/pluginregistration.Registration/GetInfo"
|
||||||
|
Registration_NotifyRegistrationStatus_FullMethodName = "/pluginregistration.Registration/NotifyRegistrationStatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegistrationClient is the client API for Registration service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationClient interface {
|
||||||
|
GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type registrationClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRegistrationClient(cc grpc.ClientConnInterface) RegistrationClient {
|
||||||
|
return ®istrationClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(PluginInfo)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_GetInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(RegistrationStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_NotifyRegistrationStatus_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegistrationServer is the server API for Registration service.
|
||||||
|
// All implementations must embed UnimplementedRegistrationServer
|
||||||
|
// for forward compatibility.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationServer interface {
|
||||||
|
GetInfo(context.Context, *InfoRequest) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error)
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedRegistrationServer must be embedded to have
|
||||||
|
// forward compatible implementations.
|
||||||
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedRegistrationServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedRegistrationServer) GetInfo(context.Context, *InfoRequest) (*PluginInfo, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method NotifyRegistrationStatus not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) mustEmbedUnimplementedRegistrationServer() {}
|
||||||
|
func (UnimplementedRegistrationServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeRegistrationServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to RegistrationServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeRegistrationServer interface {
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterRegistrationServer(s grpc.ServiceRegistrar, srv RegistrationServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedRegistrationServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
|
s.RegisterService(&Registration_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(InfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_GetInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, req.(*InfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_NotifyRegistrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RegistrationStatus)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_NotifyRegistrationStatus_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, req.(*RegistrationStatus))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration_ServiceDesc is the grpc.ServiceDesc for Registration service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Registration_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "pluginregistration.Registration",
|
||||||
|
HandlerType: (*RegistrationServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetInfo",
|
||||||
|
Handler: _Registration_GetInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "NotifyRegistrationStatus",
|
||||||
|
Handler: _Registration_NotifyRegistrationStatus_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1/api.proto",
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,16 +4,6 @@ syntax = "proto3";
|
||||||
package pluginregistration; // This should have been v1alpha1.
|
package pluginregistration; // This should have been v1alpha1.
|
||||||
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1";
|
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option (gogoproto.goproto_stringer_all) = false;
|
|
||||||
option (gogoproto.stringer_all) = true;
|
|
||||||
option (gogoproto.goproto_getters_all) = true;
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
|
||||||
option (gogoproto.sizer_all) = true;
|
|
||||||
option (gogoproto.unmarshaler_all) = true;
|
|
||||||
option (gogoproto.goproto_unrecognized_all) = false;
|
|
||||||
|
|
||||||
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
||||||
message PluginInfo {
|
message PluginInfo {
|
||||||
// Type of the Plugin. CSIPlugin or DevicePlugin
|
// Type of the Plugin. CSIPlugin or DevicePlugin
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// To regenerate api.pb.go run `hack/update-codegen.sh protobindings`
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
|
// - protoc v4.23.4
|
||||||
|
// source: staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1/api.proto
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
Registration_GetInfo_FullMethodName = "/pluginregistration.Registration/GetInfo"
|
||||||
|
Registration_NotifyRegistrationStatus_FullMethodName = "/pluginregistration.Registration/NotifyRegistrationStatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegistrationClient is the client API for Registration service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationClient interface {
|
||||||
|
GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type registrationClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRegistrationClient(cc grpc.ClientConnInterface) RegistrationClient {
|
||||||
|
return ®istrationClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(PluginInfo)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_GetInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(RegistrationStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_NotifyRegistrationStatus_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegistrationServer is the server API for Registration service.
|
||||||
|
// All implementations must embed UnimplementedRegistrationServer
|
||||||
|
// for forward compatibility.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationServer interface {
|
||||||
|
GetInfo(context.Context, *InfoRequest) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error)
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedRegistrationServer must be embedded to have
|
||||||
|
// forward compatible implementations.
|
||||||
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedRegistrationServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedRegistrationServer) GetInfo(context.Context, *InfoRequest) (*PluginInfo, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method NotifyRegistrationStatus not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) mustEmbedUnimplementedRegistrationServer() {}
|
||||||
|
func (UnimplementedRegistrationServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeRegistrationServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to RegistrationServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeRegistrationServer interface {
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterRegistrationServer(s grpc.ServiceRegistrar, srv RegistrationServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedRegistrationServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
|
s.RegisterService(&Registration_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(InfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_GetInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, req.(*InfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_NotifyRegistrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RegistrationStatus)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_NotifyRegistrationStatus_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, req.(*RegistrationStatus))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration_ServiceDesc is the grpc.ServiceDesc for Registration service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Registration_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "pluginregistration.Registration",
|
||||||
|
HandlerType: (*RegistrationServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetInfo",
|
||||||
|
Handler: _Registration_GetInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "NotifyRegistrationStatus",
|
||||||
|
Handler: _Registration_NotifyRegistrationStatus_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1/api.proto",
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,16 +4,6 @@ syntax = "proto3";
|
||||||
package pluginregistration; // This should have been v1beta1.
|
package pluginregistration; // This should have been v1beta1.
|
||||||
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1";
|
option go_package = "k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option (gogoproto.goproto_stringer_all) = false;
|
|
||||||
option (gogoproto.stringer_all) = true;
|
|
||||||
option (gogoproto.goproto_getters_all) = true;
|
|
||||||
option (gogoproto.marshaler_all) = true;
|
|
||||||
option (gogoproto.sizer_all) = true;
|
|
||||||
option (gogoproto.unmarshaler_all) = true;
|
|
||||||
option (gogoproto.goproto_unrecognized_all) = false;
|
|
||||||
|
|
||||||
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
// PluginInfo is the message sent from a plugin to the Kubelet pluginwatcher for plugin registration
|
||||||
message PluginInfo {
|
message PluginInfo {
|
||||||
// Type of the Plugin. CSIPlugin or DevicePlugin
|
// Type of the Plugin. CSIPlugin or DevicePlugin
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// To regenerate api.pb.go run `hack/update-codegen.sh protobindings`
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
|
// - protoc v4.23.4
|
||||||
|
// source: staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1/api.proto
|
||||||
|
|
||||||
|
package v1beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
Registration_GetInfo_FullMethodName = "/pluginregistration.Registration/GetInfo"
|
||||||
|
Registration_NotifyRegistrationStatus_FullMethodName = "/pluginregistration.Registration/NotifyRegistrationStatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RegistrationClient is the client API for Registration service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationClient interface {
|
||||||
|
GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type registrationClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRegistrationClient(cc grpc.ClientConnInterface) RegistrationClient {
|
||||||
|
return ®istrationClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*PluginInfo, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(PluginInfo)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_GetInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *registrationClient) NotifyRegistrationStatus(ctx context.Context, in *RegistrationStatus, opts ...grpc.CallOption) (*RegistrationStatusResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(RegistrationStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, Registration_NotifyRegistrationStatus_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegistrationServer is the server API for Registration service.
|
||||||
|
// All implementations must embed UnimplementedRegistrationServer
|
||||||
|
// for forward compatibility.
|
||||||
|
//
|
||||||
|
// Registration is the service advertised by the Plugins.
|
||||||
|
type RegistrationServer interface {
|
||||||
|
GetInfo(context.Context, *InfoRequest) (*PluginInfo, error)
|
||||||
|
NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error)
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedRegistrationServer must be embedded to have
|
||||||
|
// forward compatible implementations.
|
||||||
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedRegistrationServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedRegistrationServer) GetInfo(context.Context, *InfoRequest) (*PluginInfo, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) NotifyRegistrationStatus(context.Context, *RegistrationStatus) (*RegistrationStatusResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method NotifyRegistrationStatus not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRegistrationServer) mustEmbedUnimplementedRegistrationServer() {}
|
||||||
|
func (UnimplementedRegistrationServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeRegistrationServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to RegistrationServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeRegistrationServer interface {
|
||||||
|
mustEmbedUnimplementedRegistrationServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterRegistrationServer(s grpc.ServiceRegistrar, srv RegistrationServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedRegistrationServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
|
s.RegisterService(&Registration_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(InfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_GetInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).GetInfo(ctx, req.(*InfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Registration_NotifyRegistrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RegistrationStatus)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Registration_NotifyRegistrationStatus_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RegistrationServer).NotifyRegistrationStatus(ctx, req.(*RegistrationStatus))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration_ServiceDesc is the grpc.ServiceDesc for Registration service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Registration_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "pluginregistration.Registration",
|
||||||
|
HandlerType: (*RegistrationServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetInfo",
|
||||||
|
Handler: _Registration_GetInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "NotifyRegistrationStatus",
|
||||||
|
Handler: _Registration_NotifyRegistrationStatus_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1/api.proto",
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue