cookbook 'cluster-search', '~> 1.6.0'
cluster-search (9) Versions 1.6.0 Follow2
Library to help searching cluster nodes in Chef cookbooks
cookbook 'cluster-search', '~> 1.6.0', :supermarket
knife supermarket install cluster-search
knife supermarket download cluster-search
Cluster Search
Description
Cluster Search (cluster-search) is a simple cookbook library which simplify
the search of members of a cluster. It relies on Chef search with a size guard
(to avoid inconsistencies during initial convergence) and allows a fall-back
to any listing if user does not want to rely on searches (because of
chef-solo for example).
Requirements
None. Should work on any platform.
Usage
First, call ::Chef::Recipe.send(:include, ClusterSearch)
to be able to use
cluster_search
in your recipe.
Then method cluster_search
take one argument and an optional block.
The argument is a hash which could contain:
-
role
(the name is configurable by attributes) andsize
to use search. Ex:{ role: my_search, size: 2 }
- or
hosts
to use a static list. Ex:{ hosts: [ some_node ] }
Note:
- If both are defined,
hosts
is used. - Size check can be deactivated by not setting it or setting it to zero. It is not recommended to disable it when searching for sibling as it can cause configuration fluctuations during cluster convergence (first node of the cluster to run Chef will find only itself, then two nodes, etc.).
It returns the list of the members of a cluster hosts
and current node ID
my_id
for this cluster (or -1 it is not a member). By default (no block
passed), the hosts
result is a list of FQDN, extracted with node['fqdn']
.
By passing the block { |n| n['ipaddress'] }
, you will get the list of IP
addresses. And so on.
For search, we suppose that all members of a cluster have a common role in
their run-list. For instance, all zookeeper nodes of a dedicated cluster for
kafka could use role zookeeper-kafka. By defining role
to
zookeeper-kafka and configuring size
to the expected size of the cluster,
we can find all the cluster members.
We can find input/output examples (used for test cases) in file
.kitchen.yml.
Attributes
Configuration is done by overriding default attributes. All configuration keys
have a default defined in [attributes/default.rb](attributes/default.rb).
Please read it to have a comprehensive view of what and how you can configure
this cookbook behavior.
Libraries
default
Implements cluster_search
method.
Recipes
default
Do nothing
test
Recipe used for testing.
Changelog
Available in [CHANGELOG](CHANGELOG).
Contributing
Please read carefully [CONTRIBUTING.md](CONTRIBUTING.md) before making a merge
request.
License and Author
- Author:: Samuel Bernard (samuel.bernard@gmail.com)
Copyright (c) 2015-2016 Sam4Mobile, 2017-2020 Make.org Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Changelog
1.6.0
Main:
- feat: use 'fun' key in hash for post processing
- It was possible to use cluster_search with a block to add some post-processing, it is now possible to set this block as a string with 'fun' as key in the config argument.
Tests:
- test: include gitlab-ci.yml from test-cookbook
- test: use chefplatform image instead of makeorg
- test: rename kitchen config file without dot
- test: add rspec-core in Gemfile
- test: accept chef license
Misc:
- chore: set generic maintainer & helpdesk email
- chore: add supermarket category in .category
- doc: use doc in git message instead of docs
- style(rubocop): fix use e instead error
- style(rubocop): fix use empty line after guard
- style(rubocop): fix frozen string missing
- style(rubocop): fix offenses format and include
1.5.0
Main:
- feat: make search attribute ('role') configurable
- Add an attribute to configure the searchable attribute (default "role") to allow search on "role:something" (instead of "roles:something"): defining a "role" attribute was conflicting with "role" search.
Tests:
- use .gitlab-ci.yml template [20180209]
- replace obsolete require_chef_omnibus config
Misc:
- style: fix rubocop offense on re-enable cop
- chore: add 2018 to copyright notice
1.4.0
Main:
- fix: apply custom output also to current node
Tests:
- use .gitlab-ci.yml template [20170712]
- add a test case on custom output for current node
1.3.1
Main:
- #5: fix: size may be invalid if check is deactivated
1.3.0
Main:
- #4: deactivate size check if size is undefined or set to zero
- #3: allow passing a block to apply on results to output ipaddresses or else
Tests:
- use .gitlab-ci.yml template [20170529]
- add build_pull to download latest image
Misc:
- add chef_version 12.14 & centos in metadata
- foodcritic: fix license format in metadata
- use karma for git format in contributing
1.2.0
Main:
- issue #1: search nodes within the same environment
Tests:
- Use kitchen-docker_cli instead of kitchen-docker
- Use continuous integration with gitlab-ci
- Up-to-date kitchen.yml (image, no preparation, always use latest deps, etc.)
- Use gitlab-ci config template (20170202)
Misc:
- Use cookbook_name alias instead of cluster_search
- Handover maintenance to chef-platform group, change urls and maintainer
1.1.1
- Fix markdown in changelog
1.1.0
Misc:
- Switch kitchen driver to docker_cli
- Fix all rubocop offenses
- Add Apache 2 License file
- Move changelog and contributing section from README to external files
- Clean headers
1.0.0
- Initial version, tested with full kitchen suites
Collaborator Number Metric
1.6.0 passed this metric
Contributing File Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.6.0 passed this metric
No Binaries Metric
1.6.0 passed this metric
Testing File Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.6.0 passed this metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.6.0 passed this metric
No Binaries Metric
1.6.0 passed this metric
Testing File Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.6.0 passed this metric
1.6.0 passed this metric
Testing File Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.6.0 failed this metric
1.6.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number