nomadic

package
v0.0.0-...-df0bd0c Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDNS = &nomadapi.DNSConfig{
	Servers: []string{
		"10.0.2.101",
	},
}
View Source
var DefaultDatacenters = []string{"dc1"}

Functions

func AddConnectService

func AddConnectService(tg *nomadapi.TaskGroup, svc *nomadapi.Service, opts ...ServiceOption) *nomadapi.Service

func AddPort

func AddPort(tg *nomadapi.TaskGroup, port nomadapi.Port)

func AddService

func AddService(tg *nomadapi.TaskGroup, svc *nomadapi.Service, opts ...ServiceOption) *nomadapi.Service

func AddTask

func AddTask(tg *nomadapi.TaskGroup, task *nomadapi.Task, opts ...TaskOption) *nomadapi.Task

func AddTaskGroup

func AddTaskGroup(job *nomadapi.Job, name string, count int) *nomadapi.TaskGroup

func AllowIntention

func AllowIntention(name string) *consul.SourceIntention

func AppAwareIntention

func AppAwareIntention(name string, permissions ...*consul.IntentionPermission) *consul.SourceIntention

func Bool

func Bool(v bool) *bool

func ConsulUpstream

func ConsulUpstream(dest string, port int) *nomad.ConsulUpstream

func DenyAllHTTP

func DenyAllHTTP() *consul.IntentionPermission

func DenyIntention

func DenyIntention(name string) *consul.SourceIntention

func Duration

func Duration(v time.Duration) *time.Duration

func HTTPPathExact

func HTTPPathExact(path string) *consul.IntentionHTTPPermission

func HTTPPathPrefix

func HTTPPathPrefix(prefix string) *consul.IntentionHTTPPermission

func Image

func Image(repo, tagOrDigest string) string

func Int

func Int(v int) *int

func Logging

func Logging(tag string) map[string]interface{}

func NewBatchJob

func NewBatchJob(name string, priority int) *nomadapi.Job

func NewJob

func NewJob(name string, priority int) *nomadapi.Job

func NewServiceDefaults

func NewServiceDefaults(name string, protocol string) *consul.ServiceConfigEntry

func NewServiceIntentions

func NewServiceIntentions(name string, sources ...*consul.SourceIntention) *consul.ServiceIntentionsConfigEntry

func NewSystemJob

func NewSystemJob(name string, priority int) *nomadapi.Job

func Register

func Register(app Deployable)

func RegisteredImageURIs

func RegisteredImageURIs() []string

func Registry

func Registry() map[string]Deployable

func String

func String(v string) *string

func WithEvents

func WithEvents(ctx context.Context, events EventReporter) context.Context

Types

type Clients

type Clients struct {
	Nomad  *nomadapi.Client
	Consul *consulapi.Client
	Vault  *vaultapi.Client
}

func DefaultClients

func DefaultClients() (Clients, error)

func (Clients) DeployJobs

func (c Clients) DeployJobs(ctx context.Context, jobs ...*nomadapi.Job) error

type Deployable

type Deployable interface {
	Name() string
	Install(ctx context.Context, clients Clients) error
	Uninstall(ctx context.Context, clients Clients) error
}

func Find

func Find(name string) Deployable

type EventOption

type EventOption func(e report.Event)

func EventArgsAndOptions

func EventArgsAndOptions(v []interface{}) (args []interface{}, opts []EventOption)

func WithError

func WithError(err error) EventOption

type EventReporter

type EventReporter interface {
	Info(format string, v ...interface{})
	Warning(format string, v ...interface{})
	Error(format string, v ...interface{})
}

func Events

func Events(ctx context.Context) EventReporter

func NewChannelEventReporter

func NewChannelEventReporter(ch chan<- *deploypb.ReportEvent) EventReporter

func NewLoggingEventReporter

func NewLoggingEventReporter() EventReporter

type ServiceOption

type ServiceOption func(tg *nomadapi.TaskGroup, svc *nomadapi.Service)

func WithMetricsPort

func WithMetricsPort(label string) ServiceOption

func WithMetricsScraping

func WithMetricsScraping(path string) ServiceOption

func WithUpstreams

func WithUpstreams(upstreams ...*nomadapi.ConsulUpstream) ServiceOption

type TaskOption

type TaskOption func(tg *nomadapi.TaskGroup, task *nomadapi.Task)

func WithCPU

func WithCPU(cpu int) TaskOption

func WithLoggingTag

func WithLoggingTag(tag string) TaskOption

func WithMemoryMB

func WithMemoryMB(memory int) TaskOption

func WithTracingEnv

func WithTracingEnv() TaskOption

func WithVaultChangeNoop

func WithVaultChangeNoop() TaskOption

func WithVaultPolicies

func WithVaultPolicies(policies ...string) TaskOption

Directories

Path Synopsis
service

Jump to

Keyboard shortcuts

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