Documentation ¶
Index ¶
- type APIAlert
- type AlertServicer
- type DockerClient
- func (c DockerClient) Close()
- func (c DockerClient) NodeReadyCnt(ctx context.Context, manager bool) (int, error)
- func (c DockerClient) ServiceInspect(ctx context.Context, serviceID string) (swarm.Service, error)
- func (c DockerClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
- func (c DockerClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, ...) error
- type InfoListUpdaterNodeLister
- type Inspector
- type NodeScaler
- type NodeScaling
- type ReschedulerServicer
- type ResolveDeltaOptions
- type ScaleDirection
- type ScalerServicer
- type UpdaterInspector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIAlert ¶
APIAlert are alerts from alertmanager
func FetchAlerts ¶
FetchAlerts gets alerts from alertmanager https://github.com/prometheus/alertmanager/blob/5aff15b30fd10459b9ebf0ef754e1794b9ffd1ff/cli/alert.go#L86 Use for testing purposes only
type AlertServicer ¶
type AlertServicer interface { Send(alertName string, serviceName string, request string, status string, message string) error }
AlertServicer interface to send alerts
func NewAlertService ¶
func NewAlertService(url string, alertTimeout time.Duration) AlertServicer
NewAlertService creates new AlertService
func NewSilentAlertService ¶
func NewSilentAlertService() AlertServicer
NewSilentAlertService creates a silent alert service
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps `*client.Client` in docker
func NewDockerClientFromEnv ¶
func NewDockerClientFromEnv() (DockerClient, error)
NewDockerClientFromEnv returns a `*client.Client` struct
func (DockerClient) NodeReadyCnt ¶
NodeReadyCnt wraps `dc.NodeList`
func (DockerClient) ServiceInspect ¶
ServiceInspect wraps `dc.ServiceInspect`
func (DockerClient) ServiceList ¶
func (c DockerClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
ServiceList wraps `dc.ServiceList`
func (DockerClient) ServiceUpdate ¶
func (c DockerClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec) error
ServiceUpdate wraps `dc.ServiceUpdate`
type InfoListUpdaterNodeLister ¶
type InfoListUpdaterNodeLister interface { NodeReadyCnt(ctx context.Context, manager bool) (int, error) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) ServiceInspect(ctx context.Context, serviceID string) (swarm.Service, error) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec) error }
InfoListUpdaterNodeLister is an interface needd for rescheduling events
type Inspector ¶
type Inspector interface {
ServiceInspect(ctx context.Context, serviceID string) (swarm.Service, error)
}
Inspector is an interface for inspecting services
type NodeScaler ¶
type NodeScaler struct {
// contains filtered or unexported fields
}
NodeScaler scales nodes
func (*NodeScaler) Scale ¶
func (s *NodeScaler) Scale(ctx context.Context, by uint64, direction ScaleDirection, nodeType cloud.NodeType, serviceName string) (uint64, uint64, error)
Scale scales nodes returns 1. number of nodes before scaling 2. number of nodes after scaling
func (NodeScaler) String ¶
func (s NodeScaler) String() string
String adapts to the String interface
type NodeScaling ¶
type NodeScaling interface { Scale(ctx context.Context, by uint64, direction ScaleDirection, nodeType cloud.NodeType, serviceName string) (uint64, uint64, error) String() string }
NodeScaling is an interface for node scaling
func NewNodeScaler ¶
func NewNodeScaler(cloudProvider cloud.Cloud, inspector Inspector, managerOpts, workerOpts ResolveDeltaOptions) NodeScaling
NewNodeScaler returns new node scaler
type ReschedulerServicer ¶
type ReschedulerServicer interface { RescheduleService(serviceID, value string) error RescheduleServicesWaitForNodes(manager bool, targetNodeCnt int, value string, tickerC chan<- time.Time, errorC chan<- error, statusC chan<- string) RescheduleAll(value string) (string, error) IsWaitingToReschedule() bool }
ReschedulerServicer is an interface for rescheduling services
func NewReschedulerService ¶
func NewReschedulerService( c InfoListUpdaterNodeLister, filterLabel string, envKey string, tickerInterval time.Duration, timeOut time.Duration) (ReschedulerServicer, error)
NewReschedulerService creates a reschduler
type ResolveDeltaOptions ¶
type ResolveDeltaOptions struct { MinLabel string MaxLabel string ScaleDownByLabel string ScaleUpByLabel string DefaultMin uint64 DefaultMax uint64 DefaultScaleDownBy uint64 DefaultScaleUpBy uint64 }
ResolveDeltaOptions are options for resolving changes in scaling
type ScaleDirection ¶
type ScaleDirection string
ScaleDirection is an enum for scaling up or scaling down
const ( // ScaleUpDirection denote scale up ScaleUpDirection ScaleDirection = "up" // ScaleDownDirection denote scale down ScaleDownDirection ScaleDirection = "down" )
type ScalerServicer ¶
type ScalerServicer interface {
Scale(ctx context.Context, serviceName string, by uint64, direction ScaleDirection) (string, bool, error)
}
ScalerServicer interface for resizing services
func NewScalerService ¶
func NewScalerService( c UpdaterInspector, resolveOpts ResolveDeltaOptions, ) ScalerServicer
NewScalerService creates a New Docker Swarm Client