nomad

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestParseJob added in v0.1.0

func TestParseJob(t *testing.T, path string) *api.Job

TestParseJob parses a file into an *api.Job object.

Types

type Source

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

Source is an implementation of the Source interface that retrieves policies from a Nomad cluster.

func NewNomadSource

func NewNomadSource(log hclog.Logger, nomad *api.Client, policyProcessor *policy.Processor) *Source

NewNomadSource returns a new Nomad policy source.

func TestNomadSource

func TestNomadSource(t *testing.T, cb func(*api.Config, *policy.ConfigDefaults)) *Source

TestNomadSource returns a default policy.Source that retrieves policies from Nomad.

The Nomad client and the agent can be configured by passing a cb function.

func (*Source) MonitorIDs

func (s *Source) MonitorIDs(ctx context.Context, req policy.MonitorIDsReq)

MonitorIDs retrieves a list of policy IDs from a Nomad cluster and sends it in the resultCh channel when change is detected. Errors are sent through the errCh channel.

This function blocks until the context is closed.

func (*Source) MonitorPolicy

func (s *Source) MonitorPolicy(ctx context.Context, req policy.MonitorPolicyReq)

MonitorPolicy monitors a policy and sends it through the resultCh channel when a change is detect. Errors are sent through the errCh channel.

This function blocks until the context is closed.

func (*Source) Name added in v0.1.0

func (s *Source) Name() policy.SourceName

Name satisfies the Name function of the policy.Source interface.

func (*Source) ReloadIDsMonitor added in v0.1.0

func (s *Source) ReloadIDsMonitor()

ReloadIDsMonitor satisfies the ReloadIDsMonitor function of the policy.Source interface.

This currently does nothing but in the future will be useful to allow reloading configuration options such as the Nomad client params or the log level.

func (*Source) SetNomadClient added in v0.3.0

func (s *Source) SetNomadClient(nomad *api.Client)

Jump to

Keyboard shortcuts

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