Documentation ¶
Index ¶
- Variables
- func LoadValuesFile(path string) error
- func ParseFolder(folder string, c *Config, onlyResources bool, variables map[string]string, ...) error
- func ParseHCLFile(file string, c *Config) error
- func ParseReferences(c *Config) error
- func ParseYardFile(file string, c *Config) error
- func SetVariables(vars map[string]string)
- type Blueprint
- type Build
- type ClusterConfig
- type Config
- func (c *Config) AddResource(r Resource) error
- func (c *Config) DoYaLikeDAGs() (*dag.AcyclicGraph, error)
- func (c *Config) FindModuleResources(name string) ([]Resource, error)
- func (c *Config) FindResource(name string) (Resource, error)
- func (c *Config) FindResourcesByType(t string) []Resource
- func (c *Config) FromJSON(path string) error
- func (c *Config) Merge(c2 *Config)
- func (c *Config) RemoveResource(rf Resource) error
- func (c *Config) ResourceCount() int
- func (c *Config) ToJSON(path string) error
- func (c *Config) UnmarshalJSON(b []byte) error
- type Container
- type ContainerIngress
- type Docs
- type ExecLocal
- type ExecRemote
- type HealthCheck
- type Helm
- type Image
- type Ingress
- type K8sCluster
- type K8sConfig
- type K8sIngress
- type KV
- type Module
- type Network
- type NetworkAttachment
- type NomadCluster
- type NomadIngress
- type NomadJob
- type Output
- type Port
- type PortRange
- type Resource
- type ResourceExistsError
- type ResourceInfo
- type ResourceNotFoundError
- type ResourceType
- type ResourceTypeNotExistError
- type Resources
- type Sidecar
- type Status
- type Volume
Constants ¶
This section is empty.
Variables ¶
var ErrorWANExists = errors.New("a network named 'wan' already exists")
ErrorWANExists is raised when a WAN network already exists
var StateNotFoundError = fmt.Errorf("State file not found")
Functions ¶
func LoadValuesFile ¶ added in v0.1.0
LoadValuesFile loads variable values from a file
func ParseFolder ¶
func ParseFolder(folder string, c *Config, onlyResources bool, variables map[string]string, variablesFile string) error
ParseFolder for Resource, Blueprint, and Variable files The onlyResources parameter allows you to specfiy that the parser only reads resource files and will ignore Blueprint and Varaible files. This is useful when recursively parsing such as when reading Modules
func ParseHCLFile ¶
ParseHCLFile parses a config file and adds it to the config
func ParseReferences ¶
ParseReferences links the object references in config elements
func ParseYardFile ¶
ParseYardFile parses a blueprint configuration file
func SetVariables ¶ added in v0.1.0
SetVariables allow variables to be set from a collection or environment variables Precedence should be file, env, vars
Types ¶
type Blueprint ¶
type Blueprint struct { Title string `hcl:"title,optional" json:"title,omitempty"` Author string `hcl:"author,optional" json:"author,omitempty"` Slug string `hcl:"slug,optional" json:"slug,omitempty"` Intro string `hcl:"intro,optional" json:"intro,omitempty"` BrowserWindows []string `hcl:"browser_windows,optional" json:"browser_windows,omitempty" mapstructure:"browser_windows"` HealthCheckTimeout string `hcl:"health_check_timeout,optional" json:"health_check_timeout,omitempty" mapstructure:"health_check_timeout"` Environment []KV `hcl:"env,block" json:"environment,omitempty"` ShipyardVersion string `hcl:"shipyard_version,optional" json:"shipyard_version,omitempty"` }
Blueprint defines a stack blueprint for defining yard configs
type Build ¶ added in v0.1.0
type Build struct { File string `hcl:"file,optional" json:"file,omitempty"` // Location of build file inside build context defaults to ./Dockerfile Context string `hcl:"context" json:"context"` // Path to build context }
Build allows you to define the conditions for building a container on run from a Dockerfile
type ClusterConfig ¶
type ClusterConfig struct {
ConsulHTTPAddr string `hcl:"consul_http_addr,optional" json:"consul_http_addr,omitempty"`
}
ClusterConfig defines arbitary config to set for the cluster
type Config ¶
type Config struct { Blueprint *Blueprint `json:"blueprint"` Resources []Resource `json:"resources"` }
Config defines the stack config
func (*Config) AddResource ¶
AddResource adds a given resource to the resource list if the resource already exists an error will be returned
func (*Config) DoYaLikeDAGs ¶
func (c *Config) DoYaLikeDAGs() (*dag.AcyclicGraph, error)
DoYaLikeDAGs? dags? yeah dags! oh dogs. https://www.youtube.com/watch?v=ZXILzUpVx7A&t=0s
func (*Config) FindModuleResources ¶ added in v0.1.0
FindResources returns an array of resources for the given module
func (*Config) FindResource ¶
FindResource returns the resource for the given name name is defined with the convention [type].[name] if a resource can not be found resource will be null and an error will be returned
e.g. to find a cluster named k3s r, err := c.FindResource("cluster.k3s")
func (*Config) FindResourcesByType ¶ added in v0.1.0
FindResourcesByType returns the resources from the given type
func (*Config) RemoveResource ¶
func (*Config) ResourceCount ¶
ResourceCount defines the number of resources in a config
func (*Config) ToJSON ¶
ToJSON saves the config in JSON format to the specified path returns an error if the config can not be saved.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON is a cusom Unmarshaler to deal with converting the objects back into their main type
type Container ¶
type Container struct { // embedded type holding name, etc ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Image *Image `hcl:"image,block" json:"image"` // Image to use for the container Build *Build `hcl:"build,block" json:"build"` // Enables containers to be built on the fly Entrypoint []string `hcl:"entrypoint,optional" json:"entrypoint,omitempty"` // entrypoint to use when starting the container Command []string `hcl:"command,optional" json:"command,omitempty"` // command to use when starting the container Environment []KV `hcl:"env,block" json:"environment,omitempty"` // environment variables to set when starting the container, // Depricated field EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty"` // environment variables to set when starting the container Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the container Ports []Port `hcl:"port,block" json:"ports,omitempty"` // ports to expose PortRanges []PortRange `hcl:"port_range,block" json:"port_ranges,omitempty"` // range of ports to expose Privileged bool `hcl:"privileged,optional" json:"privileged,omitempty"` // run the container in privileged mode? // resource constraints Resources *Resources `hcl:"resources,block" json:"resources,omitempty"` // resource constraints for the container // health checks for the container HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty"` }
Container defines a structure for creating Docker containers
func NewContainer ¶
NewContainer returns a new Container resource with the correct default options
type ContainerIngress ¶
type ContainerIngress struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified // Tartget is the name of the container to attach to "conatiner.[name]" Target string `hcl:"target" json:"target"` // Ports to open, an ingress resource can be both a bridge between the host and the // an issolated network resource or bridge between two networks. // For this reason 3 different ports can be specified // Local - The docker network or container port to use for exposing the service, for example an ingress // with the name consul-ingress configured to point to container.consul could set a local port 18500 // traffic on the same network would be able to reach the consul service on 8500 using the address // consul-ingress.ingress.shipyard:18500 // Remote - This is the destination port for the target container // Host - The port to expose on localhost, this can be different from the Local container port. Ports []Port `hcl:"port,block" json:"ports,omitempty"` }
ContainerIngress defines an ingress service mapping ports between local host or docker network and the target
func NewContainerIngress ¶
func NewContainerIngress(name string) *ContainerIngress
NewContainerIngress creates a new ingress for standard docker containers with the correct defaults
type Docs ¶
type Docs struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Image *Image `hcl:"image,block" json:"image,omitempty"` // image to use for the container Path string `hcl:"path" json:"path"` Port int `hcl:"port" json:"port"` LiveReloadPort int `hcl:"live_reload_port,optional" json:"live_reload_port,omitempty"` OpenInBrowser bool `hcl:"open_in_browser,optional" json:"open_in_browser" mapstructure:"open_in_browser"` // When a host port is defined open the location in a browser IndexTitle string `hcl:"index_title,optional" json:"index_title" mapstructure:"index_title"` IndexPages []string `hcl:"index_pages,optional" json:"index_pages,omitempty" mapstructure:"index_pages"` }
Docs allows the running of a Docusaurus container which can be used for online tutorials or documentation
type ExecLocal ¶
type ExecLocal struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` // Either Script or Command must be specified Script string `hcl:"script,optional" json:"script,omitempty"` // Path to a script to execute Command string `hcl:"cmd,optional" json:"cmd,omitempty"` // Command to execute Arguments []string `hcl:"args,optional" json:"args,omitempty"` // only used when combined with Command Environment []KV `hcl:"env,block" json:"env"` // Envrionment variables to set }
ExecLocal allows commands to be executed on the local machine
func NewExecLocal ¶
NewExecLocal creates a LocalExec resource with the default values
type ExecRemote ¶
type ExecRemote struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified // Either Image or Target must be specified Image *Image `hcl:"image,block" json:"image,omitempty"` // Create a new container and exec Target string `hcl:"target,optional" json:"target,omitempty"` // Attach to a running target and exec // Either Script or Command must be specified //Script string `hcl:"script,optional" json:"script,omitempty"` // Path to a script to execute Command string `hcl:"cmd,optional" json:"cmd,omitempty"` // Command to execute Arguments []string `hcl:"args,optional" json:"args,omitempty"` // only used when combined with Command WorkingDirectory string `hcl:"working_directory,optional" json:"working_directory,omitempty"` // Working directory to exectute commands Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // Volumes to mount to container Environment []KV `hcl:"env,block" json:"env,omitempty"` // Environment varialbes to set EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty"` // environment variables to set when starting the container }
ExecRemote allows commands to be executed in remote containers
func NewExecRemote ¶
func NewExecRemote(name string) *ExecRemote
NewExecRemote creates a ExecRemote resorurce with the detault values
type HealthCheck ¶
type HealthCheck struct { Timeout string `hcl:"timeout" json:"timeout"` HTTP string `hcl:"http,optional" json:"http,omitempty"` TCP string `hcl:"tcp,optional" json:"tcp,omitempty"` Services []string `hcl:"services,optional" json:"services,omitempty"` Pods []string `hcl:"pods,optional" json:"pods,omitempty"` NomadJobs []string `hcl:"nomad_jobs,optional" json:"nomad_jobs,omitempty" mapstructure:"nomad_jobs"` }
HealthCheck is an internal block for configuration which allows the user to define the criteria for successful creation example config:
http = "http://consul-consul:8500/v1/leader" // can the http endpoint be reached tcp = "consul-consul:8500" // can a TCP connection be made services = ["consul-consul"] // does service exist and there are endpoints pods = ["component=server,app=consul", "component=client,app=consul"] // is the pod running and healthy nomad_jobs = ["redis"] // are the Nomad jobs running and healthy
type Helm ¶
type Helm struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Cluster string `hcl:"cluster" json:"cluster"` Chart string `hcl:"chart" json:"chart"` Values string `hcl:"values,optional" json:"values"` ValuesString map[string]string `hcl:"values_string,optional" json:"values_string"` // Namespace is the Kubernetes namespace Namespace string `hcl:"namespace,optional" json:"namespace,omitempty"` HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty" mapstructure:"health_check"` }
Helm defines configuration for running Helm charts
type Image ¶
type Image struct { Name string `hcl:"name" json:"name"` // Username is the Docker registry user to use for private repositories Username string `hcl:"username,optional" json:"username,omitempty"` // Password is the Docker registry password to use for private repositories Password string `hcl:"password,optional" json:"password,omitempty"` }
Image defines a docker image which will be pushed to the clusters Docker registry
type Ingress ¶
type Ingress struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Target string `hcl:"target" json:"target"` Service string `hcl:"service,optional" json:"service,omitempty"` Namespace string `hcl:"namespace,optional" json:"namespace,omitempty"` Ports []Port `hcl:"port,block" json:"ports,omitempty"` }
Ingress defines an ingress service mapping ports between local host or docker network and the target Note: This type is Deprecated and will be removed in a later version
Please use one of the new specific types: * K8sIngress * NomadIngress * ContainerIngress
func NewIngress ¶
NewIngress creates a new ingress with the correct defaults
type K8sCluster ¶
type K8sCluster struct { // embedded type holding name, etc. ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Driver string `hcl:"driver" json:"driver,omitempty"` Version string `hcl:"version,optional" json:"version,omitempty"` Nodes int `hcl:"nodes,optional" json:"nodes,omitempty"` Images []Image `hcl:"image,block" json:"images,omitempty"` Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the cluster Ports []Port `hcl:"port,block" json:"ports,omitempty"` // ports to expose PortRanges []PortRange `hcl:"port_range,block" json:"port_ranges,omitempty"` // range of ports to expose }
K8sCluster is a config stanza which defines a Kubernetes or a Nomad cluster
func NewK8sCluster ¶
func NewK8sCluster(name string) *K8sCluster
NewK8sCluster creates new Cluster config with the correct defaults
type K8sConfig ¶
type K8sConfig struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` // Cluster is the name of the cluster to apply configuration to Cluster string `hcl:"cluster" json:"cluster"` // Path of a file or directory of Kubernetes config files to apply Paths []string `hcl:"paths" validator:"filepath" json:"paths"` // WaitUntilReady when set to true waits until all resources have been created and are in a "Running" state WaitUntilReady bool `hcl:"wait_until_ready"` // HealthCheck defines a health check for the resource HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty" mapstructure:"health_check"` }
K8sConfig applies and deletes and deletes Kubernetes configuration
func NewK8sConfig ¶
NewK8sConfig creates a kubernetes config resource with the correct defaults
type K8sIngress ¶
type K8sIngress struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified // Cluster to connect to Cluster string `hcl:"cluster" json:"cluster"` // Service to proxy to. // When proxying to a Kubernetes service, ingress will choose a random // pod within that service. Service string `hcl:"service,optional" json:"service,omitempty"` // Deployment to proxy to. // When proxying to a Kubernetes deployment, ingress will choose a random // pod within that service. Deployment string `hcl:"deployment,optional" json:"deployment,omitempty"` // Pod to proxy to Pod string `hcl:"pod,optional" json:"pod,omitempty"` // Namespace is the Kubernetes namespace Namespace string `hcl:"namespace,optional" json:"namespace,omitempty"` Ports []Port `hcl:"port,block" json:"ports,omitempty"` }
K8sIngress defines an ingress service mapping ports between local host or docker network and the target
func NewK8sIngress ¶
func NewK8sIngress(name string) *K8sIngress
NewK8sIngress creates a new ingress with the correct defaults
type Module ¶ added in v0.0.20
type Module struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Source string `hcl:"source" json:"source"` }
Module allows Shipyard configuration to be imported from external folder or GitHub repositories
type Network ¶
type Network struct { ResourceInfo Subnet string `hcl:"subnet" json:"subnet"` }
Network defines a Docker network
func NewNetwork ¶
NewNetwork creates a new Network resource with the correct defaults
type NetworkAttachment ¶
type NomadCluster ¶
type NomadCluster struct { // embedded type holding name, etc ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Version string `hcl:"version,optional" json:"version,omitempty"` ClientNodes int `hcl:"client_nodes,optional" json:"client_nodes,omitempty" mapstructure:"client_nodes"` Nodes int `hcl:"nodes,optional" json:"nodes,omitempty"` Environment []KV `hcl:"env,block" json:"environment,omitempty" mapstructure:"env"` Images []Image `hcl:"image,block" json:"images,omitempty"` ServerConfig string `hcl:"server_config,optional" json:"server_config,omitempty" mapstructure:"server_config"` ClientConfig string `hcl:"client_config,optional" json:"client_config,omitempty" mapstructure:"client_config"` Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the cluster }
Cluster is a config stanza which defines a Kubernetes or a Nomad cluster
func NewNomadCluster ¶
func NewNomadCluster(name string) *NomadCluster
NewCluster creates new Cluster config with the correct defaults
type NomadIngress ¶
type NomadIngress struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Networks []NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified Cluster string `hcl:"cluster" json:"cluster"` Job string `hcl:"job" json:"job"` Group string `hcl:"group" json:"group"` Task string `hcl:"task" json:"task"` Ports []Port `hcl:"port,block" json:"ports,omitempty"` }
NomadIngress defines an ingress service mapping ports between local host or docker network and the target
func NewNomadIngress ¶
func NewNomadIngress(name string) *NomadIngress
NewNomadIngress creates a new ingress with the correct defaults
type NomadJob ¶
type NomadJob struct { ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` // Cluster is the name of the cluster to apply configuration to Cluster string `hcl:"cluster" json:"cluster"` // Path of a file or directory of Job files to apply Paths []string `hcl:"paths" validator:"filepath" json:"paths"` // HealthCheck defines a health check for the resource HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty" mapstructure:"health_check"` }
NomadJob applies and deletes and deletes Nomad cluster jobs
func NewNomadJob ¶
NewNomadJob creates a kubernetes config resource with the correct defaults
type Output ¶ added in v0.1.0
type Output struct { ResourceInfo Value string `hcl:"value,optional" json:"value,omitempty"` // command to use when starting the container }
Output defines an output variable which can be set by a module
type Port ¶
type Port struct { Local string `hcl:"local" json:"local"` // Local port in the container Remote string `hcl:"remote" json:"remote"` // Remote port of the service Host string `hcl:"host,optional" json:"host,omitempty"` // Host port Protocol string `hcl:"protocol,optional" json:"protocol,omitempty"` // Protocol tcp, udp OpenInBrowser string `hcl:"open_in_browser,optional" json:"open_in_browser" mapstructure:"open_in_browser"` // When a host port is defined open this port with the given path in a browser }
Port is a port mapping
type PortRange ¶ added in v0.0.37
type PortRange struct { Range string `hcl:"range" json:"local"` // Local port in the container EnableHost bool `hcl:"enable_host,optional" json:"enable_host,omitempty"` // Host port Protocol string `hcl:"protocol,optional" json:"protocol,omitempty"` // Protocol tcp, udp }
PortRange allows a range of ports to be mapped
type Resource ¶
type Resource interface { Info() *ResourceInfo FindDependentResource(string) (Resource, error) AddChild(Resource) }
type ResourceExistsError ¶
type ResourceExistsError struct {
Name string
}
ResourceExistsError is thrown when a resource already exists in the resource list
func (ResourceExistsError) Error ¶
func (e ResourceExistsError) Error() string
type ResourceInfo ¶
type ResourceInfo struct { // Name is the name of the resource Name string `json:"name"` // Type is the type of resource, this is the text representation of the golang type Type ResourceType `json:"type"` // Status is the current status of the resource, this is always PendingCreation initially Status Status `json:"status,omitempty"` // DependsOn is a list of objects which must exist before this resource can be applied DependsOn []string `json:"depends_on,omitempty"` // Module is the name of the module if a resource has been loaded from a module Module string `json:"module,omitempty"` // parent container Config *Config `json:"-"` }
ResourceInfo is the embedded type for any config resources
func (*ResourceInfo) AddChild ¶
func (r *ResourceInfo) AddChild(c Resource)
func (*ResourceInfo) FindDependentResource ¶
func (r *ResourceInfo) FindDependentResource(name string) (Resource, error)
func (*ResourceInfo) Info ¶
func (r *ResourceInfo) Info() *ResourceInfo
type ResourceNotFoundError ¶
type ResourceNotFoundError struct {
Name string
}
ResourceNotFoundError is thrown when a resource could not be found
func (ResourceNotFoundError) Error ¶
func (e ResourceNotFoundError) Error() string
type ResourceType ¶
type ResourceType string
ResourceType is the type of the resource
const TypeContainer ResourceType = "container"
TypeContainer is the resource string for a Container resource
const TypeContainerIngress ResourceType = "container_ingress"
TypeContainerIngress is the resource string for the type
const TypeDocs ResourceType = "docs"
TypeDocs is the resource string for a Docs resource
const TypeExecLocal ResourceType = "exec_local"
TypeExecLocal is the resource string for a LocalExec resource
const TypeExecRemote ResourceType = "exec_remote"
TypeExecRemote is the resource string for a ExecRemote resource
const TypeHelm ResourceType = "helm"
TypeHelm is the string representation of the ResourceType
const TypeIngress ResourceType = "ingress"
TypeIngress is the resource string for the type
const TypeK8sCluster ResourceType = "k8s_cluster"
TypeK8sCluster is the resource string for a Cluster resource
const TypeK8sConfig ResourceType = "k8s_config"
TypeK8sConfig defines the string type for the Kubernetes config resource
const TypeK8sIngress ResourceType = "k8s_ingress"
TypeK8sIngress is the resource string for the type
const TypeModule ResourceType = "module"
TypeModule is the resource string for a Module resource
const TypeNetwork ResourceType = "network"
TypeNetwork is the string resource type for Network resources
const TypeNomadCluster ResourceType = "nomad_cluster"
TypeCluster is the resource string for a Cluster resource
const TypeNomadIngress ResourceType = "nomad_ingress"
TypeNomadIngress is the resource string for the type
const TypeNomadJob ResourceType = "nomad_job"
TypeNomadJob defines the string type for the Kubernetes config resource
const TypeOutput ResourceType = "output"
const TypeSidecar ResourceType = "sidecar"
TypeSidecar is the resource string for a Sidecar resource
type ResourceTypeNotExistError ¶
func (ResourceTypeNotExistError) Error ¶
func (r ResourceTypeNotExistError) Error() string
type Resources ¶
type Resources struct { CPU int `hcl:"cpu,optional" json:"cpu,omitempty"` // cpu limit for the container where 1 CPU = 1000 CPUPin []int `hcl:"cpu_pin,optional" json:"cpu_pin,omitempty"` // pin the container to one or more cpu cores Memory int `hcl:"memory,optional" json:"memory,omitempty"` // max memory the container can consume in MB }
Resources allows the setting of resource constraints for the Container
type Sidecar ¶ added in v0.0.19
type Sidecar struct { // embedded type holding name, etc ResourceInfo Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Target string `hcl:"target" json:"target"` Image Image `hcl:"image,block" json:"image"` // image to use for the container Entrypoint []string `hcl:"entrypoint,optional" json:"entrypoint,omitempty"` // entrypoint to use when starting the container Command []string `hcl:"command,optional" json:"command,omitempty"` // command to use when starting the container Environment []KV `hcl:"env,block" json:"environment,omitempty"` // environment variables to set when starting the container EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty"` // environment variables to set when starting the container Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the container Privileged bool `hcl:"privileged,optional" json:"privileged,omitempty"` // run the container in privileged mode? // resource constraints Resources *Resources `hcl:"resources,block" json:"resources,omitempty"` // resource constraints for the container // health checks for the container HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty"` }
Sidecar defines a structure for creating Docker containers
func NewSidecar ¶ added in v0.0.19
NewSidecar returns a new Container resource with the correct default options
type Status ¶
type Status string
Status defines the current state of a resource
const Applied Status = "applied"
Applied means the resource has been successfully created
const Destroyed Status = "destroyed"
Destroyed means the resource has been destroyed
const Failed Status = "failed"
Failed means the resource failed during creation if the action is Apply the resource will be re-created at the next run
const PendingCreation Status = "pending_creation"
PendingCreation means the resource has not yet been created it will be created on the next run
const PendingModification Status = "pending_modification"
PendingModification means the resource has been created but if the action is Apply then the resource will be re-created with the next run if the action is Delete then the resource will be removed with the next run
const PendingUpdate Status = "pending_update"
PendingUpdate means the resource has been requested to be updated if the action is Apply then the resource will be ignored with the next run if the action is Delete then the resource will be removed with the next run
type Volume ¶
type Volume struct { Source string `hcl:"source" json:"source"` // source path on the local machine for the volume Destination string `hcl:"destination" json:"destination"` // path to mount the volume inside the container Type string `hcl:"type,optional" json:"type,omitempty"` // type of the volume to mount [bind, volume, tmpfs] ReadOnly bool `hcl:"read_only,optional" json:"read_only,omitempty"` // specify that the volume is mounted read only }
Volume defines a folder, Docker volume, or temp folder to mount to the Container
Source Files ¶
- blueprint.go
- config.go
- container.go
- container_ingress.go
- docs.go
- errors.go
- exec_local.go
- exec_remote.go
- healthcheck.go
- helm.go
- image.go
- ingress.go
- k8s_cluster.go
- k8s_config.go
- k8s_ingress.go
- module.go
- network.go
- nomad_cluster.go
- nomad_ingress.go
- nomad_job.go
- output.go
- parser.go
- port.go
- sidecar.go
- state.go