template

package
v0.0.0-...-120fae7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandContainerSpec

func ExpandContainerSpec(t *api.Task) (*api.ContainerSpec, error)

ExpandContainerSpec expands templated fields in the runtime using the task state. 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.

Types

type Context

type Context struct {
	Service struct {
		ID     string
		Name   string
		Labels map[string]string
	}

	Node struct {
		ID string
	}

	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.

func NewContextFromTask

func NewContextFromTask(t *api.Task) (ctx Context)

NewContextFromTask returns a new template context from the data available in task. The provided context can then be used to populate runtime values in a ContainerSpec.

func (*Context) Expand

func (ctx *Context) Expand(s string) (string, error)

Expand treats the string s as a template and populates it with values from the context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL