Documentation ¶
Overview ¶
Package metadata defines the grpc metadata service and the server code.
Index ¶
- Constants
- Variables
- func RegisterMetadataServer(s grpc.ServiceRegistrar, srv MetadataServer)
- type Connection
- type Event
- func (*Event) Descriptor() ([]byte, []int)deprecated
- func (x *Event) GetKind() string
- func (x *Event) GetMeta() string
- func (x *Event) GetReason() string
- func (x *Event) GetRefs() *References
- func (x *Event) GetSpec() string
- func (x *Event) GetStatus() string
- func (x *Event) GetUid() string
- func (*Event) ProtoMessage()
- func (x *Event) ProtoReflect() protoreflect.Message
- func (x *Event) Reset()
- func (x *Event) String() string
- type ListOfStrings
- type MetadataClient
- type MetadataServer
- type Metadata_WatchClient
- type Metadata_WatchServer
- type References
- type Selector
- func (*Selector) Descriptor() ([]byte, []int)deprecated
- func (x *Selector) GetNodeName() string
- func (x *Selector) GetResourceKinds() map[string]string
- func (*Selector) ProtoMessage()
- func (x *Selector) ProtoReflect() protoreflect.Message
- func (x *Selector) Reset()
- func (x *Selector) String() string
- type Server
- type SpecFields
- type StatusFields
- type UnimplementedMetadataServer
- type UnsafeMetadataServer
Constants ¶
const (
Metadata_Watch_FullMethodName = "/metadata.Metadata/Watch"
)
Variables ¶
var File_metadata_metadata_proto protoreflect.FileDescriptor
var Metadata_ServiceDesc = grpc.ServiceDesc{ ServiceName: "metadata.Metadata", HandlerType: (*MetadataServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Watch", Handler: _Metadata_Watch_Handler, ServerStreams: true, }, }, Metadata: "metadata/metadata.proto", }
Metadata_ServiceDesc is the grpc.ServiceDesc for Metadata service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMetadataServer ¶
func RegisterMetadataServer(s grpc.ServiceRegistrar, srv MetadataServer)
Types ¶
type Connection ¶
type Connection struct { Stream Metadata_WatchServer Selector *Selector // contains filtered or unexported fields }
Connection used to track a subscriber connection. Each time a subscriber arrives a Connection is created and stored for later use by the Broker.
func (*Connection) Close ¶
func (c *Connection) Close(err error)
Close closes the connection. It makes sure that the close is done only once to avoid deadlocks.
type Event ¶
type Event struct { Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"` Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"` Meta *string `protobuf:"bytes,4,opt,name=meta,proto3,oneof" json:"meta,omitempty"` Spec *string `protobuf:"bytes,5,opt,name=spec,proto3,oneof" json:"spec,omitempty"` Status *string `protobuf:"bytes,6,opt,name=status,proto3,oneof" json:"status,omitempty"` Refs *References `protobuf:"bytes,7,opt,name=refs,proto3,oneof" json:"refs,omitempty"` // contains filtered or unexported fields }
An Event is received in response to a Watch rpc. It contains the metadata for a given resource.
func (*Event) Descriptor
deprecated
func (*Event) GetRefs ¶
func (x *Event) GetRefs() *References
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
func (*Event) ProtoReflect ¶
func (x *Event) ProtoReflect() protoreflect.Message
type ListOfStrings ¶
type ListOfStrings struct { List []string `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` // contains filtered or unexported fields }
func (*ListOfStrings) Descriptor
deprecated
func (*ListOfStrings) Descriptor() ([]byte, []int)
Deprecated: Use ListOfStrings.ProtoReflect.Descriptor instead.
func (*ListOfStrings) GetList ¶
func (x *ListOfStrings) GetList() []string
func (*ListOfStrings) ProtoMessage ¶
func (*ListOfStrings) ProtoMessage()
func (*ListOfStrings) ProtoReflect ¶
func (x *ListOfStrings) ProtoReflect() protoreflect.Message
func (*ListOfStrings) Reset ¶
func (x *ListOfStrings) Reset()
func (*ListOfStrings) String ¶
func (x *ListOfStrings) String() string
type MetadataClient ¶
type MetadataClient interface { // Returns a stream of events for the resources that match the selector. Watch(ctx context.Context, in *Selector, opts ...grpc.CallOption) (Metadata_WatchClient, error) }
MetadataClient is the client API for Metadata 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.
func NewMetadataClient ¶
func NewMetadataClient(cc grpc.ClientConnInterface) MetadataClient
type MetadataServer ¶
type MetadataServer interface { // Returns a stream of events for the resources that match the selector. Watch(*Selector, Metadata_WatchServer) error // contains filtered or unexported methods }
MetadataServer is the server API for Metadata service. All implementations must embed UnimplementedMetadataServer for forward compatibility
type Metadata_WatchClient ¶
type Metadata_WatchClient interface { Recv() (*Event, error) grpc.ClientStream }
type Metadata_WatchServer ¶
type Metadata_WatchServer interface { Send(*Event) error grpc.ServerStream }
type References ¶
type References struct { Resources map[string]*ListOfStrings `` /* 159-byte string literal not displayed */ // contains filtered or unexported fields }
References holds the references to other resources. Ex. an event for a pod resource will hold references to deployments/replicasets/services and other resources linked to it. Entries are [resourceKind, UID].
func (*References) Descriptor
deprecated
func (*References) Descriptor() ([]byte, []int)
Deprecated: Use References.ProtoReflect.Descriptor instead.
func (*References) GetResources ¶
func (x *References) GetResources() map[string]*ListOfStrings
func (*References) ProtoMessage ¶
func (*References) ProtoMessage()
func (*References) ProtoReflect ¶
func (x *References) ProtoReflect() protoreflect.Message
func (*References) Reset ¶
func (x *References) Reset()
func (*References) String ¶
func (x *References) String() string
type Selector ¶
type Selector struct { NodeName string `protobuf:"bytes,1,opt,name=nodeName,proto3" json:"nodeName,omitempty"` ResourceKinds map[string]string `` /* 167-byte string literal not displayed */ // contains filtered or unexported fields }
A Selector defines the resource types for which a client wants to receive the metadata. For each resource the client can choose to filter them by node. Ex. [pod, NodeName] the client will receive only pods that run on the specified node. nodeName is used to identify the client.
func (*Selector) Descriptor
deprecated
func (*Selector) GetNodeName ¶
func (*Selector) GetResourceKinds ¶
func (*Selector) ProtoMessage ¶
func (*Selector) ProtoMessage()
func (*Selector) ProtoReflect ¶
func (x *Selector) ProtoReflect() protoreflect.Message
type Server ¶
type Server struct { UnimplementedMetadataServer // contains filtered or unexported fields }
Server grpc server started by the broker that listens for new connections from subscribers.
func New ¶
func New(logger logr.Logger, subs *sync.Map, collectors map[string]subscriber.SubsChan, group *sync.WaitGroup) *Server
New returns a new Server.
func (*Server) Watch ¶
func (s *Server) Watch(selector *Selector, stream Metadata_WatchServer) error
Watch accepts a Selector and returns a stream of metadata to the client. On each watch it creates a Connection for the client and stores it for later use by the broker. On each new watch it triggers the dispatch of existing metadata to the subscriber for each watched resource.
type SpecFields ¶
type SpecFields struct { Fields map[string]string `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
func (*SpecFields) Descriptor
deprecated
func (*SpecFields) Descriptor() ([]byte, []int)
Deprecated: Use SpecFields.ProtoReflect.Descriptor instead.
func (*SpecFields) GetFields ¶
func (x *SpecFields) GetFields() map[string]string
func (*SpecFields) ProtoMessage ¶
func (*SpecFields) ProtoMessage()
func (*SpecFields) ProtoReflect ¶
func (x *SpecFields) ProtoReflect() protoreflect.Message
func (*SpecFields) Reset ¶
func (x *SpecFields) Reset()
func (*SpecFields) String ¶
func (x *SpecFields) String() string
type StatusFields ¶
type StatusFields struct { Fields map[string]string `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
func (*StatusFields) Descriptor
deprecated
func (*StatusFields) Descriptor() ([]byte, []int)
Deprecated: Use StatusFields.ProtoReflect.Descriptor instead.
func (*StatusFields) GetFields ¶
func (x *StatusFields) GetFields() map[string]string
func (*StatusFields) ProtoMessage ¶
func (*StatusFields) ProtoMessage()
func (*StatusFields) ProtoReflect ¶
func (x *StatusFields) ProtoReflect() protoreflect.Message
func (*StatusFields) Reset ¶
func (x *StatusFields) Reset()
func (*StatusFields) String ¶
func (x *StatusFields) String() string
type UnimplementedMetadataServer ¶
type UnimplementedMetadataServer struct { }
UnimplementedMetadataServer must be embedded to have forward compatible implementations.
func (UnimplementedMetadataServer) Watch ¶
func (UnimplementedMetadataServer) Watch(*Selector, Metadata_WatchServer) error
type UnsafeMetadataServer ¶
type UnsafeMetadataServer interface {
// contains filtered or unexported methods
}
UnsafeMetadataServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MetadataServer will result in compilation errors.