nomad

package
v0.5.41 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const TypeNomadCluster string = "nomad_cluster"

TypeCluster is the resource string for a Cluster resource

View Source
const TypeNomadJob string = "nomad_job"

TypeNomadJob defines the string type for the Kubernetes config resource

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterProvider

type ClusterProvider struct {
	// contains filtered or unexported fields
}

NomadCluster defines a provider which can create Kubernetes clusters

func (*ClusterProvider) Changed

func (p *ClusterProvider) Changed() (bool, error)

func (*ClusterProvider) Create

func (p *ClusterProvider) Create() error

Create implements interface method to create a cluster of the specified type

func (*ClusterProvider) Destroy

func (p *ClusterProvider) Destroy() error

Destroy implements interface method to destroy a cluster

func (*ClusterProvider) ImportLocalDockerImages

func (p *ClusterProvider) ImportLocalDockerImages(images []ctypes.Image, force bool) error

ImportLocalDockerImages fetches Docker images stored on the local client and imports them into the cluster

func (*ClusterProvider) Init

func (*ClusterProvider) Lookup

func (p *ClusterProvider) Lookup() ([]string, error)

Lookup the a clusters current state

func (*ClusterProvider) Refresh

func (p *ClusterProvider) Refresh() error

Refresh is called when `up` is run and the resource has been marked as created checks the nodes are healthy and replaces if needed.

type JobProvider

type JobProvider struct {
	// contains filtered or unexported fields
}

NomadJob is a provider which enabled the creation and destruction of Nomad jobs

func (*JobProvider) Changed

func (p *JobProvider) Changed() (bool, error)

func (*JobProvider) Create

func (p *JobProvider) Create() error

Create the Nomad jobs defined by the config

func (*JobProvider) Destroy

func (p *JobProvider) Destroy() error

Destroy the Nomad jobs defined by the config

func (*JobProvider) Init

func (p *JobProvider) Init(cfg htypes.Resource, l logger.Logger) error

func (*JobProvider) Lookup

func (p *JobProvider) Lookup() ([]string, error)

Lookup the Nomad jobs defined by the config

func (*JobProvider) Refresh

func (p *JobProvider) Refresh() error

type NomadCluster

type NomadCluster struct {
	// embedded type holding name, etc
	types.ResourceMetadata `hcl:",remain"`

	Networks      ctypes.NetworkAttachments `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified
	Image         *ctypes.Image             `hcl:"image,block" json:"images,omitempty"`     // optional image to use for the cluster
	ClientNodes   int                       `hcl:"client_nodes,optional" json:"client_nodes,omitempty"`
	Environment   map[string]string         `hcl:"environment,optional" json:"environment,omitempty"`
	ServerConfig  string                    `hcl:"server_config,optional" json:"server_config,omitempty"`
	ClientConfig  string                    `hcl:"client_config,optional" json:"client_config,omitempty"`
	ConsulConfig  string                    `hcl:"consul_config,optional" json:"consul_config,omitempty"`
	Volumes       ctypes.Volumes            `hcl:"volume,block" json:"volumes,omitempty"`                     // volumes to attach to the cluster
	OpenInBrowser bool                      `hcl:"open_in_browser,optional" json:"open_in_browser,omitempty"` // open the UI in the browser after creation

	// Images that will be copied from the local docker cache to the cluster
	CopyImages ctypes.Images `hcl:"copy_image,block" json:"copy_images,omitempty"`

	// Additional ports to expose on the nomad sever node
	Ports      ctypes.Ports      `hcl:"port,block" json:"ports,omitempty"`             // ports to expose
	PortRanges ctypes.PortRanges `hcl:"port_range,block" json:"port_ranges,omitempty"` // range of ports to expose

	// The APIPort the server is running on
	APIPort int `hcl:"api_port,optional" json:"api_port,omitempty"`

	// The Port where the connector is running
	ConnectorPort int `hcl:"connector_port,optional" json:"connector_port,omitempty"`

	// The directory where the server and client config is written to
	ConfigDir string `hcl:"config_dir,optional" json:"config_dir,omitempty"`

	// The fully qualified docker address for the server
	ServerContainerName string `hcl:"server_container_name,optional" json:"server_container_name,omitempty"`

	// The fully qualified docker address for the client nodes
	ClientContainerName []string `hcl:"client_container_name,optional" json:"client_container_name,omitempty"`

	// ExternalIP is the ip address of the cluster, this generally resolves
	// to the docker ip
	ExternalIP string `hcl:"external_ip,optional" json:"external_ip,omitempty"`
}

Cluster is a config stanza which defines a Kubernetes or a Nomad cluster

func (*NomadCluster) Process

func (n *NomadCluster) Process() error

type NomadJob

type NomadJob struct {
	// embedded type holding name, etc
	types.ResourceMetadata `hcl:",remain"`

	// Cluster is the name of the cluster to apply configuration to
	Cluster NomadCluster `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.HealthCheckNomad `hcl:"health_check,block" json:"health_check,omitempty"`

	// JobChecksums stores a checksum of the files or paths
	JobChecksums []string `hcl:"job_checksums,optional" json:"job_checksums,omitempty"`
}

NomadJob applies and deletes and deletes Nomad cluster jobs

func (*NomadJob) Process

func (n *NomadJob) Process() error

Jump to

Keyboard shortcuts

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