helper

package
v1.1.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindIP

func FindIP(input string) string

FindIP will return the IP address from a string. This is used to deal with responses from the Nomad API that contain the port such as 127.0.0.1:4646.

func FindNodeByAddress

func FindNodeByAddress(nodeRegistry *structs.NodeRegistry,
	workerPoolName, nodeAddress string) (ok bool)

FindNodeByAddress is a helper method that searches the node registry to determine if a node has been registered with a specific worker pool.

The method searches by node IP address and if no result is found, will continue polling the node registry for up to 5 minutes.

func FindNodeByRegistrationTime

func FindNodeByRegistrationTime(nodeRegistry *structs.NodeRegistry,
	workerPoolName string) (node string, err error)

FindNodeByRegistrationTime is a helper method that watches a worker pool in the node registry for a newly launched node.

The method watches the node registration records which include the date and time the node was registered and looks for a node that was launched anytime within the last 60 seconds or later. If no result is found, the method will continue polling the node registry for up to 5 minutes.

func HasObjectChanged added in v1.0.0

func HasObjectChanged(objectA, objectB interface{}) (changed bool, err error)

HasObjectChanged compares two objects to determine if they have changed.

func Max

func Max(values ...float64) float64

Max returns the largest float from a variable length list of floats.

func Min

func Min(values ...float64) float64

Min returns the smallest float from a variable length list of floats.

func ParseMetaConfig added in v1.0.0

func ParseMetaConfig(meta map[string]string, reqKeys []string) (missing []string)

ParseMetaConfig parses meta parameters from a Nomad agent or job configuration and validates required keys are present. If any required keys are found to be missing, these are returned. Otherwise, an empty slice is returned.

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice checks if a given string is in a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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