nsd

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MPL-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package nsd provides Nomad service registration and therefore discovery capabilities for Nomad clients. The name nsd was used instead of Nomad to avoid conflict with the existing nomad package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServiceRegistrationHandler

func NewServiceRegistrationHandler(
	log hclog.Logger, cfg *ServiceRegistrationHandlerCfg) serviceregistration.Handler

NewServiceRegistrationHandler returns a ready to use ServiceRegistrationHandler which implements the serviceregistration.Handler interface.

Types

type ServiceRegistrationHandler

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

func (*ServiceRegistrationHandler) AllocRegistrations

AllocRegistrations is currently a noop implementation as the Nomad provider does not support health check which is the sole subsystem caller of this function.

func (*ServiceRegistrationHandler) RegisterWorkload

func (*ServiceRegistrationHandler) RemoveWorkload

RemoveWorkload iterates the services and removes them from the service registration state.

This function works regardless of whether the client has this feature enabled. This covers situations where the feature is disabled, yet still has allocations which, when stopped need their registrations removed.

func (*ServiceRegistrationHandler) Shutdown

func (s *ServiceRegistrationHandler) Shutdown()

Shutdown is used to initiate shutdown of the handler. This is specifically used to exit any routines running retry functions without leaving them orphaned.

func (*ServiceRegistrationHandler) UpdateTTL

func (s *ServiceRegistrationHandler) UpdateTTL(_, _, _, _ string) error

UpdateTTL is currently a noop implementation as the Nomad provider does not support health check which is the sole subsystem caller of this function.

func (*ServiceRegistrationHandler) UpdateWorkload

type ServiceRegistrationHandlerCfg

type ServiceRegistrationHandlerCfg struct {

	// Enabled tracks whether this client feature is enabled.
	Enabled bool

	// Datacenter, NodeID, and Region are all properties of the Nomad client
	// and are used to perform RPC requests.
	Datacenter string
	NodeID     string
	Region     string

	// NodeSecret is the secret ID of the node and is used to authenticate RPC
	// requests.
	NodeSecret string

	// RPCFn is the client RPC function which is used to perform client to
	// server service registration RPC calls. This RPC function has basic retry
	// functionality.
	RPCFn func(method string, args, resp interface{}) error
}

ServiceRegistrationHandlerCfg holds critical information used during the normal process of the ServiceRegistrationHandler. It is used to keep the NewServiceRegistrationHandler function signature small and easy to modify.

Jump to

Keyboard shortcuts

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