Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { NomadServerAddress string Logger zerolog.Logger // DeploymentTimeOut reflects the timeout sokar will wait (at max) for a deployment to be applied. DeploymentTimeOut time.Duration // EvaluationTimeOut reflects the timeout sokar will wait (at max) for gathering information about evaluations. EvaluationTimeOut time.Duration }
Config contains the main configuration for the nomad connector
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector is a object that allows to interact with nomad
func New ¶ added in v0.0.10
New creates a new nomad connector
Example ¶
conn, err := New("http://1.2.3.4") if err != nil { log.Fatalf("Unable to create connector: %s.", err.Error()) } // just to avoid the not used error _ = conn
Output:
func (*Connector) AdjustScalingObjectCount ¶ added in v0.0.9
func (nc *Connector) AdjustScalingObjectCount(jobname string, min uint, max uint, from uint, to uint) error
AdjustScalingObjectCount sets the given count for the given nomad job. HACK: The count is set to the same value for all groups inside the job.
func (*Connector) GetScalingObjectCount ¶
GetScalingObjectCount retunrs the actual count of the given nomad job. HACK: To unify the multiple groups with we take the job with max count.
func (*Connector) IsScalingObjectDead ¶
IsScalingObjectDead returns true if the mentioned job is in state nomad./structs/JobStatusDead, false otherwise.
type Deployments ¶
type Deployments interface {
Info(deploymentID string, q *nomadApi.QueryOptions) (*nomadApi.Deployment, *nomadApi.QueryMeta, error)
}
Deployments represents the interface for interacting with nomads over the deployments end-point
type Evaluations ¶
type Evaluations interface {
Info(evalID string, q *nomadApi.QueryOptions) (*nomadApi.Evaluation, *nomadApi.QueryMeta, error)
}
Evaluations represents the interface for interacting with nomads over the evaluations end-point
type Jobs ¶
type Jobs interface { Info(jobID string, q *nomadApi.QueryOptions) (*nomadApi.Job, *nomadApi.QueryMeta, error) Register(job *nomadApi.Job, q *nomadApi.WriteOptions) (*nomadApi.JobRegisterResponse, *nomadApi.WriteMeta, error) }
Jobs represents the interface for interacting with nomads over the jobs end-point
type Option ¶ added in v0.0.10
type Option func(conn *Connector)
Option represents an option for the Connector
func WithDeploymentTimeOut ¶ added in v0.0.10
WithDeploymentTimeOut sets the timeout that should be regarded during deployments
func WithEvaluationTimeOut ¶ added in v0.0.10
WithEvaluationTimeOut sets the timeout that should be regarded during evaluations
func WithLogger ¶ added in v0.0.10
WithLogger adds a configured Logger to the Connector