Page MenuHomePhabricator

Cookbook for rack depool
Open, MediumPublic

Description

More like a sketch than a full on solution.

It would be quite valuable for network maintenance and outage response to have a cookbook allowing to depool all servers in a given rack.
Full row is not necessary as we're moving toward a per rack redundancy model (and we could in extreme cases run it multiple times).

I think most of the building blocks are there (restart cookbooks, restart doc), and what's needed is the glue between them.

An idea is to have per team or server types cookbooks, that are themselves called by this meta cookbook. Hosts with no downtime cookbook would be listed in the script output.
Many hosts also have a depool command line tool, that takes care of all the depool action, for such hosts the cookbook could do it via cumin (which would only work for maintenance and not when the rack is down).
Cookbook could also check etcd if it manages that host's pooled status.


Current status.
I've spent a bit more time on it, and the current (still WIP) cookbook is on Gerrit : https://gerrit.wikimedia.org/r/c/1239896
The cookbook requires Hiera definitions to tie a pool or depool action to a Puppet role. You can see examples in this CR: https://gerrit.wikimedia.org/r/c/operations/puppet/+/1249958

This will not try to depool the host, it will display: skipping host (no depool needed). It's also possible to specify a message that will be displayed.

profile::server_depool:
  policy: skip

This will (eventually) connect to the host and run the local "depool" command. And display it when running it as --show

profile::server_depool:
  policy: local_command
  command: depool

Some additional information :

  • There is also the possibility to call a 3rd party cookbook
  • k8s hosts will be handled a bit differently as they already have a cookbook to depool a full rack.
  • The same key have a profile::server_pool equivalent
  • If the Hiera key is not present, it will show : Couldn't get or parse depool Hiera key
  • If the --teams parameter is used, it will group the hosts by teams (see full run example bellow).
