fn: allow specified docker networks in functions (#982)

* fn: allow specified docker networks in functions

If FN_DOCKER_NETWORK is specified with a list of
networks, then agent driver picks the least used
network to place functions on.

* add mutex comment
This commit is contained in:
Tolga Ceylan
2018-05-09 12:24:15 -07:00
committed by GitHub
parent 1c00782a6c
commit 0f50537150
5 changed files with 124 additions and 23 deletions

View File

@@ -10,6 +10,7 @@ import (
type AgentConfig struct {
MinDockerVersion string `json:"min_docker_version"`
DockerNetworks string `json:"docker_networks"`
FreezeIdle time.Duration `json:"freeze_idle_msecs"`
EjectIdle time.Duration `json:"eject_idle_msecs"`
HotPoll time.Duration `json:"hot_poll_msecs"`
@@ -31,6 +32,7 @@ type AgentConfig struct {
}
const (
EnvDockerNetworks = "FN_DOCKER_NETWORKS"
EnvFreezeIdle = "FN_FREEZE_IDLE_MSECS"
EnvEjectIdle = "FN_EJECT_IDLE_MSECS"
EnvHotPoll = "FN_HOT_POLL_MSECS"
@@ -82,6 +84,7 @@ func NewAgentConfig() (*AgentConfig, error) {
err = setEnvStr(err, EnvPreForkCmd, &cfg.PreForkCmd)
err = setEnvUint(err, EnvPreForkUseOnce, &cfg.PreForkUseOnce)
err = setEnvStr(err, EnvPreForkNetworks, &cfg.PreForkNetworks)
err = setEnvStr(err, EnvDockerNetworks, &cfg.DockerNetworks)
if err != nil {
return cfg, err