Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithMetadataConfig ¶
WithMetadataConfig loads config from a GCE VM environment, in particular loading metadata from GCE's instance metadata. https://cloud.google.com/compute/docs/storing-retrieving-metadata
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend represents the GCE backend, which provides and interface for both scheduling and scaling.
func NewBackend ¶
NewBackend returns a new Google Cloud Engine Backend instance.
func (*Backend) GetOffer ¶
GetOffer returns an offer based on available Google Cloud VM node instances.
func (*Backend) ShouldStartNode ¶
ShouldStartNode tells the scaler loop which nodes belong to this backend, basically.
type Client ¶
type Client interface { Templates() []pbs.Node StartNode(tplName, serverAddress, nodeID string) error }
Client is the interface the scheduler/scaler uses to interact with the GCE API. Mainly, the scheduler needs to be able to look up an instance template, or start a node instance.
type Metadata ¶
type Metadata struct { Instance struct { Name string Hostname string Zone string Attributes struct { FunnelConfig string `json:"funnel-config"` FunnelNodeServerAddress string `json:"funnel-node-serveraddress"` } } Project struct { ProjectID string `json:"projectId"` } }
Metadata contains a subset of details available from GCE VM metadata.
func LoadMetadata ¶
LoadMetadata loads metadata from the GCE VM metadata server.
func LoadMetadataFromURL ¶
LoadMetadataFromURL loads metadata from the given URL.
type MockBackend ¶
type MockBackend struct { *Backend InstancesInserted []*compute.Instance // contains filtered or unexported fields }
MockBackend is a GCE backend that doesn't communicate with Google Cloud APIs, which is useful for testing.
func NewMockBackend ¶
func NewMockBackend(conf config.Config, fac scheduler.WorkerFactory) (*MockBackend, error)
NewMockBackend returns a GCE scheduler backend that doesn't communicate with Google Cloud APIs, Useful for testing.
func (*MockBackend) InsertInstance ¶
func (m *MockBackend) InsertInstance(project, zone string, i *compute.Instance) (*compute.Operation, error)
InsertInstance defines a mock implementation of the Wrapper interface which starts an in-memory node routine.
func (*MockBackend) ListInstanceTemplates ¶
func (m *MockBackend) ListInstanceTemplates(proj string) (*compute.InstanceTemplateList, error)
ListInstanceTemplates defines a mock implementation of the Wrapper interface which returns a hard-coded list of instance templates.
func (*MockBackend) ListMachineTypes ¶
func (m *MockBackend) ListMachineTypes(proj, zone string) (*compute.MachineTypeList, error)
ListMachineTypes defines a mock implementation of the Wrapper interface which returns a hard-coded list of machine types.
type Wrapper ¶
type Wrapper interface { InsertInstance(project, zone string, instance *compute.Instance) (*compute.Operation, error) ListMachineTypes(project, zone string) (*compute.MachineTypeList, error) ListInstanceTemplates(project string) (*compute.InstanceTemplateList, error) }
Wrapper represents a simpler version of the Google Cloud Compute Service interface provided by the google library. The GCE client API is very complex and hard to test against, so this wrapper simplifies things down to only what funnel needs.