move estimator service protos

Signed-off-by: Garrybest <garrybest@foxmail.com>
This commit is contained in:
Garrybest 2022-01-22 12:32:17 +08:00
parent fc64c81e24
commit 89ddfb4587
8 changed files with 116 additions and 239 deletions

View File

@ -8,7 +8,7 @@ import (
"google.golang.org/grpc"
"k8s.io/klog/v2"
"github.com/karmada-io/karmada/pkg/estimator/pb"
estimatorservice "github.com/karmada-io/karmada/pkg/estimator/service"
"github.com/karmada-io/karmada/pkg/util"
"github.com/karmada-io/karmada/pkg/util/names"
)
@ -28,7 +28,7 @@ func NewSchedulerEstimatorCache() *SchedulerEstimatorCache {
type clientWrapper struct {
connection *grpc.ClientConn
client pb.EstimatorClient
client estimatorservice.EstimatorClient
}
// IsEstimatorExist checks whether the cluster estimator exists in the cache.
@ -40,7 +40,7 @@ func (c *SchedulerEstimatorCache) IsEstimatorExist(name string) bool {
}
// AddCluster adds a grpc connection and associated client into the cache.
func (c *SchedulerEstimatorCache) AddCluster(name string, connection *grpc.ClientConn, client pb.EstimatorClient) {
func (c *SchedulerEstimatorCache) AddCluster(name string, connection *grpc.ClientConn, client estimatorservice.EstimatorClient) {
c.lock.Lock()
defer c.lock.Unlock()
// If more than one worker have established connections at the same time,
@ -68,7 +68,7 @@ func (c *SchedulerEstimatorCache) DeleteCluster(name string) {
}
// GetClient returns the gRPC client of a cluster accurate replica estimator.
func (c *SchedulerEstimatorCache) GetClient(name string) (pb.EstimatorClient, error) {
func (c *SchedulerEstimatorCache) GetClient(name string) (estimatorservice.EstimatorClient, error) {
c.lock.RLock()
defer c.lock.RUnlock()
es, exist := c.estimator[name]
@ -90,7 +90,7 @@ func EstablishConnection(name string, estimatorCache *SchedulerEstimatorCache, p
klog.Errorf("Failed to dial cluster(%s): %v.", name, err)
return err
}
c := pb.NewEstimatorClient(cc)
c := estimatorservice.NewEstimatorClient(cc)
estimatorCache.AddCluster(name, cc, c)
klog.Infof("Connection with estimator server(%s) of cluster(%s) has been established.", serverAddr, name)
return nil

View File

@ -173,38 +173,10 @@ func (m *ReplicaRequirements) XXX_DiscardUnknown() {
var xxx_messageInfo_ReplicaRequirements proto.InternalMessageInfo
func (m *UnimplementedEstimatorServer) Reset() { *m = UnimplementedEstimatorServer{} }
func (*UnimplementedEstimatorServer) ProtoMessage() {}
func (*UnimplementedEstimatorServer) Descriptor() ([]byte, []int) {
return fileDescriptor_9773618571bdb725, []int{5}
}
func (m *UnimplementedEstimatorServer) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *UnimplementedEstimatorServer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *UnimplementedEstimatorServer) XXX_Merge(src proto.Message) {
xxx_messageInfo_UnimplementedEstimatorServer.Merge(m, src)
}
func (m *UnimplementedEstimatorServer) XXX_Size() int {
return m.Size()
}
func (m *UnimplementedEstimatorServer) XXX_DiscardUnknown() {
xxx_messageInfo_UnimplementedEstimatorServer.DiscardUnknown(m)
}
var xxx_messageInfo_UnimplementedEstimatorServer proto.InternalMessageInfo
func (m *UnschedulableReplicasRequest) Reset() { *m = UnschedulableReplicasRequest{} }
func (*UnschedulableReplicasRequest) ProtoMessage() {}
func (*UnschedulableReplicasRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_9773618571bdb725, []int{6}
return fileDescriptor_9773618571bdb725, []int{5}
}
func (m *UnschedulableReplicasRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -232,7 +204,7 @@ var xxx_messageInfo_UnschedulableReplicasRequest proto.InternalMessageInfo
func (m *UnschedulableReplicasResponse) Reset() { *m = UnschedulableReplicasResponse{} }
func (*UnschedulableReplicasResponse) ProtoMessage() {}
func (*UnschedulableReplicasResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9773618571bdb725, []int{7}
return fileDescriptor_9773618571bdb725, []int{6}
}
func (m *UnschedulableReplicasResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -265,7 +237,6 @@ func init() {
proto.RegisterType((*ObjectReference)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.ObjectReference")
proto.RegisterType((*ReplicaRequirements)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.ReplicaRequirements")
proto.RegisterMapType((k8s_io_api_core_v1.ResourceList)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.ReplicaRequirements.ResourceRequestEntry")
proto.RegisterType((*UnimplementedEstimatorServer)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.UnimplementedEstimatorServer")
proto.RegisterType((*UnschedulableReplicasRequest)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.UnschedulableReplicasRequest")
proto.RegisterType((*UnschedulableReplicasResponse)(nil), "github.com.karmada_io.karmada.pkg.estimator.pb.UnschedulableReplicasResponse")
}
@ -275,60 +246,59 @@ func init() {
}
var fileDescriptor_9773618571bdb725 = []byte{
// 846 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x8f, 0xdb, 0x44,
0x14, 0x8e, 0x93, 0xad, 0xda, 0x4c, 0xb6, 0xda, 0xad, 0x77, 0xa9, 0xa2, 0xb4, 0x75, 0x22, 0x9f,
0x96, 0x43, 0xc7, 0x6a, 0x04, 0x52, 0xe1, 0x40, 0xb5, 0xde, 0xf6, 0x80, 0x4a, 0x17, 0x98, 0x76,
0x2b, 0x40, 0x42, 0x68, 0x62, 0xbf, 0x24, 0x43, 0x6c, 0x8f, 0x19, 0x8f, 0xa3, 0x5d, 0x4e, 0x08,
0xc4, 0x1d, 0xf1, 0x0f, 0xf8, 0x1b, 0xfc, 0x82, 0x3d, 0xf6, 0x82, 0xd4, 0x0b, 0x81, 0x84, 0x7f,
0xd1, 0x13, 0xf2, 0x78, 0x9c, 0x38, 0x59, 0x2f, 0xd2, 0x02, 0xb7, 0x99, 0x79, 0xdf, 0xfb,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,
0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x34, 0x7f, 0xd7, 0x35, 0x08, 0x00, 0x00,
// 826 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6f, 0x1b, 0x45,
0x14, 0xf6, 0xda, 0xa9, 0x5a, 0x8f, 0x53, 0x25, 0xdd, 0xa4, 0x95, 0xe5, 0xb6, 0x6b, 0xcb, 0xa7,
0x70, 0xe8, 0xac, 0x6a, 0x81, 0x54, 0x38, 0x50, 0x65, 0x53, 0x0e, 0xa8, 0x34, 0xc0, 0xb4, 0xa9,
0x10, 0x12, 0x42, 0xe3, 0xdd, 0x67, 0x7b, 0xf0, 0xee, 0xce, 0x32, 0x33, 0x1b, 0x35, 0x37, 0x04,
0xe2, 0x8e, 0xf8, 0x07, 0xfc, 0x0d, 0x7e, 0x41, 0x8e, 0xbd, 0x20, 0xf5, 0x82, 0xc1, 0xe6, 0x5f,
0xf4, 0x84, 0x76, 0x76, 0xd6, 0x5e, 0x3b, 0x1b, 0xa4, 0x00, 0xb7, 0x99, 0x79, 0xdf, 0xf7, 0xbd,
0x37, 0x6f, 0xbe, 0x79, 0xe8, 0xc3, 0x31, 0x53, 0x93, 0x74, 0x88, 0x7d, 0x1e, 0xb9, 0x53, 0x2a,
0x22, 0x1a, 0xd0, 0x07, 0x8c, 0x17, 0x4b, 0x37, 0x99, 0x8e, 0x5d, 0x90, 0x8a, 0x45, 0x54, 0x71,
0xe1, 0x26, 0x43, 0x77, 0x0c, 0x31, 0x08, 0xaa, 0x20, 0xc0, 0x89, 0xe0, 0x8a, 0xdb, 0x78, 0xc5,
0xc7, 0x86, 0xf4, 0x35, 0xe3, 0xc5, 0x12, 0x27, 0xd3, 0x31, 0x5e, 0xf2, 0x71, 0x32, 0xec, 0x3c,
0x28, 0xe5, 0x1b, 0xf3, 0x31, 0x77, 0xb5, 0xcc, 0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84, 0x87, 0x81, 0xb6, 0x7c, 0xc3, 0x73, 0x0d, 0xf7, 0xce, 0x49, 0x25, 0xea,
0xed, 0xac, 0x7b, 0x53, 0xb1, 0x08, 0xf0, 0x93, 0x34, 0xff, 0xe2, 0xe4, 0x12, 0xb9, 0xbe, 0x42,
0xf7, 0x2f, 0x69, 0x91, 0x19, 0xcb, 0xcf, 0xd1, 0xed, 0xb4, 0x0a, 0x60, 0x06, 0xf4, 0x7d, 0x53,
0xc8, 0xed, 0x6a, 0x95, 0x6a, 0xae, 0x77, 0x70, 0x3e, 0x77, 0x6a, 0xaf, 0xe7, 0x4e, 0xed, 0xcd,
0xdc, 0xa9, 0x7d, 0xb7, 0x70, 0xac, 0xf3, 0x85, 0x63, 0xbd, 0x5e, 0x38, 0xd6, 0x9b, 0x85, 0x63,
0xfd, 0xb9, 0x70, 0xac, 0x9f, 0xfe, 0x72, 0x6a, 0x5f, 0xd6, 0x93, 0xe1, 0xdf, 0x01, 0x00, 0x00,
0xff, 0xff, 0x04, 0x00, 0x5c, 0x65, 0x0f, 0x08, 0x00, 0x00,
}
func (m *MaxAvailableReplicasRequest) Marshal() (dAtA []byte, err error) {
@ -575,29 +545,6 @@ func (m *ReplicaRequirements) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *UnimplementedEstimatorServer) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *UnimplementedEstimatorServer) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UnimplementedEstimatorServer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *UnschedulableReplicasRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -765,15 +712,6 @@ func (m *ReplicaRequirements) Size() (n int) {
return n
}
func (m *UnimplementedEstimatorServer) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *UnschedulableReplicasRequest) Size() (n int) {
if m == nil {
return 0
@ -886,15 +824,6 @@ func (this *ReplicaRequirements) String() string {
}, "")
return s
}
func (this *UnimplementedEstimatorServer) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&UnimplementedEstimatorServer{`,
`}`,
}, "")
return s
}
func (this *UnschedulableReplicasRequest) String() string {
if this == nil {
return "nil"
@ -1749,56 +1678,6 @@ func (m *ReplicaRequirements) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *UnimplementedEstimatorServer) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: UnimplementedEstimatorServer: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: UnimplementedEstimatorServer: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *UnschedulableReplicasRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0

View File

@ -81,10 +81,6 @@ message ReplicaRequirements {
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> resourceRequest = 2;
}
// UnimplementedEstimatorServer can be embedded to have forward compatible implementations.
message UnimplementedEstimatorServer {
}
// UnschedulableReplicasRequest represents the request that sent by gRPC client to calculate unschedulable replicas.
message UnschedulableReplicasRequest {
// Cluster represents the cluster name.
@ -105,6 +101,6 @@ message UnschedulableReplicasRequest {
message UnschedulableReplicasResponse {
// UnschedulableReplicas represents the unschedulable replicas that the object contains.
// +required
optional int32 maxUnschedulableReplicas = 1;
optional int32 unschedulableReplicas = 1;
}

View File

@ -1,13 +0,0 @@
syntax = "proto2";
package github.com.karmada_io.karmada.pkg.estimator.pb;
import "pkg/estimator/pb/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "pb";
service Estimator {
rpc MaxAvailableReplicas(MaxAvailableReplicasRequest) returns (MaxAvailableReplicasResponse) {}
rpc GetUnschedulableReplicas(UnschedulableReplicasRequest) returns (UnschedulableReplicasResponse) {}
}

View File

@ -90,5 +90,5 @@ type ObjectReference struct {
type UnschedulableReplicasResponse struct {
// UnschedulableReplicas represents the unschedulable replicas that the object contains.
// +required
UnschedulableReplicas int32 `json:"maxUnschedulableReplicas" protobuf:"varint,1,opt,name=maxUnschedulableReplicas"`
UnschedulableReplicas int32 `json:"unschedulableReplicas" protobuf:"varint,1,opt,name=unschedulableReplicas"`
}

View File

@ -22,6 +22,7 @@ import (
"github.com/karmada-io/karmada/pkg/estimator/server/metrics"
nodeutil "github.com/karmada-io/karmada/pkg/estimator/server/nodes"
"github.com/karmada-io/karmada/pkg/estimator/server/replica"
estimatorservice "github.com/karmada-io/karmada/pkg/estimator/service"
"github.com/karmada-io/karmada/pkg/util"
)
@ -115,7 +116,7 @@ func (es *AccurateSchedulerEstimatorServer) Start(ctx context.Context) error {
defer l.Close()
s := grpc.NewServer()
pb.RegisterEstimatorServer(s, es)
estimatorservice.RegisterEstimatorServer(s, es)
// Graceful stop when the context is cancelled.
go func() {

View File

@ -1,12 +1,13 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pkg/estimator/pb/service.proto
// source: service.proto
package pb
package service
import (
context "context"
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
pb "github.com/karmada-io/karmada/pkg/estimator/pb"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@ -24,23 +25,23 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("pkg/estimator/pb/service.proto", fileDescriptor_f8ba5c092844dbe2) }
func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) }
var fileDescriptor_f8ba5c092844dbe2 = []byte{
// 204 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0x4e, 0xd7,
0x4f, 0x2d, 0x2e, 0xc9, 0xcc, 0x4d, 0x2c, 0xc9, 0x2f, 0xd2, 0x2f, 0x48, 0xd2, 0x2f, 0x4e, 0x2d,
0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x4b, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcb, 0x4e, 0x2c, 0xca, 0x4d, 0x4c, 0x49, 0x8c, 0xcf,
0xcc, 0x87, 0x31, 0xf5, 0x0a, 0xb2, 0xd3, 0xf5, 0xe0, 0xba, 0xf5, 0x0a, 0x92, 0xa4, 0x14, 0x30,
0xcc, 0x4b, 0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0x81, 0x98, 0x68, 0xf4, 0x97, 0x89,
0x8b, 0xd3, 0x15, 0xa6, 0x40, 0x68, 0x33, 0x23, 0x97, 0x88, 0x6f, 0x62, 0x85, 0x63, 0x59, 0x62,
0x66, 0x4e, 0x62, 0x52, 0x4e, 0x6a, 0x50, 0x6a, 0x41, 0x4e, 0x66, 0x72, 0x62, 0xb1, 0x90, 0x37,
0x89, 0x36, 0xeb, 0x61, 0x33, 0x25, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0xca, 0x87, 0x3a,
0x86, 0x15, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0x31, 0x08, 0xed, 0x64, 0xe4, 0x92, 0x70, 0x4f,
0x2d, 0x09, 0xcd, 0x2b, 0x4e, 0xce, 0x48, 0x4d, 0x29, 0x45, 0x75, 0x39, 0xc9, 0x96, 0x61, 0x35,
0x06, 0xe6, 0x74, 0x5f, 0x2a, 0x99, 0x06, 0x73, 0xbb, 0x13, 0x4b, 0x14, 0x53, 0x41, 0x12, 0x20,
0x00, 0x00, 0xff, 0xff, 0xbb, 0x1d, 0x27, 0xc0, 0xf8, 0x01, 0x00, 0x00,
var fileDescriptor_a0b84a42fa06f626 = []byte{
// 205 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x4e, 0x2d, 0x2a,
0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, 0x28,
0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcb, 0x4e, 0x2c, 0xca, 0x4d, 0x4c, 0x49, 0x8c, 0xcf, 0xcc,
0x87, 0x31, 0xf5, 0x0a, 0xb2, 0xd3, 0xf5, 0x52, 0x8b, 0x4b, 0x32, 0x73, 0x13, 0x4b, 0xf2, 0x8b,
0xf4, 0xa0, 0x5a, 0xa5, 0x14, 0x0a, 0xb2, 0xd3, 0xf5, 0xe1, 0xc2, 0xfa, 0x05, 0x49, 0xfa, 0xe9,
0xa9, 0x79, 0xa9, 0x45, 0x89, 0x25, 0xa9, 0x29, 0x10, 0x63, 0x8d, 0xfe, 0x32, 0x71, 0x71, 0xba,
0xc2, 0x14, 0x08, 0x6d, 0x66, 0xe4, 0x12, 0xf1, 0x4d, 0xac, 0x70, 0x2c, 0x4b, 0xcc, 0xcc, 0x49,
0x4c, 0xca, 0x49, 0x0d, 0x4a, 0x2d, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0x16, 0xf2, 0xd6, 0x23, 0xc5,
0xfa, 0x82, 0x24, 0x3d, 0x6c, 0xa6, 0x04, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x48, 0xf9, 0x50,
0xc7, 0xb0, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x25, 0x06, 0xa1, 0x9d, 0x8c, 0x5c, 0x12, 0xee,
0xa9, 0x25, 0xa1, 0x79, 0xc5, 0xc9, 0x19, 0xa9, 0x29, 0xa5, 0xa8, 0x2e, 0x27, 0xd9, 0x32, 0xac,
0xc6, 0xc0, 0x9c, 0xee, 0x4b, 0x25, 0xd3, 0x60, 0x6e, 0x77, 0xe2, 0x8c, 0x62, 0x87, 0x46, 0x16,
0x20, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xe1, 0x7a, 0x70, 0xf1, 0x01, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -55,8 +56,8 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type EstimatorClient interface {
MaxAvailableReplicas(ctx context.Context, in *MaxAvailableReplicasRequest, opts ...grpc.CallOption) (*MaxAvailableReplicasResponse, error)
GetUnschedulableReplicas(ctx context.Context, in *UnschedulableReplicasRequest, opts ...grpc.CallOption) (*UnschedulableReplicasResponse, error)
MaxAvailableReplicas(ctx context.Context, in *pb.MaxAvailableReplicasRequest, opts ...grpc.CallOption) (*pb.MaxAvailableReplicasResponse, error)
GetUnschedulableReplicas(ctx context.Context, in *pb.UnschedulableReplicasRequest, opts ...grpc.CallOption) (*pb.UnschedulableReplicasResponse, error)
}
type estimatorClient struct {
@ -67,18 +68,18 @@ func NewEstimatorClient(cc *grpc.ClientConn) EstimatorClient {
return &estimatorClient{cc}
}
func (c *estimatorClient) MaxAvailableReplicas(ctx context.Context, in *MaxAvailableReplicasRequest, opts ...grpc.CallOption) (*MaxAvailableReplicasResponse, error) {
out := new(MaxAvailableReplicasResponse)
err := c.cc.Invoke(ctx, "/github.com.karmada_io.karmada.pkg.estimator.pb.Estimator/MaxAvailableReplicas", in, out, opts...)
func (c *estimatorClient) MaxAvailableReplicas(ctx context.Context, in *pb.MaxAvailableReplicasRequest, opts ...grpc.CallOption) (*pb.MaxAvailableReplicasResponse, error) {
out := new(pb.MaxAvailableReplicasResponse)
err := c.cc.Invoke(ctx, "/github.com.karmada_io.karmada.pkg.estimator.service.Estimator/MaxAvailableReplicas", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *estimatorClient) GetUnschedulableReplicas(ctx context.Context, in *UnschedulableReplicasRequest, opts ...grpc.CallOption) (*UnschedulableReplicasResponse, error) {
out := new(UnschedulableReplicasResponse)
err := c.cc.Invoke(ctx, "/github.com.karmada_io.karmada.pkg.estimator.pb.Estimator/GetUnschedulableReplicas", in, out, opts...)
func (c *estimatorClient) GetUnschedulableReplicas(ctx context.Context, in *pb.UnschedulableReplicasRequest, opts ...grpc.CallOption) (*pb.UnschedulableReplicasResponse, error) {
out := new(pb.UnschedulableReplicasResponse)
err := c.cc.Invoke(ctx, "/github.com.karmada_io.karmada.pkg.estimator.service.Estimator/GetUnschedulableReplicas", in, out, opts...)
if err != nil {
return nil, err
}
@ -87,18 +88,18 @@ func (c *estimatorClient) GetUnschedulableReplicas(ctx context.Context, in *Unsc
// EstimatorServer is the server API for Estimator service.
type EstimatorServer interface {
MaxAvailableReplicas(context.Context, *MaxAvailableReplicasRequest) (*MaxAvailableReplicasResponse, error)
GetUnschedulableReplicas(context.Context, *UnschedulableReplicasRequest) (*UnschedulableReplicasResponse, error)
MaxAvailableReplicas(context.Context, *pb.MaxAvailableReplicasRequest) (*pb.MaxAvailableReplicasResponse, error)
GetUnschedulableReplicas(context.Context, *pb.UnschedulableReplicasRequest) (*pb.UnschedulableReplicasResponse, error)
}
// UnimplementedEstimatorServer can be embedded to have forward compatible implementations.
type UnimplementedEstimatorServer struct {
}
func (*UnimplementedEstimatorServer) MaxAvailableReplicas(ctx context.Context, req *MaxAvailableReplicasRequest) (*MaxAvailableReplicasResponse, error) {
func (*UnimplementedEstimatorServer) MaxAvailableReplicas(ctx context.Context, req *pb.MaxAvailableReplicasRequest) (*pb.MaxAvailableReplicasResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MaxAvailableReplicas not implemented")
}
func (*UnimplementedEstimatorServer) GetUnschedulableReplicas(ctx context.Context, req *UnschedulableReplicasRequest) (*UnschedulableReplicasResponse, error) {
func (*UnimplementedEstimatorServer) GetUnschedulableReplicas(ctx context.Context, req *pb.UnschedulableReplicasRequest) (*pb.UnschedulableReplicasResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUnschedulableReplicas not implemented")
}
@ -107,7 +108,7 @@ func RegisterEstimatorServer(s *grpc.Server, srv EstimatorServer) {
}
func _Estimator_MaxAvailableReplicas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MaxAvailableReplicasRequest)
in := new(pb.MaxAvailableReplicasRequest)
if err := dec(in); err != nil {
return nil, err
}
@ -116,16 +117,16 @@ func _Estimator_MaxAvailableReplicas_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/github.com.karmada_io.karmada.pkg.estimator.pb.Estimator/MaxAvailableReplicas",
FullMethod: "/github.com.karmada_io.karmada.pkg.estimator.service.Estimator/MaxAvailableReplicas",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EstimatorServer).MaxAvailableReplicas(ctx, req.(*MaxAvailableReplicasRequest))
return srv.(EstimatorServer).MaxAvailableReplicas(ctx, req.(*pb.MaxAvailableReplicasRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Estimator_GetUnschedulableReplicas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnschedulableReplicasRequest)
in := new(pb.UnschedulableReplicasRequest)
if err := dec(in); err != nil {
return nil, err
}
@ -134,16 +135,16 @@ func _Estimator_GetUnschedulableReplicas_Handler(srv interface{}, ctx context.Co
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/github.com.karmada_io.karmada.pkg.estimator.pb.Estimator/GetUnschedulableReplicas",
FullMethod: "/github.com.karmada_io.karmada.pkg.estimator.service.Estimator/GetUnschedulableReplicas",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EstimatorServer).GetUnschedulableReplicas(ctx, req.(*UnschedulableReplicasRequest))
return srv.(EstimatorServer).GetUnschedulableReplicas(ctx, req.(*pb.UnschedulableReplicasRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Estimator_serviceDesc = grpc.ServiceDesc{
ServiceName: "github.com.karmada_io.karmada.pkg.estimator.pb.Estimator",
ServiceName: "github.com.karmada_io.karmada.pkg.estimator.service.Estimator",
HandlerType: (*EstimatorServer)(nil),
Methods: []grpc.MethodDesc{
{
@ -156,5 +157,5 @@ var _Estimator_serviceDesc = grpc.ServiceDesc{
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pkg/estimator/pb/service.proto",
Metadata: "service.proto",
}

View File

@ -0,0 +1,13 @@
syntax = "proto2";
package github.com.karmada_io.karmada.pkg.estimator.service;
import "pkg/estimator/pb/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "service";
service Estimator {
rpc MaxAvailableReplicas(pb.MaxAvailableReplicasRequest) returns (pb.MaxAvailableReplicasResponse) {}
rpc GetUnschedulableReplicas(pb.UnschedulableReplicasRequest) returns (pb.UnschedulableReplicasResponse) {}
}