Documentation
¶
Overview ¶
Package cloud creates and deletes servers through cloud provider APIs for provider-backed node pools (§6.5). Each provider implements Provider; servers carry a pool label so they can be listed back.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Types = []string{"hetzner", "digitalocean", "webhook"}
Types lists the supported providers.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Token string `json:"token,omitempty"` // hetzner, digitalocean, webhook (optional bearer)
URL string `json:"url,omitempty"` // webhook; base URL override for the others (tests)
}
Config holds every provider type's settings; only the type's are used. Tokens and URLs are secrets (sealed at rest).
type Provider ¶
type Provider interface {
CreateServer(ctx context.Context, s ServerSpec) (Server, error)
DeleteServer(ctx context.Context, id string) error
// ListServers lists servers carrying a label.
ListServers(ctx context.Context, labelKey, labelValue string) ([]Server, error)
}
Provider is a cloud API.
type Server ¶
type Server struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
IP string `json:"ip"`
}
Server is a provider's server.
type ServerSpec ¶
type ServerSpec struct {
Name string `json:"name"`
Region string `json:"region"`
Type string `json:"type"` // instance type / size
Image string `json:"image"` // OS image
SSHKeys []string `json:"sshKeys,omitempty"`
UserData string `json:"userData"` // cloud-init: joins the cluster
Labels map[string]string `json:"labels"`
}
ServerSpec describes a server to create.