Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleResource ¶
Types ¶
type BaseResource ¶
type BaseResource struct {
ID string `schema:"id"`
}
BaseResource is a resource that can have multiple instances
func (*BaseResource) SetID ¶
func (b *BaseResource) SetID(id string)
SetID sets the id of the specific resource
type Config ¶
type Config struct {
// Provider is the provider used by the operator
Provider Provider
// Backends are the list of backends handled by the operator
HandlerFactories []HandlerFactory
}
Config is the parametrization of the operator server
type Handler ¶
type Handler interface {
// Reconcile is called whenever there is an internal state change in the cluster
Reconcile(executor Executor, e *proto.Cluster, node *proto.Node, plan *proto.Plan) error
// EvaluatePlan evaluates and modifies the execution plan
EvaluatePlan(plan *proto.Plan) error
// Spec returns the specification for the cluster
Spec() *Spec
// Client returns a connection with a specific node in the cluster
Client(node *proto.Node) (interface{}, error)
}
Handler is the interface that needs to be implemented by the backend
type Nodetype ¶
type Nodetype struct {
// Image is the default docker image for the node
Image string
// Version is the default docker image for the node
Version string
// Volume is a list volumes for this node type
Volumes []*Volume
// Ports is a list of ports for this node type
Ports []*Port
}
Nodetype is a type of node for the Backend
type Provider ¶
type Provider interface {
// Setup setups the provider (Maybe do this on the factory)
Setup() error
// Start starts the provider
Start() error
// CreateResource creates the computational resource
CreateResource(*proto.Node) (*proto.Node, error)
// DeleteResource deletes the computational resource
DeleteResource(*proto.Node) (*proto.Node, error)
// Exec executes a shell script
Exec(handler string, path string, args ...string) error
// Update the status of the node
UpdateNodeStatus(*proto.Node) (*proto.Node, error)
// LoadCluster loads a Cluster at the specific resourceVersion
LoadCluster(name string) (*proto.Cluster, error)
// GetTask receives updates for ensembles
GetTask() (*proto.Task, error)
// FinalizeTask is used to notify the provider that the given task is done
FinalizeTask(uuid string) error
}
Provider is the entity that holds the state of the infrastructure. Both for the computing resources and the general resources.
type ProviderFactory ¶
ProviderFactory is a factory method to create factories
type Resource ¶
type Resource interface {
GetName() string
Delete(conn interface{}) error
Reconcile(conn interface{}) error
}
Resource is a resource in the cluster
type Server ¶
type Server struct {
Provider Provider
// contains filtered or unexported fields
}
Server is the operator server
func TestOperator ¶
func TestOperator(t *testing.T, provider Provider, factory HandlerFactory) *Server
Click to show internal directories.
Click to hide internal directories.