-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
leader
key to render context bind information
Previously, determining the leader of a service group was complicated. If the service was running in a leader topology, the `{{bind.<BIND>.first}}` key would be the leader, but we didn't directly indicate if that was the case (you could have queried to see if `{{bind.<BIND>.first.leader}}` was `true`, but that leads to some needlessly verbose templates. Now, we introduce an explicit `leader` key, which will be non-null if the service group has a leader. Furthermore, the use of `first` is deprecated, since the meaning of it is not deterministic (it could be a non-alive member of the service group, for instance, which is not what anyone wants). The `first` key will remain in rendering contexts for the foreseeable future, but users are encouraged to use `{{bind.<BIND>.leader}}` if they want the leader, and `{{bind.<BIND>.members[0]}}` otherwise, pending future refactorings. Documentation is updated to reflect this, and a new `$deprecated` and `$since` key are used in our JSON Schema to indicate when an old field is deprecated, and when a new one is introduced. Our JSON Schema parser is configured to allow non-standard keywords like this through its processing, and this provides some additional hooks that a future automated documentation generator can use (see #4824) Fixes #4127 Signed-off-by: Christopher Maier <cmaier@chef.io>
- Loading branch information
1 parent
9d7db22
commit f2e4467
Showing
3 changed files
with
74 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,6 +388,7 @@ | |
"update_follower": false, | ||
"update_leader": false | ||
}, | ||
"leader": null, | ||
"members": [ | ||
{ | ||
"alive": true, | ||
|