You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Conftool

From Wikitech-static
Revision as of 16:08, 22 June 2015 by imported>Giuseppe Lavagetto (→‎Add a service)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page is being built, none of the information contained here is probably valid right now

Conftool is a set of tools we use to sync and manage the dynamic state configuration for a few services (currently, only varnish backend lists and the pybal pools). This configuration is stored

Overview

Conftool just gets information input in a series of config files, which are in the conftool directory in the puppet repository. These files represent a static view of the configuration - so a few information about services we manage, and then which services are installed on which hosts. There is another part of the equation, which is the dynamic state of such configuration (such as, the weight of the server in its pool, and the information about either having the server pooled or not), which is left untouched by the sync (apart from setting default values in newly added hosts).

The config files

Relative to the conftool root, configuration files are organized as follows:

  • the services directory contains a single file called data.yaml and has all the information on services, in the following form:
cluster_name:
  service_name:
    port: 1234
    default_values:
      pooled: inactive
      weight: 10
    datacenters:
      - eqiad
  another_service:
  ...

here, cluster_name is supposed to be almost always a 1:1 correspondence to the 'cluster' we define in puppet.

  • the nodes directory, where we have instead one file per datacenter, so nodes/eqiad.yaml. The format is again quite simple:
cluster_name:
  node_name.eqiad.wmnet:
    - service_name
    - another_service
  another_node.eqiad.wmnet:
    - service_name
...

The tools

Currently, we have two tools, both installed on the puppetmaster:

  • conftool-sync which is used to sync what we write in the files described above to the distributed kv-cluster (at the moment of writing, it's [Etcd], but this may well change in the future. It will not be called by you directly, in most cases, you will just call conftool-merge (in a near future, it will be directly invoked by puppet-merge on the puppetmaster.
  • confctl is the tool to interact with the k-v store, a typical invocation could be:
confctl --tags dc=eqiad,cluster=cache_text,service=varnish-be --action get cp1052

{"cp1052": {"pooled": "no", "weight": 0}}

where the tags argument is a comma-separated list of data that specifies the service you want to query, so for the varnish backend service of the cache_text cluster in the equiad datacenter will look like shown above.

The required tag list of course changes, but conftool will complain if you don't specify those correctly. Of course you can work on any object, you just need to specify the object-type parameter. So for example:

confctl --object-type service --tags cluster=cache_text --action get varnish-be

will work as well.

In puppet

Conftool is installed by including the conftool class into your node manifest. It won't install the conftool-data directory, though, which is part of the puppet git repository. So it's pretty natural for palladium (the puppetmaster) to be the standard machine where you should run conftool.

Operating

Add a service

If you need to add a service to a cluster, just edit the relevant yaml file in conftool-data/services, adding a service entry, and then run conftool-sync.

So for now you typically:

  • Create a puppet change adding the service stanza
  • On palladium, you run puppet-merge
  • Again on palladium, you run conftool-merge without arguments (this is a wrapper script that "does the right thing")

Add a server node to a pool

Modify the state of a server in a pool

Decommission a server

=== Add a service