forked from elastic/cloud-on-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix how cluster.initial_master_nodes is set (elastic#2315)
* Fix how cluster.initial_master_nodes is set We had a bug where the value of `cluster.initial_master_nodes` would not be set while upgrading a single v6 cluster to v7. This commit fixes it by handling `cluster.initial_master_nodes` differently. :: Annotation logic Instead of relyin on the ClusterUUID annotation to know whether a cluster is bootstrapped, and manually removing on the special case of a single v6 -> v7 annotation, we now rely on a dedicated annotation: `elasticsearch.k8s.elastic.co/initial-master-nodes: node-0,node-1,node-2`. When that annotation is set at the cluster level, it means the cluster is currently bootstrapping for zen2. Any v7+ master node must have `cluster.initial_master_nodes` in its configuration set to the value in the annotation. This value is not supposed to vary over time, we make sure that is the case here. Once we detect the cluster has finished its bootstrap (the current master of the cluster is a v7+ master node), we remove the annotation, and remove the configuration setting from master nodes. :: When should cluster.initial_master_nodes be set? There are 2 cases where this setting must be set: - when we create a v7+ cluster for the first time - when we upgrade/restart a single v6 master to v7: that new master must identify itself as a legit master We don't want to set this setting when: - we do a regular rolling-upgrade of multiple master nodes from v6 to v7 - Elasticsearch is not running in v7+ :: Edge cases The following cases are quite tricky and covered by unit & E2E tests: * upgrade from a single v6 master to a single v7 master **in a different NodeSet**. The new master will be created before the old one gets removed, hence the setting should not be set. * upgrade from a single v6 master to more v7 masters. The new v7 masters will be created before the v6 master is upgraded, hence the setting should not be set. * upgrade from two v6 masters to two v7 masters. This is a regular rolling upgrade, hence the setting should not be set. However when the first master goes down for upgrade, the cluster becomes unavailable since minimum_master_nodes=2. * Fix V7 comparison in client * Remove new lines in imports * Improve readability by extracting checks * Don't error out if no master yet Co-authored-by: Michael Morello <michael.morello@gmail.com>
- Loading branch information
1 parent
3da4bf1
commit 241a470
Showing
22 changed files
with
764 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.