Documentation ¶
Index ¶
- Variables
- func StackLabelArg(stackID string) filters.KeyValuePair
- type BackendAPIClientShim
- func (c *BackendAPIClientShim) CreateStack(create types.StackSpec) (types.StackCreateResponse, error)
- func (c *BackendAPIClientShim) DeleteStack(id string) error
- func (c *BackendAPIClientShim) SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
- func (c *BackendAPIClientShim) UnsubscribeFromEvents(eventChan chan interface{})
- func (c *BackendAPIClientShim) UpdateStack(id string, spec types.StackSpec, version uint64) error
- type BackendClient
- type ReconcileKind
- type ReconcileResource
- type ReconcileState
- type SnapshotResource
- type SnapshotStack
- type StackStore
- type StacksBackend
- type SwarmConfigBackend
- type SwarmNetworkBackend
- type SwarmResourceAPIClientShim
- func (c *SwarmResourceAPIClientShim) CreateConfig(s swarm.ConfigSpec) (string, error)
- func (c *SwarmResourceAPIClientShim) CreateNetwork(nc dockerTypes.NetworkCreateRequest) (string, error)
- func (c *SwarmResourceAPIClientShim) CreateSecret(s swarm.SecretSpec) (string, error)
- func (c *SwarmResourceAPIClientShim) CreateService(spec swarm.ServiceSpec, encodedRegistryAuth string, queryRegistry bool) (*dockerTypes.ServiceCreateResponse, error)
- func (c *SwarmResourceAPIClientShim) GetConfig(id string) (swarm.Config, error)
- func (c *SwarmResourceAPIClientShim) GetConfigs(opts dockerTypes.ConfigListOptions) ([]swarm.Config, error)
- func (c *SwarmResourceAPIClientShim) GetNetwork(name string) (dockerTypes.NetworkResource, error)
- func (c *SwarmResourceAPIClientShim) GetNetworks(f filters.Args) ([]dockerTypes.NetworkResource, error)
- func (c *SwarmResourceAPIClientShim) GetNetworksByName(name string) ([]dockerTypes.NetworkResource, error)
- func (c *SwarmResourceAPIClientShim) GetNode(id string) (swarm.Node, error)
- func (c *SwarmResourceAPIClientShim) GetSecret(id string) (swarm.Secret, error)
- func (c *SwarmResourceAPIClientShim) GetSecrets(opts dockerTypes.SecretListOptions) ([]swarm.Secret, error)
- func (c *SwarmResourceAPIClientShim) GetService(idOrName string, insertDefaults bool) (swarm.Service, error)
- func (c *SwarmResourceAPIClientShim) GetServices(options dockerTypes.ServiceListOptions) ([]swarm.Service, error)
- func (c *SwarmResourceAPIClientShim) GetTask(taskID string) (swarm.Task, error)
- func (c *SwarmResourceAPIClientShim) GetTasks(options dockerTypes.TaskListOptions) ([]swarm.Task, error)
- func (c *SwarmResourceAPIClientShim) Info() swarm.Info
- func (c *SwarmResourceAPIClientShim) RemoveConfig(id string) error
- func (c *SwarmResourceAPIClientShim) RemoveNetwork(name string) error
- func (c *SwarmResourceAPIClientShim) RemoveSecret(idOrName string) error
- func (c *SwarmResourceAPIClientShim) RemoveService(idOrName string) error
- func (c *SwarmResourceAPIClientShim) UpdateConfig(idOrName string, version uint64, spec swarm.ConfigSpec) error
- func (c *SwarmResourceAPIClientShim) UpdateSecret(idOrName string, version uint64, spec swarm.SecretSpec) error
- func (c *SwarmResourceAPIClientShim) UpdateService(idOrName string, version uint64, spec swarm.ServiceSpec, ...) (*dockerTypes.ServiceUpdateResponse, error)
- type SwarmResourceBackend
- type SwarmSecretBackend
- type SwarmServiceBackend
Constants ¶
This section is empty.
Variables ¶
var ( DefaultGetServiceArg2 = false DefaultCreateServiceArg2 = "" DefaultCreateServiceArg3 = false DefaultUpdateServiceArg4 = dockerTypes.ServiceUpdateOptions{} DefaultUpdateServiceArg5 = false )
temporary constant arguments in order to track their uses
var ReconcileKinds = map[ReconcileKind]struct{}{ReconcileStack: {}, ReconcileNetwork: {}, ReconcileSecret: {}, ReconcileConfig: {}, ReconcileService: {}}
ReconcileKinds maps all the ReconcileKind enumerations for comparisons
Functions ¶
func StackLabelArg ¶
func StackLabelArg(stackID string) filters.KeyValuePair
StackLabelArg constructs the filters.KeyValuePair for API usage
Types ¶
type BackendAPIClientShim ¶
type BackendAPIClientShim struct { StacksBackend SwarmResourceBackend SwarmNetworkBackend SwarmConfigBackend SwarmSecretBackend SwarmServiceBackend // contains filtered or unexported fields }
BackendAPIClientShim is an implementation of BackendClient that utilizes an in-memory FakeStackStore for Stacks CRUD, and an underlying Docker API Client for swarm operations. It is intended for use only as part of the standalone runtime of the stacks controller. Only one event subscriber is expected at any time.
func (*BackendAPIClientShim) CreateStack ¶
func (c *BackendAPIClientShim) CreateStack(create types.StackSpec) (types.StackCreateResponse, error)
CreateStack creates a stack
func (*BackendAPIClientShim) DeleteStack ¶
func (c *BackendAPIClientShim) DeleteStack(id string) error
DeleteStack deletes a stack.
func (*BackendAPIClientShim) SubscribeToEvents ¶
func (c *BackendAPIClientShim) SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{})
SubscribeToEvents subscribes to the system event stream. The API Client's Events API has no way to distinguish between buffered and streamed events, thus even past are provided through the returned channel.
func (*BackendAPIClientShim) UnsubscribeFromEvents ¶
func (c *BackendAPIClientShim) UnsubscribeFromEvents(eventChan chan interface{})
UnsubscribeFromEvents unsubscribes from the event stream.
func (*BackendAPIClientShim) UpdateStack ¶
UpdateStack updates a stack.
type BackendClient ¶
type BackendClient interface { StacksBackend SwarmResourceBackend SwarmNetworkBackend SwarmConfigBackend SwarmSecretBackend SwarmServiceBackend // SubscribeToEvents and UnsubscribeFromEvents are part of the // system.Backend interface. SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{}) UnsubscribeFromEvents(chan interface{}) }
BackendClient is the full interface used by the Stacks Reconciler to consume Docker Events and act upon swarmkit resources. In the engine runtime, it is implemented directly by the docker/daemon.Daemon object. In the standalone test runtime, the BackendAPIClientShim allows a normal engine API to be used in its place.
func NewBackendAPIClientShim ¶
func NewBackendAPIClientShim(dclient client.CommonAPIClient, backend StacksBackend) BackendClient
NewBackendAPIClientShim creates a new BackendAPIClientShim.
type ReconcileKind ¶
type ReconcileKind = string
ReconcileKind is an enumeration the kind of resource held in a types.Stack
const ( // ReconcileConfig indicates that the Resource is swarm.Config ReconcileConfig ReconcileKind = events.ConfigEventType // ReconcileNetwork indicates that the Resource is dockerTypes.NetworkResource ReconcileNetwork ReconcileKind = events.NetworkEventType // ReconcileSecret indicates that the Resource is swarm.Secret ReconcileSecret ReconcileKind = events.SecretEventType // ReconcileService indicates that the Resource is swarm.Service ReconcileService ReconcileKind = events.ServiceEventType // ReconcileStack indicates that the Resource is types.Stack ReconcileStack ReconcileKind = types.StackEventType )
type ReconcileResource ¶
type ReconcileResource struct { SnapshotResource Mark ReconcileState Kind ReconcileKind StackID string Config interface{} }
ReconcileResource is part of the reconciliation datastructure for Stack resources
type ReconcileState ¶
type ReconcileState string
ReconcileState is an enumeration for reconciliation operations
const ( // ReconcileSkip defines the ReconcileState for Skipping ReconcileSkip ReconcileState = "SKIP" // ReconcileCreate defines the ReconcileState for Creating ReconcileCreate ReconcileState = "CREATE" // ReconcileCompare defines the ReconcileState for Compare ReconcileCompare ReconcileState = "COMPARE" // ReconcileSame defines the ReconcileState for No operation ReconcileSame ReconcileState = "SAME" // ReconcileUpdate defines the ReconcileState for Update ReconcileUpdate ReconcileState = "UPDATE" // ReconcileDelete defines the ReconcileState for Delete ReconcileDelete ReconcileState = "DELETE" )
type SnapshotResource ¶
SnapshotResource - identifying information of a created Resource
type SnapshotStack ¶
type SnapshotStack struct { SnapshotResource CurrentSpec types.StackSpec Services []SnapshotResource Networks []SnapshotResource Secrets []SnapshotResource Configs []SnapshotResource }
SnapshotStack - a stored version of a stack with types.StackSpec and ID's of created Resources
type StackStore ¶
type StackStore interface { AddStack(types.StackSpec) (string, error) UpdateStack(string, types.StackSpec, uint64) error UpdateSnapshotStack(string, SnapshotStack, uint64) (SnapshotStack, error) DeleteStack(string) error GetStack(id string) (types.Stack, error) GetSnapshotStack(id string) (SnapshotStack, error) ListStacks() ([]types.Stack, error) }
StackStore defines an interface to an arbitrary store which is able to perform CRUD operations for all objects required by the Stacks Controller.
type StacksBackend ¶
type StacksBackend interface { CreateStack(spec types.StackSpec) (types.StackCreateResponse, error) GetStack(id string) (types.Stack, error) GetSnapshotStack(id string) (SnapshotStack, error) ListStacks() ([]types.Stack, error) UpdateStack(id string, spec types.StackSpec, version uint64) error UpdateSnapshotStack(id string, spec SnapshotStack, version uint64) (SnapshotStack, error) DeleteStack(id string) error }
StacksBackend is the backend handler for Stacks within the engine. It is consumed by the API handlers, and by the Reconciler.
type SwarmConfigBackend ¶
type SwarmConfigBackend interface { GetConfigs(opts dockerTypes.ConfigListOptions) ([]swarm.Config, error) CreateConfig(s swarm.ConfigSpec) (string, error) RemoveConfig(id string) error GetConfig(id string) (swarm.Config, error) UpdateConfig(idOrName string, version uint64, spec swarm.ConfigSpec) error }
SwarmConfigBackend is a subset of the swarm.Backend interface, It includes all methods required to validate, provision and update manipulate Swarm Configs and their referenced resources.
type SwarmNetworkBackend ¶
type SwarmNetworkBackend interface { network.ClusterBackend }
SwarmNetworkBackend is a subset of the swarm.Backend interface, combined with the network.ClusterBackend interface. It includes all methods required to validate, provision and update manipulate Swarm Networks and their referenced resources.
type SwarmResourceAPIClientShim ¶
type SwarmResourceAPIClientShim struct {
// contains filtered or unexported fields
}
SwarmResourceAPIClientShim is an implementation of SwarmResourceBackend which uses an underlying client.CommonAPIClient to perform swarm and networking operations.
func (*SwarmResourceAPIClientShim) CreateConfig ¶
func (c *SwarmResourceAPIClientShim) CreateConfig(s swarm.ConfigSpec) (string, error)
CreateConfig creates a config.
func (*SwarmResourceAPIClientShim) CreateNetwork ¶
func (c *SwarmResourceAPIClientShim) CreateNetwork(nc dockerTypes.NetworkCreateRequest) (string, error)
CreateNetwork creates a new network.
func (*SwarmResourceAPIClientShim) CreateSecret ¶
func (c *SwarmResourceAPIClientShim) CreateSecret(s swarm.SecretSpec) (string, error)
CreateSecret creates a secret.
func (*SwarmResourceAPIClientShim) CreateService ¶
func (c *SwarmResourceAPIClientShim) CreateService(spec swarm.ServiceSpec, encodedRegistryAuth string, queryRegistry bool) (*dockerTypes.ServiceCreateResponse, error)
CreateService creates a new service.
func (*SwarmResourceAPIClientShim) GetConfig ¶
func (c *SwarmResourceAPIClientShim) GetConfig(id string) (swarm.Config, error)
GetConfig inspects a config.
func (*SwarmResourceAPIClientShim) GetConfigs ¶
func (c *SwarmResourceAPIClientShim) GetConfigs(opts dockerTypes.ConfigListOptions) ([]swarm.Config, error)
GetConfigs lists multiple configs.
func (*SwarmResourceAPIClientShim) GetNetwork ¶
func (c *SwarmResourceAPIClientShim) GetNetwork(name string) (dockerTypes.NetworkResource, error)
GetNetwork inspects a network.
func (*SwarmResourceAPIClientShim) GetNetworks ¶
func (c *SwarmResourceAPIClientShim) GetNetworks(f filters.Args) ([]dockerTypes.NetworkResource, error)
GetNetworks return a list of networks.
func (*SwarmResourceAPIClientShim) GetNetworksByName ¶
func (c *SwarmResourceAPIClientShim) GetNetworksByName(name string) ([]dockerTypes.NetworkResource, error)
GetNetworksByName is a great example of a bad interface design.
func (*SwarmResourceAPIClientShim) GetNode ¶
func (c *SwarmResourceAPIClientShim) GetNode(id string) (swarm.Node, error)
GetNode returns a specific node by ID.
func (*SwarmResourceAPIClientShim) GetSecret ¶
func (c *SwarmResourceAPIClientShim) GetSecret(id string) (swarm.Secret, error)
GetSecret inspects a secret.
func (*SwarmResourceAPIClientShim) GetSecrets ¶
func (c *SwarmResourceAPIClientShim) GetSecrets(opts dockerTypes.SecretListOptions) ([]swarm.Secret, error)
GetSecrets lists multiple secrets.
func (*SwarmResourceAPIClientShim) GetService ¶
func (c *SwarmResourceAPIClientShim) GetService(idOrName string, insertDefaults bool) (swarm.Service, error)
GetService inspects a single service.
func (*SwarmResourceAPIClientShim) GetServices ¶
func (c *SwarmResourceAPIClientShim) GetServices(options dockerTypes.ServiceListOptions) ([]swarm.Service, error)
GetServices lists services.
func (*SwarmResourceAPIClientShim) GetTask ¶
func (c *SwarmResourceAPIClientShim) GetTask(taskID string) (swarm.Task, error)
GetTask returns a task.
func (*SwarmResourceAPIClientShim) GetTasks ¶
func (c *SwarmResourceAPIClientShim) GetTasks(options dockerTypes.TaskListOptions) ([]swarm.Task, error)
GetTasks returns multiple tasks.
func (*SwarmResourceAPIClientShim) Info ¶
func (c *SwarmResourceAPIClientShim) Info() swarm.Info
Info returns the swarm info
func (*SwarmResourceAPIClientShim) RemoveConfig ¶
func (c *SwarmResourceAPIClientShim) RemoveConfig(id string) error
RemoveConfig removes a config.
func (*SwarmResourceAPIClientShim) RemoveNetwork ¶
func (c *SwarmResourceAPIClientShim) RemoveNetwork(name string) error
RemoveNetwork removes a network.
func (*SwarmResourceAPIClientShim) RemoveSecret ¶
func (c *SwarmResourceAPIClientShim) RemoveSecret(idOrName string) error
RemoveSecret removes a secret.
func (*SwarmResourceAPIClientShim) RemoveService ¶
func (c *SwarmResourceAPIClientShim) RemoveService(idOrName string) error
RemoveService removes a service.
func (*SwarmResourceAPIClientShim) UpdateConfig ¶
func (c *SwarmResourceAPIClientShim) UpdateConfig(idOrName string, version uint64, spec swarm.ConfigSpec) error
UpdateConfig updates a config.
func (*SwarmResourceAPIClientShim) UpdateSecret ¶
func (c *SwarmResourceAPIClientShim) UpdateSecret(idOrName string, version uint64, spec swarm.SecretSpec) error
UpdateSecret updates a secret.
func (*SwarmResourceAPIClientShim) UpdateService ¶
func (c *SwarmResourceAPIClientShim) UpdateService( idOrName string, version uint64, spec swarm.ServiceSpec, options dockerTypes.ServiceUpdateOptions, queryRegistry bool, ) (*dockerTypes.ServiceUpdateResponse, error)
UpdateService updates a service.
type SwarmResourceBackend ¶
type SwarmResourceBackend interface { // Info isn't actually in the swarm.Backend interface, but it is defined on // the Cluster object, which provides the rest of the implementation Info() swarm.Info GetNode(id string) (swarm.Node, error) GetTasks(dockerTypes.TaskListOptions) ([]swarm.Task, error) GetTask(string) (swarm.Task, error) }
SwarmResourceBackend is a subset of the swarm.Backend interface, combined with the network.ClusterBackend interface. It includes all methods required to validate, provision and update manipulate Swarm stacks and their referenced resources.
func NewSwarmAPIClientShim ¶
func NewSwarmAPIClientShim(dclient client.CommonAPIClient) SwarmResourceBackend
NewSwarmAPIClientShim creates a new SwarmResourceAPIClientShim from a client.CommonAPIClient.
type SwarmSecretBackend ¶
type SwarmSecretBackend interface { GetSecrets(opts dockerTypes.SecretListOptions) ([]swarm.Secret, error) CreateSecret(s swarm.SecretSpec) (string, error) RemoveSecret(idOrName string) error GetSecret(id string) (swarm.Secret, error) UpdateSecret(idOrName string, version uint64, spec swarm.SecretSpec) error }
SwarmSecretBackend is a subset of the swarm.Backend interface, It includes all methods required to validate, provision and update manipulate Swarm Secrets and their referenced resources.
type SwarmServiceBackend ¶
type SwarmServiceBackend interface { GetServices(dockerTypes.ServiceListOptions) ([]swarm.Service, error) GetService(idOrName string, insertDefaults bool) (swarm.Service, error) CreateService(swarm.ServiceSpec, string, bool) (*dockerTypes.ServiceCreateResponse, error) UpdateService(string, uint64, swarm.ServiceSpec, dockerTypes.ServiceUpdateOptions, bool) (*dockerTypes.ServiceUpdateResponse, error) RemoveService(string) error }
SwarmServiceBackend is a subset of the swarm.Backend interface, It includes all methods required to validate, provision and update manipulate Swarm Services and their referenced resources.