From 0b018708a768a8f4d59e99716a782e44cceb7ff2 Mon Sep 17 00:00:00 2001 From: Leonardo Cecchi Date: Wed, 17 Jan 2024 12:12:47 +0100 Subject: [PATCH] feat: operator reconciler specification (#3) Signed-off-by: Leonardo Cecchi --- pkg/operator/operator.pb.go | 1125 ++++++++++++++++++++++++++++++ pkg/operator/operator_grpc.pb.go | 273 ++++++++ pkg/wal/wal.pb.go | 76 +- pkg/wal/wal_grpc.pb.go | 78 +-- proto/operator.proto | 132 ++++ proto/wal.proto | 6 +- scripts/build.sh | 5 +- 7 files changed, 1611 insertions(+), 84 deletions(-) create mode 100644 pkg/operator/operator.pb.go create mode 100644 pkg/operator/operator_grpc.pb.go create mode 100644 proto/operator.proto diff --git a/pkg/operator/operator.pb.go b/pkg/operator/operator.pb.go new file mode 100644 index 0000000..0eb8389 --- /dev/null +++ b/pkg/operator/operator.pb.go @@ -0,0 +1,1125 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: proto/operator.proto + +package operator + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type OperatorCapability_RPC_Type int32 + +const ( + OperatorCapability_RPC_TYPE_UNSPECIFIED OperatorCapability_RPC_Type = 0 + // TYPE_VALIDATE_CLUSTER_CREATE indicates that the Plugin is able to + // reply to the ValidateClusterCreate RPC request + OperatorCapability_RPC_TYPE_VALIDATE_CLUSTER_CREATE OperatorCapability_RPC_Type = 1 + // TYPE_VALIDATE_CLUSTER_CHANGE indicates that the Plugin is able to + // reply to the ValidateClusterChange RPC request + OperatorCapability_RPC_TYPE_VALIDATE_CLUSTER_CHANGE OperatorCapability_RPC_Type = 2 + // TYPE_MUTATE_CLUSTER indicates that the Plugin is able to + // reply to the MutateCluster RPC request + OperatorCapability_RPC_TYPE_MUTATE_CLUSTER OperatorCapability_RPC_Type = 3 + // TYPE_MUTATE_POD indicates that the Plugin is able to + // reply to the MutatePod RPC request + OperatorCapability_RPC_TYPE_MUTATE_POD OperatorCapability_RPC_Type = 4 +) + +// Enum value maps for OperatorCapability_RPC_Type. +var ( + OperatorCapability_RPC_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "TYPE_VALIDATE_CLUSTER_CREATE", + 2: "TYPE_VALIDATE_CLUSTER_CHANGE", + 3: "TYPE_MUTATE_CLUSTER", + 4: "TYPE_MUTATE_POD", + } + OperatorCapability_RPC_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "TYPE_VALIDATE_CLUSTER_CREATE": 1, + "TYPE_VALIDATE_CLUSTER_CHANGE": 2, + "TYPE_MUTATE_CLUSTER": 3, + "TYPE_MUTATE_POD": 4, + } +) + +func (x OperatorCapability_RPC_Type) Enum() *OperatorCapability_RPC_Type { + p := new(OperatorCapability_RPC_Type) + *p = x + return p +} + +func (x OperatorCapability_RPC_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OperatorCapability_RPC_Type) Descriptor() protoreflect.EnumDescriptor { + return file_proto_operator_proto_enumTypes[0].Descriptor() +} + +func (OperatorCapability_RPC_Type) Type() protoreflect.EnumType { + return &file_proto_operator_proto_enumTypes[0] +} + +func (x OperatorCapability_RPC_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OperatorCapability_RPC_Type.Descriptor instead. +func (OperatorCapability_RPC_Type) EnumDescriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{11, 0, 0} +} + +type OperatorMutatePodRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Pod that is being applied + Definition string `protobuf:"bytes,1,opt,name=definition,proto3" json:"definition,omitempty"` +} + +func (x *OperatorMutatePodRequest) Reset() { + *x = OperatorMutatePodRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorMutatePodRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorMutatePodRequest) ProtoMessage() {} + +func (x *OperatorMutatePodRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorMutatePodRequest.ProtoReflect.Descriptor instead. +func (*OperatorMutatePodRequest) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{0} +} + +func (x *OperatorMutatePodRequest) GetDefinition() string { + if x != nil { + return x.Definition + } + return "" +} + +type OperatorMutatePodResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is OPTIONAL. Value of this field is the JSON + // serialization of the Pod as modified by the plugin. + // If not present, the operator will assume that no changes + // have been requested by the plugins + Definition string `protobuf:"bytes,1,opt,name=definition,proto3" json:"definition,omitempty"` +} + +func (x *OperatorMutatePodResult) Reset() { + *x = OperatorMutatePodResult{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorMutatePodResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorMutatePodResult) ProtoMessage() {} + +func (x *OperatorMutatePodResult) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorMutatePodResult.ProtoReflect.Descriptor instead. +func (*OperatorMutatePodResult) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{1} +} + +func (x *OperatorMutatePodResult) GetDefinition() string { + if x != nil { + return x.Definition + } + return "" +} + +type OperatorCapabilitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *OperatorCapabilitiesRequest) Reset() { + *x = OperatorCapabilitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorCapabilitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorCapabilitiesRequest) ProtoMessage() {} + +func (x *OperatorCapabilitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorCapabilitiesRequest.ProtoReflect.Descriptor instead. +func (*OperatorCapabilitiesRequest) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{2} +} + +type OperatorCapabilitiesResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // All the capabilities that the controller service supports. This + // field is OPTIONAL. + Capabilities []*OperatorCapability `protobuf:"bytes,1,rep,name=capabilities,proto3" json:"capabilities,omitempty"` +} + +func (x *OperatorCapabilitiesResult) Reset() { + *x = OperatorCapabilitiesResult{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorCapabilitiesResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorCapabilitiesResult) ProtoMessage() {} + +func (x *OperatorCapabilitiesResult) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorCapabilitiesResult.ProtoReflect.Descriptor instead. +func (*OperatorCapabilitiesResult) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{3} +} + +func (x *OperatorCapabilitiesResult) GetCapabilities() []*OperatorCapability { + if x != nil { + return x.Capabilities + } + return nil +} + +type OperatorValidateClusterCreateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that is being created + Definition string `protobuf:"bytes,1,opt,name=definition,proto3" json:"definition,omitempty"` +} + +func (x *OperatorValidateClusterCreateRequest) Reset() { + *x = OperatorValidateClusterCreateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorValidateClusterCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorValidateClusterCreateRequest) ProtoMessage() {} + +func (x *OperatorValidateClusterCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorValidateClusterCreateRequest.ProtoReflect.Descriptor instead. +func (*OperatorValidateClusterCreateRequest) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{4} +} + +func (x *OperatorValidateClusterCreateRequest) GetDefinition() string { + if x != nil { + return x.Definition + } + return "" +} + +type OperatorValidateClusterCreateResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is OPTIONAL. Value of this field is a set + // of validation errors + ValidationErrors []*ValidationError `protobuf:"bytes,1,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` +} + +func (x *OperatorValidateClusterCreateResult) Reset() { + *x = OperatorValidateClusterCreateResult{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorValidateClusterCreateResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorValidateClusterCreateResult) ProtoMessage() {} + +func (x *OperatorValidateClusterCreateResult) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorValidateClusterCreateResult.ProtoReflect.Descriptor instead. +func (*OperatorValidateClusterCreateResult) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{5} +} + +func (x *OperatorValidateClusterCreateResult) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type OperatorValidateClusterChangeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the current Cluster definition + OldCluster string `protobuf:"bytes,1,opt,name=old_cluster,json=oldCluster,proto3" json:"old_cluster,omitempty"` + // This field is REQUIRED. Value of this field is the JSON + // serialization of the updated Cluster definition + NewCluster string `protobuf:"bytes,2,opt,name=new_cluster,json=newCluster,proto3" json:"new_cluster,omitempty"` +} + +func (x *OperatorValidateClusterChangeRequest) Reset() { + *x = OperatorValidateClusterChangeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorValidateClusterChangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorValidateClusterChangeRequest) ProtoMessage() {} + +func (x *OperatorValidateClusterChangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorValidateClusterChangeRequest.ProtoReflect.Descriptor instead. +func (*OperatorValidateClusterChangeRequest) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{6} +} + +func (x *OperatorValidateClusterChangeRequest) GetOldCluster() string { + if x != nil { + return x.OldCluster + } + return "" +} + +func (x *OperatorValidateClusterChangeRequest) GetNewCluster() string { + if x != nil { + return x.NewCluster + } + return "" +} + +type OperatorValidateClusterChangeResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is OPTIONAL. Value of this field is a set + // of validation errors + ValidationErrors []*ValidationError `protobuf:"bytes,1,rep,name=validation_errors,json=validationErrors,proto3" json:"validation_errors,omitempty"` +} + +func (x *OperatorValidateClusterChangeResult) Reset() { + *x = OperatorValidateClusterChangeResult{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorValidateClusterChangeResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorValidateClusterChangeResult) ProtoMessage() {} + +func (x *OperatorValidateClusterChangeResult) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorValidateClusterChangeResult.ProtoReflect.Descriptor instead. +func (*OperatorValidateClusterChangeResult) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{7} +} + +func (x *OperatorValidateClusterChangeResult) GetValidationErrors() []*ValidationError { + if x != nil { + return x.ValidationErrors + } + return nil +} + +type OperatorMutateClusterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that should receive the + // default values + Definition string `protobuf:"bytes,1,opt,name=definition,proto3" json:"definition,omitempty"` +} + +func (x *OperatorMutateClusterRequest) Reset() { + *x = OperatorMutateClusterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorMutateClusterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorMutateClusterRequest) ProtoMessage() {} + +func (x *OperatorMutateClusterRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorMutateClusterRequest.ProtoReflect.Descriptor instead. +func (*OperatorMutateClusterRequest) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{8} +} + +func (x *OperatorMutateClusterRequest) GetDefinition() string { + if x != nil { + return x.Definition + } + return "" +} + +type OperatorMutateClusterResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that have received the + // default values + Definition string `protobuf:"bytes,1,opt,name=definition,proto3" json:"definition,omitempty"` +} + +func (x *OperatorMutateClusterResult) Reset() { + *x = OperatorMutateClusterResult{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorMutateClusterResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorMutateClusterResult) ProtoMessage() {} + +func (x *OperatorMutateClusterResult) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorMutateClusterResult.ProtoReflect.Descriptor instead. +func (*OperatorMutateClusterResult) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{9} +} + +func (x *OperatorMutateClusterResult) GetDefinition() string { + if x != nil { + return x.Definition + } + return "" +} + +type ValidationError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // This field is REQUIRED. Value of this field is + PathComponents []string `protobuf:"bytes,1,rep,name=path_components,json=pathComponents,proto3" json:"path_components,omitempty"` + // This field is REQUIRED. Value of this field is + // the value that caused a validation error + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // This field is REQUIRED. Value of this field is a + // description of the validation error + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ValidationError) Reset() { + *x = ValidationError{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ValidationError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidationError) ProtoMessage() {} + +func (x *ValidationError) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidationError.ProtoReflect.Descriptor instead. +func (*ValidationError) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{10} +} + +func (x *ValidationError) GetPathComponents() []string { + if x != nil { + return x.PathComponents + } + return nil +} + +func (x *ValidationError) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *ValidationError) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type OperatorCapability struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Type: + // + // *OperatorCapability_Rpc + Type isOperatorCapability_Type `protobuf_oneof:"type"` +} + +func (x *OperatorCapability) Reset() { + *x = OperatorCapability{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorCapability) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorCapability) ProtoMessage() {} + +func (x *OperatorCapability) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorCapability.ProtoReflect.Descriptor instead. +func (*OperatorCapability) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{11} +} + +func (m *OperatorCapability) GetType() isOperatorCapability_Type { + if m != nil { + return m.Type + } + return nil +} + +func (x *OperatorCapability) GetRpc() *OperatorCapability_RPC { + if x, ok := x.GetType().(*OperatorCapability_Rpc); ok { + return x.Rpc + } + return nil +} + +type isOperatorCapability_Type interface { + isOperatorCapability_Type() +} + +type OperatorCapability_Rpc struct { + Rpc *OperatorCapability_RPC `protobuf:"bytes,1,opt,name=rpc,proto3,oneof"` +} + +func (*OperatorCapability_Rpc) isOperatorCapability_Type() {} + +type OperatorCapability_RPC struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type OperatorCapability_RPC_Type `protobuf:"varint,1,opt,name=type,proto3,enum=cnpgi.adapter.v1.OperatorCapability_RPC_Type" json:"type,omitempty"` +} + +func (x *OperatorCapability_RPC) Reset() { + *x = OperatorCapability_RPC{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_operator_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperatorCapability_RPC) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperatorCapability_RPC) ProtoMessage() {} + +func (x *OperatorCapability_RPC) ProtoReflect() protoreflect.Message { + mi := &file_proto_operator_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OperatorCapability_RPC.ProtoReflect.Descriptor instead. +func (*OperatorCapability_RPC) Descriptor() ([]byte, []int) { + return file_proto_operator_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *OperatorCapability_RPC) GetType() OperatorCapability_RPC_Type { + if x != nil { + return x.Type + } + return OperatorCapability_RPC_TYPE_UNSPECIFIED +} + +var File_proto_operator_proto protoreflect.FileDescriptor + +var file_proto_operator_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x3a, 0x0a, 0x18, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x39, 0x0a, 0x17, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, + 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x1d, 0x0a, 0x1b, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, + 0x0a, 0x1a, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x48, 0x0a, 0x0c, + 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x46, 0x0a, 0x24, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, + 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x75, + 0x0a, 0x23, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x68, 0x0a, 0x24, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x6f, 0x6c, 0x64, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x6c, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1f, + 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x22, + 0x75, 0x0a, 0x23, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x3e, 0x0a, 0x1c, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, + 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3d, 0x0a, 0x1b, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6a, 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x61, 0x74, 0x68, + 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x70, 0x61, 0x74, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0xb6, 0x02, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x3c, 0x0a, 0x03, 0x72, 0x70, 0x63, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x52, 0x50, 0x43, 0x48, + 0x00, 0x52, 0x03, 0x72, 0x70, 0x63, 0x1a, 0xd9, 0x01, 0x0a, 0x03, 0x52, 0x50, 0x43, 0x12, 0x41, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x63, + 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x2e, 0x52, 0x50, 0x43, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x20, 0x0a, 0x1c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, + 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, + 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, + 0x41, 0x54, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x5f, 0x43, 0x48, 0x41, 0x4e, + 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x55, 0x54, + 0x41, 0x54, 0x45, 0x5f, 0x43, 0x4c, 0x55, 0x53, 0x54, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, + 0x0f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x55, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x4f, 0x44, + 0x10, 0x04, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x32, 0xea, 0x04, 0x0a, 0x08, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x70, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2d, 0x2e, 0x63, 0x6e, 0x70, + 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x6e, 0x70, 0x67, + 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x12, 0x36, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6e, + 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x22, 0x00, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x36, + 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, + 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, + 0x70, 0x0a, 0x0d, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x12, 0x2e, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2d, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x00, 0x12, 0x64, 0x0a, 0x09, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x12, 0x2a, + 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, + 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x63, 0x6e, 0x70, + 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x6e, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x2d, 0x70, 0x67, 0x2f, 0x63, 0x6e, 0x70, 0x67, 0x2d, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_operator_proto_rawDescOnce sync.Once + file_proto_operator_proto_rawDescData = file_proto_operator_proto_rawDesc +) + +func file_proto_operator_proto_rawDescGZIP() []byte { + file_proto_operator_proto_rawDescOnce.Do(func() { + file_proto_operator_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_operator_proto_rawDescData) + }) + return file_proto_operator_proto_rawDescData +} + +var file_proto_operator_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_operator_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_proto_operator_proto_goTypes = []interface{}{ + (OperatorCapability_RPC_Type)(0), // 0: cnpgi.adapter.v1.OperatorCapability.RPC.Type + (*OperatorMutatePodRequest)(nil), // 1: cnpgi.adapter.v1.OperatorMutatePodRequest + (*OperatorMutatePodResult)(nil), // 2: cnpgi.adapter.v1.OperatorMutatePodResult + (*OperatorCapabilitiesRequest)(nil), // 3: cnpgi.adapter.v1.OperatorCapabilitiesRequest + (*OperatorCapabilitiesResult)(nil), // 4: cnpgi.adapter.v1.OperatorCapabilitiesResult + (*OperatorValidateClusterCreateRequest)(nil), // 5: cnpgi.adapter.v1.OperatorValidateClusterCreateRequest + (*OperatorValidateClusterCreateResult)(nil), // 6: cnpgi.adapter.v1.OperatorValidateClusterCreateResult + (*OperatorValidateClusterChangeRequest)(nil), // 7: cnpgi.adapter.v1.OperatorValidateClusterChangeRequest + (*OperatorValidateClusterChangeResult)(nil), // 8: cnpgi.adapter.v1.OperatorValidateClusterChangeResult + (*OperatorMutateClusterRequest)(nil), // 9: cnpgi.adapter.v1.OperatorMutateClusterRequest + (*OperatorMutateClusterResult)(nil), // 10: cnpgi.adapter.v1.OperatorMutateClusterResult + (*ValidationError)(nil), // 11: cnpgi.adapter.v1.ValidationError + (*OperatorCapability)(nil), // 12: cnpgi.adapter.v1.OperatorCapability + (*OperatorCapability_RPC)(nil), // 13: cnpgi.adapter.v1.OperatorCapability.RPC +} +var file_proto_operator_proto_depIdxs = []int32{ + 12, // 0: cnpgi.adapter.v1.OperatorCapabilitiesResult.capabilities:type_name -> cnpgi.adapter.v1.OperatorCapability + 11, // 1: cnpgi.adapter.v1.OperatorValidateClusterCreateResult.validation_errors:type_name -> cnpgi.adapter.v1.ValidationError + 11, // 2: cnpgi.adapter.v1.OperatorValidateClusterChangeResult.validation_errors:type_name -> cnpgi.adapter.v1.ValidationError + 13, // 3: cnpgi.adapter.v1.OperatorCapability.rpc:type_name -> cnpgi.adapter.v1.OperatorCapability.RPC + 0, // 4: cnpgi.adapter.v1.OperatorCapability.RPC.type:type_name -> cnpgi.adapter.v1.OperatorCapability.RPC.Type + 3, // 5: cnpgi.adapter.v1.Operator.GetCapabilities:input_type -> cnpgi.adapter.v1.OperatorCapabilitiesRequest + 5, // 6: cnpgi.adapter.v1.Operator.ValidateClusterCreate:input_type -> cnpgi.adapter.v1.OperatorValidateClusterCreateRequest + 7, // 7: cnpgi.adapter.v1.Operator.ValidateClusterChange:input_type -> cnpgi.adapter.v1.OperatorValidateClusterChangeRequest + 9, // 8: cnpgi.adapter.v1.Operator.MutateCluster:input_type -> cnpgi.adapter.v1.OperatorMutateClusterRequest + 1, // 9: cnpgi.adapter.v1.Operator.MutatePod:input_type -> cnpgi.adapter.v1.OperatorMutatePodRequest + 4, // 10: cnpgi.adapter.v1.Operator.GetCapabilities:output_type -> cnpgi.adapter.v1.OperatorCapabilitiesResult + 6, // 11: cnpgi.adapter.v1.Operator.ValidateClusterCreate:output_type -> cnpgi.adapter.v1.OperatorValidateClusterCreateResult + 8, // 12: cnpgi.adapter.v1.Operator.ValidateClusterChange:output_type -> cnpgi.adapter.v1.OperatorValidateClusterChangeResult + 10, // 13: cnpgi.adapter.v1.Operator.MutateCluster:output_type -> cnpgi.adapter.v1.OperatorMutateClusterResult + 2, // 14: cnpgi.adapter.v1.Operator.MutatePod:output_type -> cnpgi.adapter.v1.OperatorMutatePodResult + 10, // [10:15] is the sub-list for method output_type + 5, // [5:10] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_proto_operator_proto_init() } +func file_proto_operator_proto_init() { + if File_proto_operator_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_operator_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorMutatePodRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorMutatePodResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorCapabilitiesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorCapabilitiesResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorValidateClusterCreateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorValidateClusterCreateResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorValidateClusterChangeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorValidateClusterChangeResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorMutateClusterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorMutateClusterResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidationError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorCapability); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_operator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperatorCapability_RPC); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_proto_operator_proto_msgTypes[11].OneofWrappers = []interface{}{ + (*OperatorCapability_Rpc)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_operator_proto_rawDesc, + NumEnums: 1, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_operator_proto_goTypes, + DependencyIndexes: file_proto_operator_proto_depIdxs, + EnumInfos: file_proto_operator_proto_enumTypes, + MessageInfos: file_proto_operator_proto_msgTypes, + }.Build() + File_proto_operator_proto = out.File + file_proto_operator_proto_rawDesc = nil + file_proto_operator_proto_goTypes = nil + file_proto_operator_proto_depIdxs = nil +} diff --git a/pkg/operator/operator_grpc.pb.go b/pkg/operator/operator_grpc.pb.go new file mode 100644 index 0000000..c9ee7bc --- /dev/null +++ b/pkg/operator/operator_grpc.pb.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.2 +// source: proto/operator.proto + +package operator + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Operator_GetCapabilities_FullMethodName = "/cnpgi.adapter.v1.Operator/GetCapabilities" + Operator_ValidateClusterCreate_FullMethodName = "/cnpgi.adapter.v1.Operator/ValidateClusterCreate" + Operator_ValidateClusterChange_FullMethodName = "/cnpgi.adapter.v1.Operator/ValidateClusterChange" + Operator_MutateCluster_FullMethodName = "/cnpgi.adapter.v1.Operator/MutateCluster" + Operator_MutatePod_FullMethodName = "/cnpgi.adapter.v1.Operator/MutatePod" +) + +// OperatorClient is the client API for Operator 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. +type OperatorClient interface { + // GetCapabilities gets the capabilities of the WAL service + GetCapabilities(ctx context.Context, in *OperatorCapabilitiesRequest, opts ...grpc.CallOption) (*OperatorCapabilitiesResult, error) + // ValidateCreate improves the behaviour of the validating webhook that + // is called on creation of the Cluster resources + ValidateClusterCreate(ctx context.Context, in *OperatorValidateClusterCreateRequest, opts ...grpc.CallOption) (*OperatorValidateClusterCreateResult, error) + // ValidateClusterChange improves the behavior of the validating webhook of + // is called on updates of the Cluster resources + ValidateClusterChange(ctx context.Context, in *OperatorValidateClusterChangeRequest, opts ...grpc.CallOption) (*OperatorValidateClusterChangeResult, error) + // MutateCluster fills in the defaults inside a Cluster resource + MutateCluster(ctx context.Context, in *OperatorMutateClusterRequest, opts ...grpc.CallOption) (*OperatorMutateClusterResult, error) + // MutatePod reconciles a Pod definition before it + // is applied in the Kubernetes cluster + MutatePod(ctx context.Context, in *OperatorMutatePodRequest, opts ...grpc.CallOption) (*OperatorMutatePodResult, error) +} + +type operatorClient struct { + cc grpc.ClientConnInterface +} + +func NewOperatorClient(cc grpc.ClientConnInterface) OperatorClient { + return &operatorClient{cc} +} + +func (c *operatorClient) GetCapabilities(ctx context.Context, in *OperatorCapabilitiesRequest, opts ...grpc.CallOption) (*OperatorCapabilitiesResult, error) { + out := new(OperatorCapabilitiesResult) + err := c.cc.Invoke(ctx, Operator_GetCapabilities_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *operatorClient) ValidateClusterCreate(ctx context.Context, in *OperatorValidateClusterCreateRequest, opts ...grpc.CallOption) (*OperatorValidateClusterCreateResult, error) { + out := new(OperatorValidateClusterCreateResult) + err := c.cc.Invoke(ctx, Operator_ValidateClusterCreate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *operatorClient) ValidateClusterChange(ctx context.Context, in *OperatorValidateClusterChangeRequest, opts ...grpc.CallOption) (*OperatorValidateClusterChangeResult, error) { + out := new(OperatorValidateClusterChangeResult) + err := c.cc.Invoke(ctx, Operator_ValidateClusterChange_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *operatorClient) MutateCluster(ctx context.Context, in *OperatorMutateClusterRequest, opts ...grpc.CallOption) (*OperatorMutateClusterResult, error) { + out := new(OperatorMutateClusterResult) + err := c.cc.Invoke(ctx, Operator_MutateCluster_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *operatorClient) MutatePod(ctx context.Context, in *OperatorMutatePodRequest, opts ...grpc.CallOption) (*OperatorMutatePodResult, error) { + out := new(OperatorMutatePodResult) + err := c.cc.Invoke(ctx, Operator_MutatePod_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OperatorServer is the server API for Operator service. +// All implementations must embed UnimplementedOperatorServer +// for forward compatibility +type OperatorServer interface { + // GetCapabilities gets the capabilities of the WAL service + GetCapabilities(context.Context, *OperatorCapabilitiesRequest) (*OperatorCapabilitiesResult, error) + // ValidateCreate improves the behaviour of the validating webhook that + // is called on creation of the Cluster resources + ValidateClusterCreate(context.Context, *OperatorValidateClusterCreateRequest) (*OperatorValidateClusterCreateResult, error) + // ValidateClusterChange improves the behavior of the validating webhook of + // is called on updates of the Cluster resources + ValidateClusterChange(context.Context, *OperatorValidateClusterChangeRequest) (*OperatorValidateClusterChangeResult, error) + // MutateCluster fills in the defaults inside a Cluster resource + MutateCluster(context.Context, *OperatorMutateClusterRequest) (*OperatorMutateClusterResult, error) + // MutatePod reconciles a Pod definition before it + // is applied in the Kubernetes cluster + MutatePod(context.Context, *OperatorMutatePodRequest) (*OperatorMutatePodResult, error) + mustEmbedUnimplementedOperatorServer() +} + +// UnimplementedOperatorServer must be embedded to have forward compatible implementations. +type UnimplementedOperatorServer struct { +} + +func (UnimplementedOperatorServer) GetCapabilities(context.Context, *OperatorCapabilitiesRequest) (*OperatorCapabilitiesResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCapabilities not implemented") +} +func (UnimplementedOperatorServer) ValidateClusterCreate(context.Context, *OperatorValidateClusterCreateRequest) (*OperatorValidateClusterCreateResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateClusterCreate not implemented") +} +func (UnimplementedOperatorServer) ValidateClusterChange(context.Context, *OperatorValidateClusterChangeRequest) (*OperatorValidateClusterChangeResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateClusterChange not implemented") +} +func (UnimplementedOperatorServer) MutateCluster(context.Context, *OperatorMutateClusterRequest) (*OperatorMutateClusterResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method MutateCluster not implemented") +} +func (UnimplementedOperatorServer) MutatePod(context.Context, *OperatorMutatePodRequest) (*OperatorMutatePodResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method MutatePod not implemented") +} +func (UnimplementedOperatorServer) mustEmbedUnimplementedOperatorServer() {} + +// UnsafeOperatorServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OperatorServer will +// result in compilation errors. +type UnsafeOperatorServer interface { + mustEmbedUnimplementedOperatorServer() +} + +func RegisterOperatorServer(s grpc.ServiceRegistrar, srv OperatorServer) { + s.RegisterService(&Operator_ServiceDesc, srv) +} + +func _Operator_GetCapabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperatorCapabilitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OperatorServer).GetCapabilities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Operator_GetCapabilities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OperatorServer).GetCapabilities(ctx, req.(*OperatorCapabilitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Operator_ValidateClusterCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperatorValidateClusterCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OperatorServer).ValidateClusterCreate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Operator_ValidateClusterCreate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OperatorServer).ValidateClusterCreate(ctx, req.(*OperatorValidateClusterCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Operator_ValidateClusterChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperatorValidateClusterChangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OperatorServer).ValidateClusterChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Operator_ValidateClusterChange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OperatorServer).ValidateClusterChange(ctx, req.(*OperatorValidateClusterChangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Operator_MutateCluster_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperatorMutateClusterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OperatorServer).MutateCluster(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Operator_MutateCluster_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OperatorServer).MutateCluster(ctx, req.(*OperatorMutateClusterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Operator_MutatePod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OperatorMutatePodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OperatorServer).MutatePod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Operator_MutatePod_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OperatorServer).MutatePod(ctx, req.(*OperatorMutatePodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Operator_ServiceDesc is the grpc.ServiceDesc for Operator service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Operator_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cnpgi.adapter.v1.Operator", + HandlerType: (*OperatorServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetCapabilities", + Handler: _Operator_GetCapabilities_Handler, + }, + { + MethodName: "ValidateClusterCreate", + Handler: _Operator_ValidateClusterCreate_Handler, + }, + { + MethodName: "ValidateClusterChange", + Handler: _Operator_ValidateClusterChange_Handler, + }, + { + MethodName: "MutateCluster", + Handler: _Operator_MutateCluster_Handler, + }, + { + MethodName: "MutatePod", + Handler: _Operator_MutatePod_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/operator.proto", +} diff --git a/pkg/wal/wal.pb.go b/pkg/wal/wal.pb.go index 5134b15..702f0f3 100644 --- a/pkg/wal/wal.pb.go +++ b/pkg/wal/wal.pb.go @@ -819,35 +819,35 @@ var file_proto_wal_proto_rawDesc = []byte{ 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x5f, 0x46, 0x49, 0x52, 0x53, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x04, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x32, 0xd7, 0x03, 0x0a, - 0x03, 0x57, 0x41, 0x4c, 0x12, 0x54, 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, - 0x23, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, - 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x41, 0x72, 0x63, 0x68, 0x69, - 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x07, 0x52, 0x65, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x23, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, - 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x52, 0x65, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6e, 0x70, - 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, - 0x4c, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, - 0x12, 0x51, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x2e, 0x63, 0x6e, 0x70, - 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, - 0x4c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, - 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, - 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x22, 0x00, 0x12, 0x69, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x46, 0x69, 0x72, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x29, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, - 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x69, - 0x72, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, - 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x69, 0x72, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x66, - 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, + 0x03, 0x57, 0x41, 0x4c, 0x12, 0x66, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, + 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x43, 0x61, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6e, - 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, - 0x41, 0x4c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x07, + 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x23, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, + 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x41, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, + 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x57, 0x41, 0x4c, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x00, 0x12, 0x54, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x23, 0x2e, + 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x57, 0x41, 0x4c, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x22, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, + 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x41, 0x4c, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x69, 0x0a, 0x10, 0x53, + 0x65, 0x74, 0x46, 0x69, 0x72, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, + 0x29, 0x2e, 0x63, 0x6e, 0x70, 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x69, 0x72, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6e, 0x70, + 0x67, 0x69, 0x2e, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x74, 0x46, 0x69, 0x72, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2d, 0x70, 0x67, 0x2f, 0x63, 0x6e, 0x70, 0x67, 0x2d, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x77, @@ -893,16 +893,16 @@ var file_proto_wal_proto_depIdxs = []int32{ 11, // 3: cnpgi.adapter.v1.WALCapabilitiesResult.capabilities:type_name -> cnpgi.adapter.v1.WALCapability 15, // 4: cnpgi.adapter.v1.WALCapability.rpc:type_name -> cnpgi.adapter.v1.WALCapability.RPC 0, // 5: cnpgi.adapter.v1.WALCapability.RPC.type:type_name -> cnpgi.adapter.v1.WALCapability.RPC.Type - 1, // 6: cnpgi.adapter.v1.WAL.Archive:input_type -> cnpgi.adapter.v1.WALArchiveRequest - 3, // 7: cnpgi.adapter.v1.WAL.Restore:input_type -> cnpgi.adapter.v1.WALRestoreRequest - 5, // 8: cnpgi.adapter.v1.WAL.Status:input_type -> cnpgi.adapter.v1.WALStatusRequest - 7, // 9: cnpgi.adapter.v1.WAL.SetFirstRequired:input_type -> cnpgi.adapter.v1.SetFirstRequiredRequest - 9, // 10: cnpgi.adapter.v1.WAL.GetCapabilities:input_type -> cnpgi.adapter.v1.WALCapabilitiesRequest - 2, // 11: cnpgi.adapter.v1.WAL.Archive:output_type -> cnpgi.adapter.v1.WALArchiveResult - 4, // 12: cnpgi.adapter.v1.WAL.Restore:output_type -> cnpgi.adapter.v1.WALRestoreResult - 6, // 13: cnpgi.adapter.v1.WAL.Status:output_type -> cnpgi.adapter.v1.WALStatusResult - 8, // 14: cnpgi.adapter.v1.WAL.SetFirstRequired:output_type -> cnpgi.adapter.v1.SetFirstRequiredResult - 10, // 15: cnpgi.adapter.v1.WAL.GetCapabilities:output_type -> cnpgi.adapter.v1.WALCapabilitiesResult + 9, // 6: cnpgi.adapter.v1.WAL.GetCapabilities:input_type -> cnpgi.adapter.v1.WALCapabilitiesRequest + 1, // 7: cnpgi.adapter.v1.WAL.Archive:input_type -> cnpgi.adapter.v1.WALArchiveRequest + 3, // 8: cnpgi.adapter.v1.WAL.Restore:input_type -> cnpgi.adapter.v1.WALRestoreRequest + 5, // 9: cnpgi.adapter.v1.WAL.Status:input_type -> cnpgi.adapter.v1.WALStatusRequest + 7, // 10: cnpgi.adapter.v1.WAL.SetFirstRequired:input_type -> cnpgi.adapter.v1.SetFirstRequiredRequest + 10, // 11: cnpgi.adapter.v1.WAL.GetCapabilities:output_type -> cnpgi.adapter.v1.WALCapabilitiesResult + 2, // 12: cnpgi.adapter.v1.WAL.Archive:output_type -> cnpgi.adapter.v1.WALArchiveResult + 4, // 13: cnpgi.adapter.v1.WAL.Restore:output_type -> cnpgi.adapter.v1.WALRestoreResult + 6, // 14: cnpgi.adapter.v1.WAL.Status:output_type -> cnpgi.adapter.v1.WALStatusResult + 8, // 15: cnpgi.adapter.v1.WAL.SetFirstRequired:output_type -> cnpgi.adapter.v1.SetFirstRequiredResult 11, // [11:16] is the sub-list for method output_type 6, // [6:11] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name diff --git a/pkg/wal/wal_grpc.pb.go b/pkg/wal/wal_grpc.pb.go index e6b2ff4..0f2cf56 100644 --- a/pkg/wal/wal_grpc.pb.go +++ b/pkg/wal/wal_grpc.pb.go @@ -19,17 +19,19 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( + WAL_GetCapabilities_FullMethodName = "/cnpgi.adapter.v1.WAL/GetCapabilities" WAL_Archive_FullMethodName = "/cnpgi.adapter.v1.WAL/Archive" WAL_Restore_FullMethodName = "/cnpgi.adapter.v1.WAL/Restore" WAL_Status_FullMethodName = "/cnpgi.adapter.v1.WAL/Status" WAL_SetFirstRequired_FullMethodName = "/cnpgi.adapter.v1.WAL/SetFirstRequired" - WAL_GetCapabilities_FullMethodName = "/cnpgi.adapter.v1.WAL/GetCapabilities" ) // WALClient is the client API for WAL 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. type WALClient interface { + // GetCapabilities gets the capabilities of the WAL service + GetCapabilities(ctx context.Context, in *WALCapabilitiesRequest, opts ...grpc.CallOption) (*WALCapabilitiesResult, error) // Archive copies one WAL file into the archive Archive(ctx context.Context, in *WALArchiveRequest, opts ...grpc.CallOption) (*WALArchiveResult, error) // Restores copies WAL file from the archive to the data directory @@ -38,8 +40,6 @@ type WALClient interface { Status(ctx context.Context, in *WALStatusRequest, opts ...grpc.CallOption) (*WALStatusResult, error) // SetFirstRequired sets the first required WAL for the cluster SetFirstRequired(ctx context.Context, in *SetFirstRequiredRequest, opts ...grpc.CallOption) (*SetFirstRequiredResult, error) - // GetCapabilities gets the capabilities of the WAL service - GetCapabilities(ctx context.Context, in *WALCapabilitiesRequest, opts ...grpc.CallOption) (*WALCapabilitiesResult, error) } type wALClient struct { @@ -50,6 +50,15 @@ func NewWALClient(cc grpc.ClientConnInterface) WALClient { return &wALClient{cc} } +func (c *wALClient) GetCapabilities(ctx context.Context, in *WALCapabilitiesRequest, opts ...grpc.CallOption) (*WALCapabilitiesResult, error) { + out := new(WALCapabilitiesResult) + err := c.cc.Invoke(ctx, WAL_GetCapabilities_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *wALClient) Archive(ctx context.Context, in *WALArchiveRequest, opts ...grpc.CallOption) (*WALArchiveResult, error) { out := new(WALArchiveResult) err := c.cc.Invoke(ctx, WAL_Archive_FullMethodName, in, out, opts...) @@ -86,19 +95,12 @@ func (c *wALClient) SetFirstRequired(ctx context.Context, in *SetFirstRequiredRe return out, nil } -func (c *wALClient) GetCapabilities(ctx context.Context, in *WALCapabilitiesRequest, opts ...grpc.CallOption) (*WALCapabilitiesResult, error) { - out := new(WALCapabilitiesResult) - err := c.cc.Invoke(ctx, WAL_GetCapabilities_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // WALServer is the server API for WAL service. // All implementations must embed UnimplementedWALServer // for forward compatibility type WALServer interface { + // GetCapabilities gets the capabilities of the WAL service + GetCapabilities(context.Context, *WALCapabilitiesRequest) (*WALCapabilitiesResult, error) // Archive copies one WAL file into the archive Archive(context.Context, *WALArchiveRequest) (*WALArchiveResult, error) // Restores copies WAL file from the archive to the data directory @@ -107,8 +109,6 @@ type WALServer interface { Status(context.Context, *WALStatusRequest) (*WALStatusResult, error) // SetFirstRequired sets the first required WAL for the cluster SetFirstRequired(context.Context, *SetFirstRequiredRequest) (*SetFirstRequiredResult, error) - // GetCapabilities gets the capabilities of the WAL service - GetCapabilities(context.Context, *WALCapabilitiesRequest) (*WALCapabilitiesResult, error) mustEmbedUnimplementedWALServer() } @@ -116,6 +116,9 @@ type WALServer interface { type UnimplementedWALServer struct { } +func (UnimplementedWALServer) GetCapabilities(context.Context, *WALCapabilitiesRequest) (*WALCapabilitiesResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCapabilities not implemented") +} func (UnimplementedWALServer) Archive(context.Context, *WALArchiveRequest) (*WALArchiveResult, error) { return nil, status.Errorf(codes.Unimplemented, "method Archive not implemented") } @@ -128,9 +131,6 @@ func (UnimplementedWALServer) Status(context.Context, *WALStatusRequest) (*WALSt func (UnimplementedWALServer) SetFirstRequired(context.Context, *SetFirstRequiredRequest) (*SetFirstRequiredResult, error) { return nil, status.Errorf(codes.Unimplemented, "method SetFirstRequired not implemented") } -func (UnimplementedWALServer) GetCapabilities(context.Context, *WALCapabilitiesRequest) (*WALCapabilitiesResult, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCapabilities not implemented") -} func (UnimplementedWALServer) mustEmbedUnimplementedWALServer() {} // UnsafeWALServer may be embedded to opt out of forward compatibility for this service. @@ -144,6 +144,24 @@ func RegisterWALServer(s grpc.ServiceRegistrar, srv WALServer) { s.RegisterService(&WAL_ServiceDesc, srv) } +func _WAL_GetCapabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WALCapabilitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WALServer).GetCapabilities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WAL_GetCapabilities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WALServer).GetCapabilities(ctx, req.(*WALCapabilitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _WAL_Archive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(WALArchiveRequest) if err := dec(in); err != nil { @@ -216,24 +234,6 @@ func _WAL_SetFirstRequired_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _WAL_GetCapabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WALCapabilitiesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WALServer).GetCapabilities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: WAL_GetCapabilities_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WALServer).GetCapabilities(ctx, req.(*WALCapabilitiesRequest)) - } - return interceptor(ctx, in, info, handler) -} - // WAL_ServiceDesc is the grpc.ServiceDesc for WAL service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -241,6 +241,10 @@ var WAL_ServiceDesc = grpc.ServiceDesc{ ServiceName: "cnpgi.adapter.v1.WAL", HandlerType: (*WALServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "GetCapabilities", + Handler: _WAL_GetCapabilities_Handler, + }, { MethodName: "Archive", Handler: _WAL_Archive_Handler, @@ -257,10 +261,6 @@ var WAL_ServiceDesc = grpc.ServiceDesc{ MethodName: "SetFirstRequired", Handler: _WAL_SetFirstRequired_Handler, }, - { - MethodName: "GetCapabilities", - Handler: _WAL_GetCapabilities_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/wal.proto", diff --git a/proto/operator.proto b/proto/operator.proto new file mode 100644 index 0000000..4e66edd --- /dev/null +++ b/proto/operator.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; +package cnpgi.adapter.v1; +option go_package = "github.com/cloudnative-pg/cnpg-i/pkg/operator"; + +service Operator { + // GetCapabilities gets the capabilities of the WAL service + rpc GetCapabilities(OperatorCapabilitiesRequest) returns (OperatorCapabilitiesResult) {} + + // ValidateCreate improves the behaviour of the validating webhook that + // is called on creation of the Cluster resources + rpc ValidateClusterCreate(OperatorValidateClusterCreateRequest) returns (OperatorValidateClusterCreateResult) {} + + // ValidateClusterChange improves the behavior of the validating webhook of + // is called on updates of the Cluster resources + rpc ValidateClusterChange(OperatorValidateClusterChangeRequest) returns (OperatorValidateClusterChangeResult) {} + + // MutateCluster fills in the defaults inside a Cluster resource + rpc MutateCluster(OperatorMutateClusterRequest) returns (OperatorMutateClusterResult) {} + + // MutatePod reconciles a Pod definition before it + // is applied in the Kubernetes cluster + rpc MutatePod(OperatorMutatePodRequest) returns (OperatorMutatePodResult) {} +} + +message OperatorMutatePodRequest { + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Pod that is being applied + string definition = 1; +} + +message OperatorMutatePodResult { + // This field is OPTIONAL. Value of this field is the JSON + // serialization of the Pod as modified by the plugin. + // If not present, the operator will assume that no changes + // have been requested by the plugins + string definition = 1; +} + +message OperatorCapabilitiesRequest { + // Intentionally empty. +} + +message OperatorCapabilitiesResult { + // All the capabilities that the controller service supports. This + // field is OPTIONAL. + repeated OperatorCapability capabilities = 1; +} + +message OperatorValidateClusterCreateRequest { + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that is being created + string definition = 1; +} + +message OperatorValidateClusterCreateResult { + // This field is OPTIONAL. Value of this field is a set + // of validation errors + repeated ValidationError validation_errors = 1; +} + +message OperatorValidateClusterChangeRequest { + // This field is REQUIRED. Value of this field is the JSON + // serialization of the current Cluster definition + string old_cluster = 1; + + // This field is REQUIRED. Value of this field is the JSON + // serialization of the updated Cluster definition + string new_cluster = 2; +} + +message OperatorValidateClusterChangeResult { + // This field is OPTIONAL. Value of this field is a set + // of validation errors + repeated ValidationError validation_errors = 1; +} + +message OperatorMutateClusterRequest { + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that should receive the + // default values + string definition = 1; +} + +message OperatorMutateClusterResult { + // This field is REQUIRED. Value of this field is the JSON + // serialization of the Cluster that have received the + // default values + string definition = 1; +} + +message ValidationError { + // This field is REQUIRED. Value of this field is + repeated string path_components = 1; + + // This field is REQUIRED. Value of this field is + // the value that caused a validation error + string value = 2; + + // This field is REQUIRED. Value of this field is a + // description of the validation error + string message = 3; +} + +message OperatorCapability { + message RPC { + enum Type { + TYPE_UNSPECIFIED = 0; + + // TYPE_VALIDATE_CLUSTER_CREATE indicates that the Plugin is able to + // reply to the ValidateClusterCreate RPC request + TYPE_VALIDATE_CLUSTER_CREATE = 1; + + // TYPE_VALIDATE_CLUSTER_CHANGE indicates that the Plugin is able to + // reply to the ValidateClusterChange RPC request + TYPE_VALIDATE_CLUSTER_CHANGE = 2; + + // TYPE_MUTATE_CLUSTER indicates that the Plugin is able to + // reply to the MutateCluster RPC request + TYPE_MUTATE_CLUSTER = 3; + + // TYPE_MUTATE_POD indicates that the Plugin is able to + // reply to the MutatePod RPC request + TYPE_MUTATE_POD = 4; + } + + Type type = 1; + } + + oneof type { + RPC rpc = 1; + } +} diff --git a/proto/wal.proto b/proto/wal.proto index 686d18a..5ad3d2f 100644 --- a/proto/wal.proto +++ b/proto/wal.proto @@ -3,6 +3,9 @@ package cnpgi.adapter.v1; option go_package = "github.com/cloudnative-pg/cnpg-i/pkg/wal"; service WAL { + // GetCapabilities gets the capabilities of the WAL service + rpc GetCapabilities(WALCapabilitiesRequest) returns (WALCapabilitiesResult) {} + // Archive copies one WAL file into the archive rpc Archive(WALArchiveRequest) returns (WALArchiveResult) {} @@ -14,9 +17,6 @@ service WAL { // SetFirstRequired sets the first required WAL for the cluster rpc SetFirstRequired(SetFirstRequiredRequest) returns (SetFirstRequiredResult) {} - - // GetCapabilities gets the capabilities of the WAL service - rpc GetCapabilities(WALCapabilitiesRequest) returns (WALCapabilitiesResult) {} } message WALArchiveRequest { diff --git a/scripts/build.sh b/scripts/build.sh index ef2f57b..ec53dc9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,10 +5,7 @@ cd "$(dirname "$0")/.." || exit # Recompile protobuf specification protoc --go_out=. --go_opt=module=github.com/cloudnative-pg/cnpg-i \ --go-grpc_out=. --go-grpc_opt=module=github.com/cloudnative-pg/cnpg-i \ - proto/wal.proto -protoc --go_out=. --go_opt=module=github.com/cloudnative-pg/cnpg-i \ - --go-grpc_out=. --go-grpc_opt=module=github.com/cloudnative-pg/cnpg-i \ - proto/identity.proto + proto/*.proto # Compile client go build `go list ./... | grep -v 'vendor'`