cumin1003:~$ time test-cookbook -c 1239896 --no-sal-logging sre.network.depool-rack --site eqiad --rack D7 --show --team depool
[...]
an-master1004: Couldn't get or parse depool Hiera key
an-worker1152: skipping host (no depool needed)
an-worker1232: skipping host (no depool needed)
aux-k8s-worker1007: Couldn't get or parse depool Hiera key
backup1007: Couldn't get or parse depool Hiera key
cirrussearch1120: Couldn't get or parse depool Hiera key
cirrussearch1121: Couldn't get or parse depool Hiera key
cirrussearch1122: Couldn't get or parse depool Hiera key
dbprov1004: Couldn't get or parse depool Hiera key
dse-k8s-worker1021: Couldn't get or parse depool Hiera key
ganeti1051: skipping host (Use sre.ganeti.drain-node, primaries need to be failed-over too)
ganeti1052: skipping host (Use sre.ganeti.drain-node, primaries need to be failed-over too)
logging-hd1003: skipping host (No cookbook, no depool needed but there's a switch we can flip to mitigate the churn caused when the cluster detects a down node)
lvs1020: Couldn't get or parse depool Hiera key
mc-gp1006: Couldn't get or parse depool Hiera key
ms-be1093: skipping host (Can't be depooled, need to go down one at a time with special care)
prometheus1007: skipping host (doesn't require any depooling)
wikikube-worker1370: skipping host (insetup role)
['Data Platform']: ['an-master1004', 'an-worker1152', 'an-worker1232', 'dse-k8s-worker1021']
['Infrastructure Foundations']: ['aux-k8s-worker1007', 'ganeti1051', 'ganeti1052']
['Data Persistence']: ['backup1007', 'dbprov1004', 'ms-be1093']
['Search Platform']: ['cirrussearch1120', 'cirrussearch1121', 'cirrussearch1122']
['Observability']: ['logging-hd1003', 'prometheus1007']
['Traffic']: ['lvs1020']
['ServiceOps']: ['mc-gp1006', 'wikikube-worker1370']

real	7m34.104s

In its current state, only in show mode, the cookbook has been useful to see what can and can't be depooled easily.

Next steps are to validate the Hiera keys and overall data structure and get SRE participation to cover as many servers roles as possible.

Then continue improving the cookbook :

  • Add full k8s support
  • Add the possibility to update a task
  • Add the possibility to downtime all the servers
  • Test thoroughly (both pool and depool actions)
  • Longer term: tackle servers that are connected to the ToR switches instead of the rack (for special cases like E12 rack).

Details

Related Changes in Gerrit:
SubjectAuthorRepoBranchLines +/-
Jeltooperations/puppetproduction+4 -0
Bkingoperations/puppetproduction+5 -0
Ayounsioperations/puppetproduction+4 -3
Cathal Mooneyoperations/puppetproduction+3 -3
Cathal Mooneyoperations/puppetproduction+1 -1
Ayounsioperations/puppetproduction+8 -0
Cathal Mooneyoperations/puppetproduction+3 -0
Ayounsioperations/cookbooksmaster+11 -7
Ayounsioperations/puppetproduction+12 -0
Scott Frenchoperations/puppetproduction+6 -0
Bkingoperations/puppetproduction+15 -0
Ayounsioperations/cookbooksmaster+25 -7
Ayounsioperations/cookbooksmaster+1 -1
Ayounsioperations/puppetproduction+8 -0
Ayounsioperations/puppetproduction+5 -0
Muehlenhoffoperations/puppetproduction+4 -0
Ayounsioperations/puppetproduction+32 -1
Ayounsioperations/cookbooksmaster+210 -0
Ayounsioperations/puppetproduction+4 -0
Ayounsioperations/puppetproduction+9 -4
Ayounsioperations/puppetproduction+100 -0
Ayounsioperations/puppetproduction+8 -0
Bkingoperations/puppetproduction+5 -0
Ayounsioperations/puppetproduction+32 -0
Ayounsioperations/puppetproduction+12 -1
Ayounsioperations/puppetproduction+12 -0
Ayounsioperations/puppetproduction+37 -1
Ayounsioperations/puppetproduction+42 -0
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ayounsi renamed this task from Cookbook for rack downtime to Cookbook for rack depool.Jan 26 2023, 2:01 PM

Change #1239896 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/cookbooks@master] WIP: create cookbook to depool all services in a given rack

https://gerrit.wikimedia.org/r/1239896

Change #1243077 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] [WIP] Add depool strategy for rack depool cookbook

https://gerrit.wikimedia.org/r/1243077

Change #1243077 merged by Ayounsi:

[operations/puppet@production] [WIP] Add depool strategy for rack depool cookbook

https://gerrit.wikimedia.org/r/1243077

Change #1249958 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add more depool strategies for rack depool cookbook

https://gerrit.wikimedia.org/r/1249958

Example output in its current state with --show --teams for eqiad rack D7:

an-master1004: Couldn't get or parse depool Hiera key
an-worker1152: skipping host (no depool needed)
an-worker1231: skipping host (no depool needed)
an-worker1232: skipping host (no depool needed)
aux-k8s-worker1007: skipping host (insetup role, can go down anytime)
backup1007: Couldn't get or parse depool Hiera key
cirrussearch1120: Couldn't get or parse depool Hiera key
cirrussearch1121: Couldn't get or parse depool Hiera key
cirrussearch1122: Couldn't get or parse depool Hiera key
cp1115: depool using local_command depool
dbprov1004: Couldn't get or parse depool Hiera key
ganeti1051: skipping host (Use sre.ganeti.drain-node, primaries need to be failed-over too)
ganeti1052: skipping host (Use sre.ganeti.drain-node, primaries need to be failed-over too)
logging-hd1003: skipping host (No cookbook, no depool needed but there's a switch we can flip to mitigate the churn caused when the cluster detects a down node)
lvs1020: Couldn't get or parse depool Hiera key
mc-gp1006: Couldn't get or parse depool Hiera key
ms-be1093: Couldn't get or parse depool Hiera key
prometheus1007: skipping host (doesn't require any depooling)
wikikube-worker1370: Couldn't get or parse depool Hiera key
['Data Platform']: ['an-master1004', 'an-worker1152', 'an-worker1231', 'an-worker1232']
['Infrastructure Foundations']: ['aux-k8s-worker1007', 'ganeti1051', 'ganeti1052']
['Data Persistence']: ['backup1007', 'dbprov1004', 'ms-be1093']
['Search Platform']: ['cirrussearch1120', 'cirrussearch1121', 'cirrussearch1122']
['Traffic']: ['cp1115', 'lvs1020']
['Observability']: ['logging-hd1003', 'prometheus1007']
['ServiceOps']: ['mc-gp1006', 'wikikube-worker1370']

Change #1249958 merged by Ayounsi:

[operations/puppet@production] Add more depool strategies for rack depool cookbook

https://gerrit.wikimedia.org/r/1249958

Should the policy: local_command option have a separate setting for a command for re-pooling the node?

yeah it's planned with profile::server_pool (and the same keys), focusing on the depool for now, especially for the show command.

Databases now have a centralized depool and repool cookbook that encapsulates all the different ways you need to depool and repool db hosts (for different clusters). I wonder we can integrate that. I dream of a day that netops or dcops depool and repool most db hosts and do maintenance without even needing to notify DBAs (with exception of master of core clusters but that's like 20 hosts in total). What do you think @Marostegui ?

Databases now have a centralized depool and repool cookbook that encapsulates all the different ways you need to depool and repool db hosts (for different clusters). I wonder we can integrate that. I dream of a day that netops or dcops depool and repool most db hosts and do maintenance without even needing to notify DBAs (with exception of master of core clusters but that's like 20 hosts in total). What do you think @Marostegui ?

There's a bit more than that, but yes, with the proper safety measures in place, we should ideally be able to depool a whole rack if the hosts are depoolable. At the moment, I think an important missing piece from our side (WIP) is the source of truth to be able to map host <-> role <-> rack <-> "depoolable?"
I don't think we are super far from this, but we still have quite some work ahead.

In zarcillo we have the relation host <-> role <-> rack and we can label replicas and candidates as depoolable (but not primary/DC masters). We can use an SQL query for this and I can also expose a dedicated HTTP API if needed.

In zarcillo we have the relation host <-> role <-> rack and we can label replicas and candidates as depoolable (but not primary/DC masters). We can use an SQL query for this and I can also expose a dedicated HTTP API if needed.

That's great ! Let's maybe discuss it in another task, but an API endpoint that returns if a DB server can be depooled, and if needed, how, would be quite valuable.

Change #1286296 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add network depool strategy to some DB roles

https://gerrit.wikimedia.org/r/1286296

Change #1286296 merged by Ayounsi:

[operations/puppet@production] Add network depool strategy to some DB roles

https://gerrit.wikimedia.org/r/1286296

Change #1286812 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add more profile::server_depool policies to DB hosts

https://gerrit.wikimedia.org/r/1286812

Change #1286820 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add profile::server_depool policy for kafka hosts

https://gerrit.wikimedia.org/r/1286820

Change #1286820 merged by Ayounsi:

[operations/puppet@production] Add profile::server_depool policy for kafka hosts

https://gerrit.wikimedia.org/r/1286820

Change #1286812 merged by Ayounsi:

[operations/puppet@production] Add more profile::server_depool policies to DB hosts

https://gerrit.wikimedia.org/r/1286812

Change #1287481 had a related patch set uploaded (by Bking; author: Bking):

[operations/puppet@production] cirrussearch: Add server depool metadata

https://gerrit.wikimedia.org/r/1287481

Change #1287481 merged by Bking:

[operations/puppet@production] cirrussearch: Add server depool metadata

https://gerrit.wikimedia.org/r/1287481

Change #1288524 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add profile::server_depool policy for k8s hosts

https://gerrit.wikimedia.org/r/1288524

Change #1288525 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add depool policy for all insetup roles and ml_cache::storage

https://gerrit.wikimedia.org/r/1288525

Change #1288524 merged by Ayounsi:

[operations/puppet@production] Add profile::server_depool policy for k8s hosts

https://gerrit.wikimedia.org/r/1288524

Change #1288525 merged by Ayounsi:

[operations/puppet@production] Add depool policy for all insetup roles and ml_cache::storage

https://gerrit.wikimedia.org/r/1288525

Change #1289900 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add depool policy for wdqs::scholarly and netmon hosts

https://gerrit.wikimedia.org/r/1289900

Change #1289900 merged by Ayounsi:

[operations/puppet@production] Add depool policy for wdqs::scholarly and netmon hosts

https://gerrit.wikimedia.org/r/1289900

Change #1299471 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add rack depool strategy for role aux_k8s::worker

https://gerrit.wikimedia.org/r/1299471

Change #1299471 merged by Ayounsi:

[operations/puppet@production] Add rack depool strategy for role aux_k8s::worker

https://gerrit.wikimedia.org/r/1299471

Change #1239896 merged by jenkins-bot:

[operations/cookbooks@master] Create cookbook to depool all services in a given rack

https://gerrit.wikimedia.org/r/1239896

Change #1305050 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add more server_depool policies

https://gerrit.wikimedia.org/r/1305050

Change #1305050 merged by Ayounsi:

[operations/puppet@production] Add more server_depool policies

https://gerrit.wikimedia.org/r/1305050

Change #1305350 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add depool policy for VTRS

https://gerrit.wikimedia.org/r/1305350

Change #1305387 had a related patch set uploaded (by Muehlenhoff; author: Muehlenhoff):

[operations/puppet@production] profile::server_depool: Mark ganeti/test as fine to ignore

https://gerrit.wikimedia.org/r/1305387

Change #1305387 merged by Ayounsi:

[operations/puppet@production] profile::server_depool: Mark ganeti/test as fine to ignore

https://gerrit.wikimedia.org/r/1305387

Change #1305350 merged by Ayounsi:

[operations/puppet@production] Add depool policy for VTRS

https://gerrit.wikimedia.org/r/1305350

Change #1305422 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] profile::server_depool for memcache and k8s master

https://gerrit.wikimedia.org/r/1305422

Change #1305422 merged by Ayounsi:

[operations/puppet@production] profile::server_depool for memcache and k8s master

https://gerrit.wikimedia.org/r/1305422

Change #1305564 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/cookbooks@master] depool-rack: properly call getattr()

https://gerrit.wikimedia.org/r/1305564

Change #1305564 merged by jenkins-bot:

[operations/cookbooks@master] depool-rack: properly call getattr()

https://gerrit.wikimedia.org/r/1305564

Change #1306551 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/cookbooks@master] depool-rack: run the k8s cookbook with relevant alias

https://gerrit.wikimedia.org/r/1306551

Change #1306551 merged by jenkins-bot:

[operations/cookbooks@master] depool-rack: run the k8s cookbook with relevant alias

https://gerrit.wikimedia.org/r/1306551

Change #1306976 had a related patch set uploaded (by Bking; author: Bking):

[operations/puppet@production] wdqs: Add depool metadata to hieradata

https://gerrit.wikimedia.org/r/1306976

Change #1306976 merged by Bking:

[operations/puppet@production] wdqs: Add depool metadata to hieradata

https://gerrit.wikimedia.org/r/1306976

Change #1307852 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] hieradata: Mark configcluster hosts as manual depool

https://gerrit.wikimedia.org/r/1307852

Change #1308030 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add depool policy for restbase/sessionstore/cassandra_dev

https://gerrit.wikimedia.org/r/1308030

Change #1308030 merged by Ayounsi:

[operations/puppet@production] Add depool policy for restbase/sessionstore/cassandra_dev

https://gerrit.wikimedia.org/r/1308030

Change #1309030 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/cookbooks@master] depool-rack: various fix

https://gerrit.wikimedia.org/r/1309030

Change #1309030 merged by jenkins-bot:

[operations/cookbooks@master] depool-rack: various fix

https://gerrit.wikimedia.org/r/1309030

Change #1310119 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] Add profile::server_depool for centrallog and graphite

https://gerrit.wikimedia.org/r/1310119

Change #1310554 had a related patch set uploaded (by Cathal Mooney; author: Cathal Mooney):

[operations/puppet@production] pki: add profile::server_depool to document depool actions

https://gerrit.wikimedia.org/r/1310554

Change #1310554 merged by Cathal Mooney:

[operations/puppet@production] pki: add profile::server_depool to document depool actions

https://gerrit.wikimedia.org/r/1310554

Change #1310588 had a related patch set uploaded (by Cathal Mooney; author: Cathal Mooney):

[operations/puppet@production] Pometheus nodes: adjust message on server_depool key

https://gerrit.wikimedia.org/r/1310588

Change #1310973 had a related patch set uploaded (by Ayounsi; author: Ayounsi):

[operations/puppet@production] pki::multirootca: clarify depool policy

https://gerrit.wikimedia.org/r/1310973

Change #1310119 merged by Ayounsi:

[operations/puppet@production] Add profile::server_depool for centrallog and graphite

https://gerrit.wikimedia.org/r/1310119

Change #1310588 merged by Cathal Mooney:

[operations/puppet@production] Prometheus nodes: adjust message on server_depool key

https://gerrit.wikimedia.org/r/1310588

Change #1310991 had a related patch set uploaded (by Cathal Mooney; author: Cathal Mooney):

[operations/puppet@production] pki: move server_depool instructions to correct file

https://gerrit.wikimedia.org/r/1310991

Change #1310973 merged by Cathal Mooney:

[operations/puppet@production] pki::multirootca: clarify depool policy

https://gerrit.wikimedia.org/r/1310973

Change #1311502 had a related patch set uploaded (by Bking; author: Bking):

[operations/puppet@production] wcqs: Add depool metadata to hieradata

https://gerrit.wikimedia.org/r/1311502

Change #1311502 merged by Bking:

[operations/puppet@production] wcqs: Add depool metadata to hieradata

https://gerrit.wikimedia.org/r/1311502

Change #1314798 had a related patch set uploaded (by Jelto; author: Jelto):

[operations/puppet@production] Add profile::server_depool instructions for gitlab-runners

https://gerrit.wikimedia.org/r/1314798

Change #1314798 merged by Jelto:

[operations/puppet@production] Add profile::server_depool instructions for gitlab-runners

https://gerrit.wikimedia.org/r/1314798