-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove count restriction in leader topology #299
Remove count restriction in leader topology #299
Conversation
examples/leader/README.md
Outdated
|
||
Note: Whenever creating a `leader` topology specify instance `count` of 3 or more and would be best if the number is odd, this is so the election can take place. | ||
Note: To have a functioning cluster, you must set the `count` to atleast 3, when creating a `leader` topology. It would be best to if the number is odd, as this prevents a split quorum during the leader election. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
Note: To have functioning services in the `leader` topology, you must set the `count` field to at least 3. It is recommended that the number is odd as this prevents a split quorum during the leader election.
examples/leader/habitat.yml
Outdated
@@ -10,8 +10,10 @@ spec: | |||
v1beta2: | |||
# the core/redis habitat service packaged as a Docker image | |||
image: habitat/redis-hab | |||
# count must be at least 3 for a leader-follower topology | |||
count: 3 | |||
# While it is possible to deploy only one pod in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it is possible to deploy only one pod with a service instance in the
examples/leader/habitat.yml
Outdated
# count must be at least 3 for a leader-follower topology | ||
count: 3 | ||
# While it is possible to deploy only one pod in the | ||
# leader-follower topology, at least at least 3 instances are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least one at least
too many. ;)
examples/leader/habitat.yml
Outdated
count: 3 | ||
# While it is possible to deploy only one pod in the | ||
# leader-follower topology, at least at least 3 instances are | ||
# required for a functioning cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required for services to be started by the supervisor.
pkg/controller/v1beta2/utils.go
Outdated
switch spec.Service.Topology { | ||
case habv1beta1.TopologyStandalone: | ||
case habv1beta1.TopologyLeader: | ||
if spec.Count < leaderFollowerTopologyMinCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just drop this if
instead of rewriting the switch
to if
. What do you think?
4667f91
to
aead737
Compare
@@ -54,9 +54,6 @@ func validateCustomObject(h habv1beta1.Habitat) error { | |||
switch spec.Service.Topology { | |||
case habv1beta1.TopologyStandalone: | |||
case habv1beta1.TopologyLeader: | |||
if spec.Count < leaderFollowerTopologyMinCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the leaderFollowerTopologyMinCount
used anywhere after dropping this line? If no, then maybe drop the constant too.
@@ -54,9 +54,6 @@ func validateCustomObject(h habv1beta1.Habitat) error { | |||
switch spec.Service.Topology { | |||
case habv1beta1.TopologyStandalone: | |||
case habv1beta1.TopologyLeader: | |||
if spec.Count < leaderFollowerTopologyMinCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here about leaderFollowerTopologyMinCount
.
While atleast three instances are required for a functioning cluster in the leader topology, we should not prevent users from making deployments with initial count set to one. This change allows users to incrementally add instances if that fits their requirements better instead of forcing them to add atleast three right from the onset. Signed-off-by: Indradhanush Gupta <indra@kinvolk.io>
aead737
to
1640cbd
Compare
LFAD. |
Merged on the command line. |
While atleast three instances are required for a functioning cluster
in the leader topology, we should not prevent users from making
deployments with initial count set to one. This change allows users to
incrementally add instances if that fits their requirements better
instead of forcing them to add atleast three right from the onset.
Signed-off-by: Indradhanush Gupta indra@kinvolk.io