You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 26, 2023. It is now read-only.
Update allocations no longer require that healthy nodes be destroyed (#16)
Currently, adding an additional node to an existing Redis Cluster would change
the flags being passed to the `attache-control` sidecar task for every existing
allocation. The Nomad scheduler would (correctly) trigger a destructive update
(e.g. reallocate, stop, migrate, and restart) of each existing Redis Cluster
node even though they were already healthy. This is because the Nomad scheduler
can only update an allocation in-place when there are no attributes (environment
variables, file templates, etc.) relevant to any of that job's tasks being
updated.
This PR updates `attache-control` to fetch these counts from a Consul KV path
instead.
To ensure consistency between, the scaling configuration stored in the Consul
and the total number of nodes in the Nomad job specification, I've added a
Terraform file that sets both of them. For more information, see the updated
README.
Lastly, we're approaching the point where more folks may begin to touch this
code so I've also taken the time to comment up my exported structs, fields, and
methods.
flag.IntVar(&conf.RedisPrimaryCount, "redis-primary-count", 0, "Total number of expected Redis shard primary nodes, (required)")
56
-
flag.IntVar(&conf.RedisReplicaCount, "redis-replica-count", 0, "Total number of expected Redis shard replica nodes")
57
-
flag.StringVar(&conf.LockPath, "lock-kv-path", "service/attache/leader", "Consul KV path used as a distributed lock for operations")
58
-
flag.DurationVar(&conf.AttemptInterval, "attempt-interval", 3*time.Second, "Duration to wait between attempts to join or create a cluster")
59
-
flag.IntVar(&conf.AttemptLimit, "attempt-limit", 20, "Number of times to attempt joining or creating a cluster before exiting")
60
-
flag.StringVar(&conf.AwaitServiceName, "await-service-name", "", "Consul Service for newly created Redis Cluster Nodes, (required)")
61
-
flag.StringVar(&conf.DestServiceName, "dest-service-name", "", "Consul Service for healthy Redis Cluster Nodes, (required)")
62
-
flag.StringVar(&conf.LogLevel, "log-level", "info", "Set the log level")
109
+
flag.StringVar(&conf.lockPath, "lock-kv-path", "service/attache/leader", "Consul KV path to use as a leader lock for Redis Cluster operations")
110
+
flag.DurationVar(&conf.attemptInterval, "attempt-interval", 3*time.Second, "Duration to wait between attempts to join or create a cluster (e.g. '1s')")
111
+
flag.IntVar(&conf.attemptLimit, "attempt-limit", 20, "Number of times to attempt for or join a cluster before exiting")
112
+
flag.StringVar(&conf.awaitServiceName, "await-service-name", "", "Consul Service for newly created Redis Cluster Nodes, (required)")
113
+
flag.StringVar(&conf.destServiceName, "dest-service-name", "", "Consul Service for healthy Redis Cluster Nodes, (required)")
114
+
flag.StringVar(&conf.logLevel, "log-level", "info", "Set the log level")
flag.BoolVar(&conf.ConsulOpts.EnableTLS, "consul-tls-enable", false, "Enable mTLS for the Consul client (requires 'consul-tls-ca-cert', 'consul-tls-cert', 'consul-tls-key')")
129
+
flag.StringVar(&conf.ConsulOpts.TLSCACertFile, "consul-tls-ca-cert", "", "Consul client CA certificate file")
0 commit comments