Documentation ¶
Index ¶
- func ExpandConfigSpec(c *api.Config, node *api.NodeDescription, t *api.Task, ...) (*api.ConfigSpec, bool, error)
- func ExpandContainerSpec(n *api.NodeDescription, t *api.Task) (*api.ContainerSpec, error)
- func ExpandSecretSpec(s *api.Secret, node *api.NodeDescription, t *api.Task, ...) (*api.SecretSpec, error)
- func NewTemplatedDependencyGetter(dependencies exec.DependencyGetter, t *api.Task, node *api.NodeDescription) exec.DependencyGetter
- func NewTemplatedSecretGetter(dependencies exec.DependencyGetter, t *api.Task, node *api.NodeDescription) exec.SecretGetter
- type Context
- type PayloadContext
- type Platform
- type TemplatedConfigGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandConfigSpec ¶
func ExpandConfigSpec(c *api.Config, node *api.NodeDescription, t *api.Task, dependencies exec.DependencyGetter) (*api.ConfigSpec, bool, error)
ExpandConfigSpec expands the template inside the config payload, if any. Templating is evaluated on the agent-side.
func ExpandContainerSpec ¶
func ExpandContainerSpec(n *api.NodeDescription, t *api.Task) (*api.ContainerSpec, error)
ExpandContainerSpec expands templated fields in the runtime using the task state and the node where it is scheduled to run. Templating is all evaluated on the agent-side, before execution.
Note that these are projected only on runtime values, since active task values are typically manipulated in the manager.
func ExpandSecretSpec ¶
func ExpandSecretSpec(s *api.Secret, node *api.NodeDescription, t *api.Task, dependencies exec.DependencyGetter) (*api.SecretSpec, error)
ExpandSecretSpec expands the template inside the secret payload, if any. Templating is evaluated on the agent-side.
func NewTemplatedDependencyGetter ¶
func NewTemplatedDependencyGetter(dependencies exec.DependencyGetter, t *api.Task, node *api.NodeDescription) exec.DependencyGetter
NewTemplatedDependencyGetter returns a DependencyGetter that evaluates templates.
func NewTemplatedSecretGetter ¶
func NewTemplatedSecretGetter(dependencies exec.DependencyGetter, t *api.Task, node *api.NodeDescription) exec.SecretGetter
NewTemplatedSecretGetter returns a SecretGetter that evaluates templates.
Types ¶
type Context ¶
type Context struct { Service struct { ID string Name string Labels map[string]string } Node struct { ID string Hostname string Platform Platform } Task struct { ID string Name string Slot string } }
Context defines the strict set of values that can be injected into a template expression in SwarmKit data structure. NOTE: Be very careful adding any fields to this structure with types that have methods defined on them. The template would be able to invoke those methods.
func NewContext ¶
func NewContext(n *api.NodeDescription, t *api.Task) (ctx Context)
NewContext returns a new template context from the data available in the task and the node where it is scheduled to run. The provided context can then be used to populate runtime values in a ContainerSpec.
type PayloadContext ¶
type PayloadContext struct { Context // contains filtered or unexported fields }
PayloadContext provides a context for expanding a config or secret payload. NOTE: Be very careful adding any fields to this structure with types that have methods defined on them. The template would be able to invoke those methods.
func NewPayloadContextFromTask ¶
func NewPayloadContextFromTask(node *api.NodeDescription, t *api.Task, dependencies exec.DependencyGetter) (ctx PayloadContext)
NewPayloadContextFromTask returns a new template context from the data available in the task and the node where it is scheduled to run. This context also provides access to the configs and secrets that the task has access to. The provided context can then be used to populate runtime values in a templated config or secret.
type TemplatedConfigGetter ¶
type TemplatedConfigGetter interface { exec.ConfigGetter // GetAndFlagSecretData returns the interpolated config, and also // returns true if the config has been interpolated with data from a // secret. In this case, the config should be handled specially and // should not be written to disk. GetAndFlagSecretData(configID string) (*api.Config, bool, error) }
TemplatedConfigGetter is a ConfigGetter with an additional method to expose whether a config contains sensitive data.
func NewTemplatedConfigGetter ¶
func NewTemplatedConfigGetter(dependencies exec.DependencyGetter, t *api.Task, node *api.NodeDescription) TemplatedConfigGetter
NewTemplatedConfigGetter returns a ConfigGetter that evaluates templates.