Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestFile(t *testing.T, contents string) string
- func CreateTestFiles(t *testing.T, contents ...string) string
- func GetEvalContext() *hcl.EvalContext
- func LoadValuesFile(path string) error
- func ParseFolder(folder string, c *Config, onlyResources bool, moduleName string, disabled bool, ...) error
- func ParseReferences(c *Config) error
- func ParseSingleFile(file string, c *Config, variables map[string]string, variablesFile string) error
- func SetVariables(vars map[string]string)
- type Blueprint
- type Build
- type CertificateCA
- type CertificateLeaf
- 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 Copy
- type Docs
- type ExecLocal
- type ExecRemote
- type HealthCheck
- type Helm
- type HelmRepository
- type Image
- type ImageCache
- type Ingress
- type K8sCluster
- type K8sConfig
- type K8sIngress
- type KV
- type LegacyIngress
- 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 Template
- type Traffic
- type TrafficConfig
- type User
- type Variable
- type Volume
Constants ¶
const ( IngressSourceLocal = "local" IngressSourceK8s = "k8s" IngressSourceDocker = "docker" )
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 CreateTestFile ¶ added in v0.3.37
createTestFile creates a hcl file from the given contents
func CreateTestFiles ¶ added in v0.3.37
createsTestFiles creates a temporary directory and stores temp files into it returns directory containing files cleanup function usage: d, cleanup := createTestFiles(t, `cluster "abc" {}`, `docs "bcdf" {}`) defer cleanup()
func GetEvalContext ¶ added in v0.3.37
func GetEvalContext() *hcl.EvalContext
GetEvalContext gets the context parsed from the configuration this contains all the variables and helper 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, moduleName string, disabled bool, dependsOn []string, variables map[string]string, variablesFile string) error
ParseFolder for Resource, Blueprint, and Variable files The onlyResources parameter allows you to specify that the parser moduleName is the name of the module, this should be set to a blank string for the root module disabled sets the disabled flag on all resources, this is used when parsing a module that
has the disabled flag set
only reads resource files and will ignore Blueprint and Variable files. This is useful when recursively parsing such as when reading Modules
func ParseReferences ¶
ParseReferences links the object references in config elements
func ParseSingleFile ¶ added in v0.2.1
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 Tag string `hcl:"tag,optional" json:"tag,omitempty"` // Image tag, defaults to latest }
Build allows you to define the conditions for building a container on run from a Dockerfile
type CertificateCA ¶ added in v0.3.56
type CertificateCA struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Output string `hcl:"output" json:"output"` }
CertificateCA allows the generate of CA certificates
func NewCertificateCA ¶ added in v0.3.56
func NewCertificateCA(name string) *CertificateCA
NewCertificateCA creates a new CA certificate config resource
type CertificateLeaf ¶ added in v0.3.56
type CertificateLeaf struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` CAKey string `hcl:"ca_key" json:"ca_key" mapstructure:"ca_key"` // Path to the primary key for the root CA CACert string `hcl:"ca_cert" json:"ca_cert" mapstructure:"ca_cert"` // Path to the root CA IPAddresses []string `hcl:"ip_addresses,optional" json:"ip_addresses,omitempty" mapstructure:"ip_addresses"` // ip addresses to add to the cert DNSNames []string `hcl:"dns_names,optional" json:"dns_names,omitempty" mapstructure:"dns_names"` // DNS names to add to the cert Output string `hcl:"output" json:"output"` // output location for the certificate }
CertificateCA allows the generate of CA certificates
func NewCertificateLeaf ¶ added in v0.3.56
func NewCertificateLeaf(name string) *CertificateLeaf
NewCertificateLeaf creates a new Leaf certificate resource
type ClusterConfig ¶
type ClusterConfig struct {
ConsulHTTPAddr string `hcl:"consul_http_addr,optional" json:"consul_http_addr,omitempty" mapstructure:"consul_http_addr"`
}
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 CreateConfigFromStrings ¶ added in v0.3.37
CreateConfigFromStrings is a test helper function that parses the given contents strings as HCL and returns a Shipyard 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
FindModuleResources 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 `hcl:",remain" mapstructure:",squash"` 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:"env,omitempty" mapstructure:"env"` // environment variables to set when starting the container, // Depricated field EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty" mapstructure:"env_var"` // 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" mapstructure:"port_ranges"` // range of ports to expose DNS []string `hcl:"dns,optional" json:"dns,omitempty"` // Add custom DNS servers 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" mapstructure:"health_check"` MaxRestartCount int `hcl:"max_restart_count,optional" json:"max_restart_count,omitempty" mapstructure:"max_restart_count"` // User block for mapping the user id and group id inside the container RunAs *User `hcl:"run_as,block" json:"run_as,omitempty" mapstructure:"run_as"` }
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 `hcl:",remain" mapstructure:",squash"` 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 Copy ¶ added in v0.3.56
type Copy struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Source string `hcl:"source" json:"source"` // Source file, folder or glob Destination string `hcl:"destination" json:"destination"` // Destination to write file or files to Permissions string `hcl:"permissions,optional" json:"permissions,omitempty"` // Permissions 0777 to set for written file CopiedFiles []string `json:"copied_files" mapstructure:"copied_files" state:"true"` }
Docs allows the running of a Docusaurus container which can be used for online tutorials or documentation
type Docs ¶
type Docs struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` 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" mapstructure:"live_reload_port"` 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 `hcl:",remain" mapstructure:",squash"` // Id stores the ID of the created connector service Pid int `json:"pid,omitempty" state:"true"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Command string `hcl:"cmd,optional" json:"cmd,omitempty" mapstructure:"cmd"` // Command to execute Arguments []string `hcl:"args,optional" json:"args,omitempty" mapstructure:"args"` // only used when combined with Command WorkingDirectory string `hcl:"working_directory,optional" json:"working_directory,omitempty" mapstructure:"working_directory"` // Working directory to execute commands Daemon bool `hcl:"daemon,optional" json:"daemon,omitempty"` // Should the process run as a daemon Timeout string `hcl:"timeout,optional" json:"timeout,omitempty"` // Set the timeout for the command Environment []KV `hcl:"env,block" json:"env" mapstructure:"env"` // environment variables to set EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty" mapstructure:"env_var"` // environment 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 `hcl:",remain" mapstructure:",squash"` 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" mapstructure:"cmd"` // Command to execute Arguments []string `hcl:"args,optional" json:"args,omitempty" mapstructure:"args"` // only used when combined with Command WorkingDirectory string `hcl:"working_directory,optional" json:"working_directory,omitempty" mapstructure:"working_directory"` // Working directory to execute commands Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // Volumes to mount to container Environment []KV `hcl:"env,block" json:"env,omitempty" mapstructure:"env"` // Environment varialbes to set EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty" mapstructure:"env_var"` // environment variables to set when starting the container // User block for mapping the user id and group id inside the container RunAs *User `hcl:"run_as,block" json:"run_as,omitempty" mapstructure:"run_as"` }
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"` HTTPSuccessCodes []int `hcl:"http_success_codes,optional" json:"http_success_codes,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 http_success_codes = [200,429] // https status codes that signal the health of the endpoint 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 `hcl:",remain" mapstructure:",squash"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Cluster string `hcl:"cluster" json:"cluster"` // Optional HelmRepository, if specified will try to download the chart from the give repository Repository *HelmRepository `hcl:"repository,block" json:"repository"` // name of the chart within the repository or Go Getter reference to download chart from Chart string `hcl:"chart" json:"chart"` // name to use when installing the chart, if blank uses resource name ChartName string `hcl:"chart_name,optional" json:"chart_name,omitempty" mapstructure:"chart_name"` // semver of the chart to install Version string `hcl:"version,optional" json:"version,omitempty"` Values string `hcl:"values,optional" json:"values"` ValuesString map[string]string `hcl:"values_string,optional" json:"values_string" mapstructure:"values_string"` // Namespace is the Kubernetes namespace Namespace string `hcl:"namespace,optional" json:"namespace,omitempty"` // CreateNamespace when set to true Helm wiil creeate the namespace before installing CreateNamespace bool `hcl:"create_namespace,optional" json:"create_namespace,omitempty" mapstructure:"create_namespace"` // Skip the install of any CRDs SkipCRDs bool `hcl:"skip_crds,optional" json:"skip_crds,omitempty" mapstructure:"skip_crds"` // Retry the install n number of times Retry int `hcl:"retry,optional" json:"retry,omitempty" mapstructure:"retry"` // Timeout specifices the maximum time a chart can run, default 300s Timeout string `hcl:"timeout,optional" json:"timeout"` HealthCheck *HealthCheck `hcl:"health_check,block" json:"health_check,omitempty" mapstructure:"health_check"` }
Helm defines configuration for running Helm charts
type HelmRepository ¶ added in v0.3.42
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 ImageCache ¶ added in v0.2.16
type ImageCache struct { // embedded type holding name, etc ResourceInfo `mapstructure:",squash"` Networks []string `json:"networks" state:"true"` // Attach to the correct network // only when Image is specified }
Container defines a structure for creating Docker containers
func NewImageCache ¶ added in v0.2.16
func NewImageCache(name string) *ImageCache
type Ingress ¶
type Ingress struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` // Id stores the ID of the created connector service Id string `json:"id" state:"true"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Destination Traffic `hcl:"destination,block" json:"destination"` Source Traffic `hcl:"source,block" json:"source"` }
Ingress defines an ingress service mapping ports between local host and resources like containers and kube cluster
func NewIngress ¶
NewIngress creates a new ingress with the correct defaults
type K8sCluster ¶
type K8sCluster struct { // embedded type holding name, etc. ResourceInfo `hcl:",remain" mapstructure:",squash"` 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" mapstructure:"port_ranges"` // range of ports to expose EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty" mapstructure:"env_var"` // environment variables to set when starting the container }
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 `hcl:",remain" mapstructure:",squash"` 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" json:"wait_until_ready" mapstructure:"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 `hcl:",remain" mapstructure:",squash"` 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 LegacyIngress ¶ added in v0.2.1
type LegacyIngress struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` 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 NewLegacyIngress ¶ added in v0.2.1
func NewLegacyIngress(name string) *LegacyIngress
NewIngress creates a new ingress with the correct defaults
type Module ¶ added in v0.0.20
type Module struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` 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 `hcl:",remain" mapstructure:",squash"` 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 `hcl:",remain" mapstructure:",squash"` 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:"environment"` 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"` ConsulConfig string `hcl:"consul_config,optional" json:"consul_config,omitempty" mapstructure:"consul_config"` Volumes []Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the cluster OpenInBrowser bool `hcl:"open_in_browser,optional" json:"open_in_browser,omitempty" mapstructure:"open_in_browser"` // open the UI in the browser after creation ServerIPAddress string `hcl:"server_ip_address,optional" json:"server_ip_address,omitempty" mapstructure:"server_ip_address"` ClientIPAddress []string `hcl:"client_ip_address,optional" json:"client_ip_address,omitempty" mapstructure:"client_ip_address"` Ports []Port `hcl:"port,block" json:"ports,omitempty"` // ports to expose on server node PortRanges []PortRange `hcl:"port_range,block" json:"port_ranges,omitempty" mapstructure:"port_ranges"` // range of ports to expose on server node }
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 `hcl:",remain" mapstructure:",squash"` 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 `hcl:",remain" mapstructure:",squash"` 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 `hcl:",remain" mapstructure:",squash"` 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" mapstructure:"local"` // Local port in the container EnableHost bool `hcl:"enable_host,optional" json:"enable_host,omitempty" mapstructure:"enable_host"` // 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" mapstructure:"depends_on"` // Module is the name of the module if a resource has been loaded from a module Module string `json:"module,omitempty"` // Enabled determines if a resource is enabled and should be processed Disabled bool `hcl:"disabled,optional" json:"disabled,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 TypeCertificateCA ResourceType = "certificate_ca"
TypeCertificateCA is the resource string for a self-signed CA
const TypeCertificateLeaf ResourceType = "certificate_leaf"
TypeCertificateCA is the resource string for a self-signed CA
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 TypeCopy ResourceType = "copy"
TypeCopy copies files from one location to another
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 TypeImageCache ResourceType = "image_cache"
TypeContainer is the resource string for a Container resource
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 TypeLegacyIngress ResourceType = "legacy_ingress"
TypeIngress 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
const TypeTemplate ResourceType = "template"
TypeTemplate is the resource string for a Template resource
const TypeVariable ResourceType = "variable"
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" mapstructure:"cpu_pin"` // 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 `hcl:",remain" mapstructure:",squash"` 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:"env,omitempty" mapstructure:"env"` // environment variables to set when starting the container EnvVar map[string]string `hcl:"env_var,optional" json:"env_var,omitempty" mapstructure:"env_var"` // 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" mapstructure:"health_check"` MaxRestartCount int `hcl:"max_restart_count,optional" json:"max_restart_count,omitempty" mapstructure:"max_restart_count"` }
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 Disabled Status = "disabled"
Disabled means the resource will be ignored by the engine and no resources will be created or 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 Template ¶ added in v0.2.10
type Template struct { ResourceInfo `hcl:",remain" mapstructure:",squash"` Depends []string `hcl:"depends_on,optional" json:"depends,omitempty"` Source string `hcl:"source" json:"source"` // Source template to be processed as string Destination string `hcl:"destination" json:"destination"` // Desintation filename to write Vars interface{} `hcl:"vars,optional" json:"vars,omitempty"` // Variables to be processed in the template }
Template allows the process of user defined templates
func NewTemplate ¶ added in v0.2.10
NewTemplate creates a Template resource with the default values
type Traffic ¶ added in v0.2.1
type Traffic struct { // Driver to use when creating the ingress, k8s, nomad, docker, local Driver string `hcl:"driver" json:"driver"` // Config is an collection which has driver specific content Config TrafficConfig `hcl:"config,block" json:"config"` }
Traffic defines either a source or a destination block for ingress traffic
type TrafficConfig ¶ added in v0.2.1
type TrafficConfig struct { Cluster string `hcl:"cluster,optional" json:"cluster,omitempty"` Address string `hcl:"address,optional" json:"address,omitempty"` Port string `hcl:"port" json:"port"` OpenInBrowser string `hcl:"open_in_browser,optional" json:"open_in_browser,omitempty" mapstructure:"open_in_browser"` }
TrafficConfig defines the parameters for the traffic
type Variable ¶ added in v0.2.1
type Variable struct { ResourceInfo `mapstructure:",squash"` Default interface{} `hcl:"default" json:"default"` // default value for a variable Description string `hcl:"description,optional" json:"description,omitempty"` // description of the variable }
Output defines an output variable which can be set by a module
func NewVariable ¶ added in v0.2.1
NewOutput creates a new output variable
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" mapstructure:"read_only"` // specify that the volume is mounted read only BindPropagation string `hcl:"bind_propagation,optional" json:"bind_propagation,omitempty" mapstructure:"bind_propagation"` // propagation mode for bind mounts [shared, private, slave, rslave, rprivate] BindPropagationNonRecursive bool `` // recursive bind mount, default true /* 139-byte string literal not displayed */ }
Volume defines a folder, Docker volume, or temp folder to mount to the Container
Source Files ¶
- blueprint.go
- cert.go
- config.go
- container.go
- container_ingress.go
- copy.go
- docs.go
- errors.go
- exec_local.go
- exec_remote.go
- healthcheck.go
- helm.go
- image.go
- image_cache.go
- ingress.go
- k8s_cluster.go
- k8s_config.go
- k8s_ingress.go
- legacy_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
- template.go
- utils.go
- variable.go