Documentation
¶
Overview ¶
Package operator provides the Operator gRPC service implementation.
Index ¶
- type DrainNotification
- type InstanceManager
- type Options
- type Service
- func (s *Service) AcknowledgeDrained(ctx context.Context, req *proto.DrainAckRequest) (*emptypb.Empty, error)
- func (s *Service) CreateInstance(ctx context.Context, req *proto.CreateInstanceRequest) (*proto.CreateInstanceResponse, error)
- func (s *Service) DeleteGroup(ctx context.Context, req *proto.DeleteGroupRequest) (*emptypb.Empty, error)
- func (s *Service) DeleteInstance(ctx context.Context, req *proto.DeleteInstanceRequest) (*proto.DeleteInstanceResponse, error)
- func (s *Service) GetConfigStatus(ctx context.Context, req *emptypb.Empty) (*proto.ConfigStatusResponse, error)
- func (s *Service) GetInstanceStatus(ctx context.Context, req *proto.GetInstanceStatusRequest) (*proto.InstanceStatusResponse, error)
- func (s *Service) ListGroups(ctx context.Context, req *emptypb.Empty) (*proto.ListGroupsResponse, error)
- func (s *Service) NotifyDrain(notification DrainNotification)
- func (s *Service) NotifyError(event *proto.ErrorEvent)
- func (s *Service) NotifyGroupEvent(event *proto.GroupEvent)
- func (s *Service) RefreshConfig(ctx context.Context, req *emptypb.Empty) (*proto.RefreshConfigResponse, error)
- func (s *Service) RenewCertificate(ctx context.Context, req *proto.RenewCertificateRequest) (*proto.RenewCertificateResponse, error)
- func (s *Service) UpsertGroup(ctx context.Context, req *proto.UpsertGroupRequest) (*proto.GroupStatus, error)
- func (s *Service) WatchErrors(req *emptypb.Empty, stream proto.OperatorService_WatchErrorsServer) error
- func (s *Service) WatchGroups(req *emptypb.Empty, stream proto.OperatorService_WatchGroupsServer) error
- func (s *Service) WatchInstances(req *emptypb.Empty, stream proto.OperatorService_WatchInstancesServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DrainNotification ¶
type DrainNotification struct {
InstanceID string
Group string
Reason string
UnhealthyAt time.Time
DeleteAt time.Time
}
DrainNotification represents a drain notification event
type InstanceManager ¶
type InstanceManager interface {
CreateInstance(ctx context.Context, req instances.CreateInstanceRequest) (*instances.CreateInstanceResponse, error)
DeleteInstance(ctx context.Context, instanceID string) error
GetInstanceStatus(ctx context.Context, instanceID string) (*instances.InstanceStatus, error)
}
InstanceManager interface for instance operations
type Options ¶
type Options struct {
ConfigLoader *serverconfig.Loader
LocalDB *localdb.DB
InstanceManager InstanceManager
OnGroupChanged func(tenant, groupKey string)
OnDrainAcked func(instanceID string)
Logger *slog.Logger
// Certificate renewal dependencies
ClusterStorage storage.Storage
CACertPEM []byte
CAKeyPEM []byte
IsClusterLeader func() bool
}
Options contains options for creating an OperatorService
type Service ¶
type Service struct {
proto.UnimplementedOperatorServiceServer
// contains filtered or unexported fields
}
Service implements the OperatorService gRPC service
func (*Service) AcknowledgeDrained ¶
func (*Service) CreateInstance ¶
func (s *Service) CreateInstance(ctx context.Context, req *proto.CreateInstanceRequest) (*proto.CreateInstanceResponse, error)
func (*Service) DeleteGroup ¶
func (*Service) DeleteInstance ¶
func (s *Service) DeleteInstance(ctx context.Context, req *proto.DeleteInstanceRequest) (*proto.DeleteInstanceResponse, error)
func (*Service) GetConfigStatus ¶
func (*Service) GetInstanceStatus ¶
func (s *Service) GetInstanceStatus(ctx context.Context, req *proto.GetInstanceStatusRequest) (*proto.InstanceStatusResponse, error)
func (*Service) ListGroups ¶
func (*Service) NotifyDrain ¶
func (s *Service) NotifyDrain(notification DrainNotification)
NotifyDrain sends a drain notification to the connected operator (if any)
func (*Service) NotifyError ¶
func (s *Service) NotifyError(event *proto.ErrorEvent)
NotifyError sends an error event to the connected operator (if any)
func (*Service) NotifyGroupEvent ¶
func (s *Service) NotifyGroupEvent(event *proto.GroupEvent)
NotifyGroupEvent sends a group change event to the connected operator (if any)
func (*Service) RefreshConfig ¶
func (*Service) RenewCertificate ¶
func (s *Service) RenewCertificate(ctx context.Context, req *proto.RenewCertificateRequest) (*proto.RenewCertificateResponse, error)
func (*Service) UpsertGroup ¶
func (s *Service) UpsertGroup(ctx context.Context, req *proto.UpsertGroupRequest) (*proto.GroupStatus, error)
func (*Service) WatchErrors ¶
func (s *Service) WatchErrors(req *emptypb.Empty, stream proto.OperatorService_WatchErrorsServer) error
WatchErrors streams error events (provider errors, config validation failures) to the operator.
func (*Service) WatchGroups ¶
func (s *Service) WatchGroups(req *emptypb.Empty, stream proto.OperatorService_WatchGroupsServer) error
WatchGroups streams group change events to the operator. On connection, sends all current groups as UPSERT events (initial snapshot).
func (*Service) WatchInstances ¶
func (s *Service) WatchInstances(req *emptypb.Empty, stream proto.OperatorService_WatchInstancesServer) error
WatchInstances streams instance events to the operator for drain coordination. On connection, sends all pending drain instances as initial snapshot.