Convert kubelet plugin manager from gogo to protoc
Use standard protoc for the kubelet plugin manager instead of gogo. Part of https://github.com/kubernetes/kubernetes/issues/96564 Signed-off-by: Sascha Grunert <sgrunert@redhat.com> Kubernetes-commit: c889ee17a2f86e0357348b72c52bd36c7dbe8682
This commit is contained in:
parent
f32abbb129
commit
3f57b9b21b
File diff suppressed because it is too large
Load Diff
|
|
@ -4,16 +4,6 @@ syntax = "proto3";
|
|||
package pluginregistration; // This should have been 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
|
||||
message PluginInfo {
|
||||
// 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.
|
||||
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
|
||||
message PluginInfo {
|
||||
// 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.
|
||||
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
|
||||
message PluginInfo {
|
||||
// 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