nomad

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 25 Imported by: 1

README

Nomad

The Nomad plugin deploys a Docker container to a Nomad cluster. It also launches on-demand runners to do operations remotely.

Components

  1. Platform
  2. TaskLauncher
  1. Docker

Resources

  1. Nomad Job

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_waypoint_builtin_nomad_plugin_proto protoreflect.FileDescriptor

Options are the SDK options to use for instantiation for the Nomad plugin.

Functions

func ConsulAuth added in v0.8.2

func ConsulAuth() (string, error)

func NewMonitor added in v0.4.0

func NewMonitor(ui terminal.Status, client *api.Client) *monitor

newMonitor returns a new monitor. The returned monitor will write output information to the provided ui.

func VaultAuth added in v0.8.2

func VaultAuth() (string, error)

Types

type AuthConfig added in v0.1.4

type AuthConfig struct {
	Username string `hcl:"username"`
	Password string `hcl:"password"`
}

AuthConfig maps the the Nomad Docker driver 'auth' config block and is used to set credentials for pulling images from the registry

type Config

type Config struct {
	// The credential of docker registry.
	Auth *AuthConfig `hcl:"auth,block"`

	// The number of replicas of the service to maintain. If this number is maintained
	// outside waypoint, do not set this variable.
	Count int `hcl:"replicas,optional"`

	// The datacenters to deploy to, defaults to ["dc1"]
	Datacenter string `hcl:"datacenter,optional"`

	// The namespace of the job
	Namespace string `hcl:"namespace,optional"`

	// The Nomad region to deploy to, defaults to "global"
	Region string `hcl:"region,optional"`

	// The amount of resources to allocate to the Nomad task for the deployed
	// application
	Resources *Resources `hcl:"resources,block"`

	// Port that your service is running on within the actual container.
	// Defaults to port 3000.
	// TODO Evaluate if this should remain as a default 3000, should be a required field,
	// or default to another port.
	ServicePort uint `hcl:"service_port,optional"`

	// Specifies the service registration provider to use for service registrations
	ServiceProvider string `hcl:"service_provider,optional"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be control an image that has multiple modes of operation,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`
}

Config is the configuration structure for the Platform.

type Deployment

