Add config options
This commit is contained in:
parent
f233629a4f
commit
c643e6b0d1
|
@ -184,6 +184,13 @@ func convertServerConfig(agentConfig *Config, logOutput io.Writer) (*nomad.Confi
|
|||
}
|
||||
conf.EvalGCThreshold = dur
|
||||
}
|
||||
if gcThreshold := agentConfig.Server.DeploymentGCThreshold; gcThreshold != "" {
|
||||
dur, err := time.ParseDuration(gcThreshold)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conf.DeploymentGCThreshold = dur
|
||||
}
|
||||
|
||||
if heartbeatGrace := agentConfig.Server.HeartbeatGrace; heartbeatGrace != "" {
|
||||
dur, err := time.ParseDuration(heartbeatGrace)
|
||||
|
|
|
@ -71,6 +71,7 @@ server {
|
|||
node_gc_threshold = "12h"
|
||||
job_gc_threshold = "12h"
|
||||
eval_gc_threshold = "12h"
|
||||
deployment_gc_threshold = "12h"
|
||||
heartbeat_grace = "30s"
|
||||
retry_join = [ "1.1.1.1", "2.2.2.2" ]
|
||||
start_join = [ "1.1.1.1", "2.2.2.2" ]
|
||||
|
|
|
@ -270,6 +270,11 @@ type ServerConfig struct {
|
|||
// can be used to filter by age.
|
||||
EvalGCThreshold string `mapstructure:"eval_gc_threshold"`
|
||||
|
||||
// DeploymentGCThreshold controls how "old" a deployment must be to be
|
||||
// collected by GC. Age is not the only requirement for a deployment to be
|
||||
// GCed but the threshold can be used to filter by age.
|
||||
DeploymentGCThreshold string `mapstructure:"deployment_gc_threshold"`
|
||||
|
||||
// HeartbeatGrace is the grace period beyond the TTL to account for network,
|
||||
// processing delays and clock skew before marking a node as "down".
|
||||
HeartbeatGrace string `mapstructure:"heartbeat_grace"`
|
||||
|
@ -916,6 +921,9 @@ func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig {
|
|||
if b.EvalGCThreshold != "" {
|
||||
result.EvalGCThreshold = b.EvalGCThreshold
|
||||
}
|
||||
if b.DeploymentGCThreshold != "" {
|
||||
result.DeploymentGCThreshold = b.DeploymentGCThreshold
|
||||
}
|
||||
if b.HeartbeatGrace != "" {
|
||||
result.HeartbeatGrace = b.HeartbeatGrace
|
||||
}
|
||||
|
|
|
@ -504,6 +504,7 @@ func parseServer(result **ServerConfig, list *ast.ObjectList) error {
|
|||
"node_gc_threshold",
|
||||
"eval_gc_threshold",
|
||||
"job_gc_threshold",
|
||||
"deployment_gc_threshold",
|
||||
"heartbeat_grace",
|
||||
"start_join",
|
||||
"retry_join",
|
||||
|
|
|
@ -82,22 +82,23 @@ func TestConfig_Parse(t *testing.T) {
|
|||
NoHostUUID: helper.BoolToPtr(false),
|
||||
},
|
||||
Server: &ServerConfig{
|
||||
Enabled: true,
|
||||
BootstrapExpect: 5,
|
||||
DataDir: "/tmp/data",
|
||||
ProtocolVersion: 3,
|
||||
NumSchedulers: 2,
|
||||
EnabledSchedulers: []string{"test"},
|
||||
NodeGCThreshold: "12h",
|
||||
EvalGCThreshold: "12h",
|
||||
JobGCThreshold: "12h",
|
||||
HeartbeatGrace: "30s",
|
||||
RetryJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
StartJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
RetryInterval: "15s",
|
||||
RejoinAfterLeave: true,
|
||||
RetryMaxAttempts: 3,
|
||||
EncryptKey: "abc",
|
||||
Enabled: true,
|
||||
BootstrapExpect: 5,
|
||||
DataDir: "/tmp/data",
|
||||
ProtocolVersion: 3,
|
||||
NumSchedulers: 2,
|
||||
EnabledSchedulers: []string{"test"},
|
||||
NodeGCThreshold: "12h",
|
||||
EvalGCThreshold: "12h",
|
||||
JobGCThreshold: "12h",
|
||||
DeploymentGCThreshold: "12h",
|
||||
HeartbeatGrace: "30s",
|
||||
RetryJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
StartJoin: []string{"1.1.1.1", "2.2.2.2"},
|
||||
RetryInterval: "15s",
|
||||
RejoinAfterLeave: true,
|
||||
RetryMaxAttempts: 3,
|
||||
EncryptKey: "abc",
|
||||
},
|
||||
Telemetry: &Telemetry{
|
||||
StatsiteAddr: "127.0.0.1:1234",
|
||||
|
|
|
@ -142,10 +142,18 @@ type Config struct {
|
|||
// NodeGCInterval is how often we dispatch a job to GC failed nodes.
|
||||
NodeGCInterval time.Duration
|
||||
|
||||
// NodeGCThreshold is how "old" a nodemust be to be eligible
|
||||
// NodeGCThreshold is how "old" a node must be to be eligible
|
||||
// for GC. This gives users some time to view and debug a failed nodes.
|
||||
NodeGCThreshold time.Duration
|
||||
|
||||
// DeploymentGCInterval is how often we dispatch a job to GC terminal
|
||||
// deployments.
|
||||
DeploymentGCInterval time.Duration
|
||||
|
||||
// DeploymentGCThreshold is how "old" a deployment must be to be eligible
|
||||
// for GC. This gives users some time to view terminal deployments.
|
||||
DeploymentGCThreshold time.Duration
|
||||
|
||||
// EvalNackTimeout controls how long we allow a sub-scheduler to
|
||||
// work on an evaluation before we consider it failed and Nack it.
|
||||
// This allows that evaluation to be handed to another sub-scheduler
|
||||
|
@ -255,6 +263,8 @@ func DefaultConfig() *Config {
|
|||
JobGCThreshold: 4 * time.Hour,
|
||||
NodeGCInterval: 5 * time.Minute,
|
||||
NodeGCThreshold: 24 * time.Hour,
|
||||
DeploymentGCInterval: 5 * time.Minute,
|
||||
DeploymentGCThreshold: 1 * time.Hour,
|
||||
EvalNackTimeout: 60 * time.Second,
|
||||
EvalDeliveryLimit: 3,
|
||||
EvalNackInitialReenqueueDelay: 1 * time.Second,
|
||||
|
|
|
@ -76,6 +76,10 @@ server {
|
|||
evaluation must be in the terminal state before it is eligible for garbage
|
||||
collection. This is specified using a label suffix like "30s" or "1h".
|
||||
|
||||
- `deployment_gc_threshold` `(string: "1h")` - Specifies the minimum time a
|
||||
deployment must be in the terminal state before it is eligible for garbage
|
||||
collection. This is specified using a label suffix like "30s" or "1h".
|
||||
|
||||
- `num_schedulers` `(int: [num-cores])` - Specifies the number of parallel
|
||||
scheduler threads to run. This can be as many as one per core, or `0` to
|
||||
disallow this server from making any scheduling decisions. This defaults to
|
||||
|
|
Loading…
Reference in New Issue