Documentation
¶
Index ¶
- Constants
- func BuildEncodedAuthConfig(basicAuthB64 string, dockerImage string) (string, error)
- func DeleteHandler(c ServiceDeleter) http.HandlerFunc
- func DeployHandler(c *client.Client, maxRestarts uint64, restartDelay time.Duration) http.HandlerFunc
- func FunctionReader(wildcard bool, c client.ServiceAPIClient) http.HandlerFunc
- func Health() http.HandlerFunc
- func MakeInfoHandler(version, sha string) http.HandlerFunc
- func MakeSecretsHandler(c client.SecretAPIClient) http.HandlerFunc
- func NamespaceLister() http.HandlerFunc
- func NewLogRequester(client ServiceLogger) logs.Requester
- func ReplicaReader(c *client.Client) http.HandlerFunc
- func ReplicaUpdater(c *client.Client) http.HandlerFunc
- func UpdateHandler(c *client.Client, maxRestarts uint64, restartDelay time.Duration) http.HandlerFunc
- type FunctionLookup
- type LogRequester
- type ScaleServiceRequest
- type ServiceDeleter
- type ServiceLister
- type ServiceLogger
- type ServiceQuery
- type SwarmServiceQuery
Constants ¶
const ( //OrchestrationIdentifier identifier string for swarm provider OrchestrationIdentifier = "swarm" //ProviderName provider string for swarm provider ProviderName = "faas-swarm" )
const DefaultMaxReplicas = 20
DefaultMaxReplicas is the amount of replicas a service will auto-scale up to.
const MaxScaleLabel = "com.openfaas.scale.max"
MaxScaleLabel label indicating max scale for a function
const MinScaleLabel = "com.openfaas.scale.min"
MinScaleLabel label indicating min scale for a function
Variables ¶
This section is empty.
Functions ¶
func BuildEncodedAuthConfig ¶
BuildEncodedAuthConfig parses the image name for a repository, user name, and image name If a repository is not included (ie: username/function-name), 'docker.io/' will be prepended
func DeleteHandler ¶
func DeleteHandler(c ServiceDeleter) http.HandlerFunc
DeleteHandler delete a function
func DeployHandler ¶
func DeployHandler(c *client.Client, maxRestarts uint64, restartDelay time.Duration) http.HandlerFunc
DeployHandler creates a new function (service) inside the swarm network.
func FunctionReader ¶
func FunctionReader(wildcard bool, c client.ServiceAPIClient) http.HandlerFunc
FunctionReader reads functions from Swarm metadata
func Health ¶
func Health() http.HandlerFunc
func MakeInfoHandler ¶
func MakeInfoHandler(version, sha string) http.HandlerFunc
MakeInfoHandler creates handler for /system/info endpoint
func MakeSecretsHandler ¶
func MakeSecretsHandler(c client.SecretAPIClient) http.HandlerFunc
MakeSecretsHandler returns handler for managing secrets
func NamespaceLister ¶
func NamespaceLister() http.HandlerFunc
Swarm does not use namespaces, so we return an empty list. see https://github.com/openfaas-incubator/connector-sdk/pull/46
func NewLogRequester ¶
func NewLogRequester(client ServiceLogger) logs.Requester
NewLogRequester returns a Requestor instance that can be used in the function logs endpoint
func ReplicaReader ¶
func ReplicaReader(c *client.Client) http.HandlerFunc
ReplicaReader reads replica and image status data from a function
func ReplicaUpdater ¶
func ReplicaUpdater(c *client.Client) http.HandlerFunc
ReplicaUpdater updates a function
func UpdateHandler ¶
func UpdateHandler(c *client.Client, maxRestarts uint64, restartDelay time.Duration) http.HandlerFunc
UpdateHandler updates an existng function
Types ¶
type FunctionLookup ¶
type FunctionLookup struct {
// contains filtered or unexported fields
}
FunctionLookup is a openfaas-provider proxy.BaseURLResolver that allows the caller to verify that a function is resolvable.
func NewFunctionLookup ¶
func NewFunctionLookup(client ServiceLister, dnsRoundRobin bool) *FunctionLookup
NewFunctionLookup creates a new FunctionLookup resolver
func (*FunctionLookup) Resolve ¶
func (l *FunctionLookup) Resolve(name string) (u url.URL, err error)
Resolve implements the openfaas-provider proxy.BaseURLResolver interface. In short it verifies that a function with the given name is resolvable by Docker Swarm. It can be configured to do this via DNS or by querying the Docker Service list.
func (*FunctionLookup) ResolveContext ¶
ResolveContext provides an implementation of openfaas-provider proxy.BaseURLResolver with context support. See `Resolve`
type LogRequester ¶
type LogRequester struct {
// contains filtered or unexported fields
}
LogRequester implements the Requester interface for Swarm
type ScaleServiceRequest ¶
type ScaleServiceRequest struct { ServiceName string `json:"serviceName"` Replicas uint64 `json:"replicas"` }
ScaleServiceRequest request to scale a function
type ServiceDeleter ¶
type ServiceDeleter interface { ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) ServiceRemove(ctx context.Context, serviceID string) error }
ServiceDeleter is the sub-interface of client.ServiceAPIClient that is required for deleting a OpenFaaS Function. This interface is satisfied by *client.Client
type ServiceLister ¶
type ServiceLister interface {
ServiceList(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
}
ServiceLister is the subset of the Docker client.ServiceAPIClient needed to enable the function lookup
type ServiceLogger ¶
type ServiceLogger interface {
ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
}
ServiceLogger is the subset of Docker Client methods required for querying function logs
type ServiceQuery ¶
type ServiceQuery interface { GetReplicas(service string) (currentReplicas uint64, maxReplicas uint64, minReplicas uint64, err error) SetReplicas(service string, count uint64) error }
ServiceQuery provides interface for replica querying/setting
func NewSwarmServiceQuery ¶
func NewSwarmServiceQuery(c *client.Client) ServiceQuery
NewSwarmServiceQuery create new Docker Swarm implementation
type SwarmServiceQuery ¶
type SwarmServiceQuery struct {
// contains filtered or unexported fields
}
SwarmServiceQuery implementation for Docker Swarm
func (SwarmServiceQuery) GetReplicas ¶
GetReplicas replica count for function
func (SwarmServiceQuery) SetReplicas ¶
func (s SwarmServiceQuery) SetReplicas(serviceName string, count uint64) error
SetReplicas update the replica count