type Deployment struct {
	Id            string         `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name          string         `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	ResourceState *opaqueany.Any `protobuf:"bytes,3,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Deployment) Descriptor deprecated

func (*Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Deployment.ProtoReflect.Descriptor instead.

func (*Deployment) GetId

func (x *Deployment) GetId() string

func (*Deployment) GetName

func (x *Deployment) GetName() string

func (*Deployment) GetResourceState added in v0.5.0

func (x *Deployment) GetResourceState() *opaqueany.Any

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) ProtoReflect added in v0.5.0

func (x *Deployment) ProtoReflect() protoreflect.Message

func (*Deployment) Reset

func (x *Deployment) Reset()

func (*Deployment) String

func (x *Deployment) String() string

type Platform

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

Platform is the Platform implementation for Nomad.

func (*Platform) Auth

func (p *Platform) Auth() error

func (*Platform) AuthFunc

func (p *Platform) AuthFunc() interface{}

AuthFunc implements component.Authenticator

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Config implements Configurable

func (*Platform) Deploy

func (p *Platform) Deploy(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	img *docker.Image,
	deployConfig *component.DeploymentConfig,
	ui terminal.UI,
) (*Deployment, error)

Deploy deploys an image to Nomad.

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

DeployFunc implements component.Platform

func (*Platform) Destroy

func (p *Platform) Destroy(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

Destroy deletes the Nomad job.

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Platform) Documentation

func (p *Platform) Documentation() (*docs.Documentation, error)

func (*Platform) Status added in v0.4.0

func (p *Platform) Status(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) (*sdk.StatusReport, error)

func (*Platform) StatusFunc added in v0.4.0

func (p *Platform) StatusFunc() interface{}

StatusFunc implements component.Status

func (*Platform) ValidateAuth

func (p *Platform) ValidateAuth() error

func (*Platform) ValidateAuthFunc

func (p *Platform) ValidateAuthFunc() interface{}

ValidateAuthFunc implements component.Authenticator

type Resource added in v0.5.0

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

Resource contains the internal resource states.

func (*Resource) Descriptor deprecated added in v0.5.0

func (*Resource) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) ProtoMessage added in v0.5.0

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v0.5.0

func (x *Resource) ProtoReflect() protoreflect.Message

func (*Resource) Reset added in v0.5.0

func (x *Resource) Reset()

func (*Resource) String added in v0.5.0

func (x *Resource) String() string

type Resource_Job added in v0.5.0

type Resource_Job struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Job) Descriptor deprecated added in v0.5.0

func (*Resource_Job) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Job.ProtoReflect.Descriptor instead.

func (*Resource_Job) GetName added in v0.5.0

func (x *Resource_Job) GetName() string

func (*Resource_Job) ProtoMessage added in v0.5.0

func (*Resource_Job) ProtoMessage()

func (*Resource_Job) ProtoReflect added in v0.5.0

func (x *Resource_Job) ProtoReflect() protoreflect.Message

func (*Resource_Job) Reset added in v0.5.0

func (x *Resource_Job) Reset()

func (*Resource_Job) String added in v0.5.0

func (x *Resource_Job) String() string

type Resources added in v0.3.1

type Resources struct {
	CPU      *int `hcl:"cpu,optional"`
	MemoryMB *int `hcl:"memorymb,optional"`
}

type TaskInfo added in v0.6.2

type TaskInfo struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

This represents the state of the TaskLaunch implementation.

func (*TaskInfo) Descriptor deprecated added in v0.6.2

func (*TaskInfo) Descriptor() ([]byte, []int)

Deprecated: Use TaskInfo.ProtoReflect.Descriptor instead.

func (*TaskInfo) GetId added in v0.6.2

func (x *TaskInfo) GetId() string

func (*TaskInfo) ProtoMessage added in v0.6.2

func (*TaskInfo) ProtoMessage()

func (*TaskInfo) ProtoReflect added in v0.6.2

func (x *TaskInfo) ProtoReflect() protoreflect.Message

func (*TaskInfo) Reset added in v0.6.2

func (x *TaskInfo) Reset()

func (*TaskInfo) String added in v0.6.2

func (x *TaskInfo) String() string

type TaskLauncher added in v0.6.2

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

TaskLauncher implements the TaskLauncher plugin interface to support launching on-demand tasks for the Waypoint server.

func (*TaskLauncher) Config added in v0.6.2

func (p *TaskLauncher) Config() (interface{}, error)

Config implements Configurable.

func (*TaskLauncher) Documentation added in v0.6.2

func (p *TaskLauncher) Documentation() (*docs.Documentation, error)

func (*TaskLauncher) StartTask added in v0.6.2

func (p *TaskLauncher) StartTask(
	ctx context.Context,
	log hclog.Logger,
	tli *component.TaskLaunchInfo,
) (*TaskInfo, error)

StartTask creates a Nomad job for working on the task.

func (*TaskLauncher) StartTaskFunc added in v0.6.2

func (p *TaskLauncher) StartTaskFunc() interface{}

StartTaskFunc implements component.TaskLauncher.

func (*TaskLauncher) StopTask added in v0.6.2

func (p *TaskLauncher) StopTask(
	ctx context.Context,
	log hclog.Logger,
	ti *TaskInfo,
) error

StopTask signals to Nomad to stop the nomad job created previously.

func (*TaskLauncher) StopTaskFunc added in v0.6.2

func (p *TaskLauncher) StopTaskFunc() interface{}

StopTaskFunc implements component.TaskLauncher.

func (*TaskLauncher) WatchTask added in v0.9.0

func (p *TaskLauncher) WatchTask(
	ctx context.Context,
	log hclog.Logger,
	ui terminal.UI,
	ti *TaskInfo,
) (*component.TaskResult, error)

WatchTask implements TaskLauncher

func (*TaskLauncher) WatchTaskFunc added in v0.9.0

func (p *TaskLauncher) WatchTaskFunc() interface{}

WatchTaskFunc implements component.TaskLauncher.

type TaskLauncherConfig added in v0.6.2

type TaskLauncherConfig struct {
	// The Datacenter the runner should be created and run in
	Datacenter string `hcl:"datacenter,optional"`

	// The namespace the runner should be created and run in
	Namespace string `hcl:"namespace,optional"`

	// The Nomad region to deploy the task to, defaults to "global"
	Region string `hcl:"region,optional"`

	// Resource request limits for an on-demand runner
	Memory int `hcl:"resources_memory,optional"`
	CPU    int `hcl:"resources_cpu,optional"`

	// The host to connect to for making Nomad API requests
	NomadHost string `hcl:"nomad_host,optional"`
}

TaskLauncherConfig is the configuration structure for the task plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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