Documentation
¶
Overview ¶
Package clients contains common logic and data structures for the supported cloud providers.
Package ec2 is a thin wrapper around the EC2 Client. Along with that it provides a few additions, like grabbing the instance IDs that have a predefined tag which we use to identify resources.
Index ¶
Constants ¶
const ( TypeEC2 string = "ec2" TypeRDS string = "rds" )
const ( StatusStopped string = "STOPPED" StatusRunning string = "RUNNING" StatusPending string = "PENDING" )
const StatusAvailable = "available"
Variables ¶
This section is empty.
Functions ¶
func GetUniqueTags ¶
GetUniqueTags makes a call through the EC2 client to collect all instance tags and returns a set of them
Types ¶
type ClientCache ¶
ClientCache holds the client and cache objects.
func GetClient ¶
func GetClient() (ClientCache, error)
GetClient returns a ready to use kubernetes client and cache.
type CloudResource ¶
type CloudResource interface { Start(startInput ResourceStartInput) error Stop(stopInput ResourceStopInput) error Status() (ResourceStatusOutput, error) }
CloudResource provides generic Resource interface. A Resource is a group of instances which can be started or stopped. The interface also requires a method to list their statuses.
func ResourceFactory ¶
func ResourceFactory(resType, tag string) (CloudResource, error)
ResourceFactory generates structs that abide by the CloudResource interface. The returned struct can start, stop, and list instances. Each new integration needso to be added to this factory function.
type EC2Monitor ¶
type EC2Monitor struct {
Type string
}
func (*EC2Monitor) GetNewResources ¶
func (m *EC2Monitor) GetNewResources(clusterResources map[string]bool) ([]string, error)
GetNewResources compares the local cluster resources with the ones returned from EC2 and gives back a list of resources that need to be created on the cluster.
type EC2Resource ¶
type EC2Resource struct {
NameTag string
}
Resource represents a collection of EC2 instances grouped by a common "resource-booking/application" tag.
func (*EC2Resource) Start ¶
func (r *EC2Resource) Start(startInput ResourceStartInput) error
Start makes a call through the EC2 client to start resource instances by their IDs.
func (*EC2Resource) Status ¶
func (r *EC2Resource) Status() (ResourceStatusOutput, error)
Status returns the current summary of a given resource instance statuses. It makes a call through the EC2 client with a given set of instance IDs and summarises their status (active vs running).
func (*EC2Resource) Stop ¶
func (r *EC2Resource) Stop(stopInput ResourceStopInput) error
Stop makes a call through the EC2 client to stop the instances that belong to the resource.
type RDSInstanceDetails ¶
type RDSMonitor ¶
type RDSMonitor struct {
Type string
}
func (*RDSMonitor) GetNewResources ¶
func (m *RDSMonitor) GetNewResources(clusterResources map[string]bool) ([]string, error)
type RDSResource ¶
type RDSResource struct {
NameTag string
}
func (*RDSResource) Start ¶
func (r *RDSResource) Start(startInput ResourceStartInput) error
func (*RDSResource) Status ¶
func (r *RDSResource) Status() (ResourceStatusOutput, error)
func (*RDSResource) Stop ¶
func (r *RDSResource) Stop(stopInput ResourceStopInput) error
type ResourceMonitor ¶
type ResourceMonitor interface {
GetNewResources(clusterResources map[string]bool) ([]string, error)
}
func MonitorFactory ¶
func MonitorFactory(monitorType string) (ResourceMonitor, error)
MonitorFactory generates structs that abide by the ResourceMonitor interface. The returned struct can get new resources of the specified type. Each new integration needso to be added to this factory function.
type ResourceStartInput ¶
type ResourceStartInput struct {
UID, EndAt string
}
ResourceStartInput stores data that is used for book-keeping during the starting of the resource
type ResourceStatusOutput ¶
ResourceStatusOutput holds the status summary of the resource.
type ResourceStopInput ¶
type ResourceStopInput struct {
UID string
}
ResourceStartInput stores data that is used for book-keeping during the stopping of the resource