Documentation ¶
Index ¶
Constants ¶
const TypeContainer string = "container"
TypeContainer is the resource string for a Container resource
const TypeSidecar string = "sidecar"
TypeSidecar is the resource string for a Sidecar resource
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶ added in v0.5.53
type Container ¶
type Container struct { // embedded type holding name, etc types.ResourceMetadata `hcl:",remain"` 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 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 map[string]string `hcl:"environment,optional" json:"environment,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 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? Capabilities *Capabilities `hcl:"capabilities,block" json:"capabilities,omitempty"` // Capabilities to add or drop from the container MaxRestartCount int `hcl:"max_restart_count,optional" json:"max_restart_count,omitempty"` // resource constraints Resources *Resources `hcl:"resources,block" json:"resources,omitempty"` // resource constraints for the container // health checks for the container HealthCheck *healthcheck.HealthCheckContainer `hcl:"health_check,block" json:"health_check,omitempty"` // User block for mapping the user id and group id inside the container RunAs *User `hcl:"run_as,block" json:"run_as,omitempty"` // ContainerName is the fully qualified domain name for the container, this can be used // to access the container from other sources ContainerName string `hcl:"container_name,optional" json:"container_name,omitempty"` }
Container defines a structure for creating Docker containers
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"` // ID is the unique identifier for the image, this is independent of tag // and changes each time the image is built. An image that has been tagged // multiple times also shares the same ID. ID string `hcl:"id,optional" json:"id,omitempty"` }
Image defines a docker image which will be pushed to the clusters Docker registry
func (Image) ToClientImage ¶
type NetworkAttachment ¶
type NetworkAttachment struct { ID string `hcl:"id" json:"id"` IPAddress string `hcl:"ip_address,optional" json:"ip_address,omitempty"` // Optional address to assign Aliases []string `hcl:"aliases,optional" json:"aliases,omitempty"` // Network aliases for the resource // Name will equal the name of the network as created by jumppad Name string `hcl:"name,optional" json:"name,omitempty"` // AssignedAddress will equal if IPAddress is set, else it will be the value automatically // assigned from the network AssignedAddress string `hcl:"assigned_address,optional" json:"assigned_address,omitempty"` }
func (NetworkAttachment) ToClientNetworkAttachment ¶
func (n NetworkAttachment) ToClientNetworkAttachment() types.NetworkAttachment
type NetworkAttachments ¶
type NetworkAttachments []NetworkAttachment
func (NetworkAttachments) ToClientNetworkAttachments ¶
func (n NetworkAttachments) ToClientNetworkAttachments() []types.NetworkAttachment
type Port ¶
type Port struct { Local string `hcl:"local" json:"local"` // Local port in the container Remote string `hcl:"remote,optional" json:"remote,omitempty"` // 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
func (Port) ToClientPort ¶
type PortRange ¶
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
func (PortRange) ToClientPortRange ¶
type PortRanges ¶
type PortRanges []PortRange
func (PortRanges) ToClientPortRanges ¶
func (p PortRanges) ToClientPortRanges() []types.PortRange
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Container is a provider for creating and destroying Docker containers
func (*Provider) Create ¶
Create implements provider method and creates a Docker container with the given config
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 ¶
type Sidecar struct { // embedded type holding name, etc types.ResourceMetadata `hcl:",remain"` Target Container `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 map[string]string `hcl:"environment,optional" json:"environment,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.HealthCheckContainer `hcl:"health_check,block" json:"health_check,omitempty"` MaxRestartCount int `hcl:"max_restart_count,optional" json:"max_restart_count,omitempty"` // ContainerName is the fully qualified domain name for the container the sidecar is linked to, this can be used // to access the sidecar from other sources ContainerName string `hcl:"container_name,optional" json:"container_name,omitempty"` }
Sidecar defines a structure for creating Docker containers
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 BindPropagation string `hcl:"bind_propagation,optional" json:"bind_propagation,omitempty"` // propagation mode for bind mounts [shared, private, slave, rslave, rprivate] BindPropagationNonRecursive bool `hcl:"bind_propagation_non_recursive,optional" json:"bind_propagation_non_recursive,omitempty"` // recursive bind mount, default true SelinuxRelabel string `hcl:"selinux_relabel,optional" json:"selinux_relabel,optional"` // selinux_relabeling ["", shared, private] }
Volume defines a folder, Docker volume, or temp folder to mount to the Container