cookbook 'cluster-search', '= 1.3.0'
cluster-search (9) Versions 1.3.0 Follow2
Library to help searching cluster nodes in Chef cookbooks
cookbook 'cluster-search', '= 1.3.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
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.
Libraries
default
Implements cluster_search
method.
Recipes
default
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 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.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.3.0 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.3.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
License Metric
1.3.0 passed this metric
Testing File Metric
1.3.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.3.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.3.0 failed this metric
1.3.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
License Metric
1.3.0 passed this metric
Testing File Metric
1.3.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.3.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.3.0 passed this metric
1.3.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.3.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.3.0 failed this metric