r/devops7 • u/Alternative_Pin9598 • 4h ago
One script, one chore: rotating the orders-db password. grep finds 3 deployments; one graph walk finds 9 that must restart and 9 more to warn, with owners (real output)
Short one this week: one script, one chore, real output. (This sub is run by the SynapCores team.)
The chore
The orders-db password gets rotated tonight. Before anyone types the new value: which services must restart to pick it up, and who else sees errors while they do? Today the answer is a grep over the manifests:
$ grep -l orders-db-password manifests/*.yaml
manifests/inventory-sync.yaml
manifests/orders-api.yaml
manifests/orders-worker.yamlThree deployments name the secret. Six more get it without naming it: two mount orders-env, a shared env template that includes it; two mount batch-env, which includes orders-env; payments-gateway comes from a chart that bundles it; fraud-scorer reads the vault alias kv/db/orders. Nothing a grep can follow, so those six keep the old password and page you at 2 a.m.
The payoff: one walk, one join
secretwalk.py load turns the manifests, includes.csv and deps.csv into a graph and owners.csv (team, Slack channel, tier) into a SQL table, same SynapCores database. The SynapCores step: one Cypher walk from the secret, 1 to 6 hops over the three ways a secret travels, however many bundles sit in between:
MATCH p = (s:d11_Secret {name: 'orders-db-password'})-[:INCLUDED_IN|MOUNTED_BY|READ_BY*1..6]->(v:d11_Service)
RETURN v.name AS service, length(p) AS hops, [n IN nodes(p) | n.name] AS viaThe script keeps the shortest path per service, saves it into d11_restart, and one join adds the owners:
SELECT o.tier, r.service, o.team, o.channel, r.via
FROM d11_restart r JOIN d11_owners o ON o.service = r.service
ORDER BY o.tier, r.hops, r.service
orders-db-password is named in 3 manifests (what grep finds): inventory-sync, orders-api, orders-worker
tier service team channel how it gets the secret
1 orders-api orders #orders-oncall by name
1 orders-worker orders #orders-oncall by name
1 payments-gateway payments #payments-oncall payments-chart
1 refund-service payments #payments-oncall orders-env
2 inventory-sync inventory #inventory by name
2 fraud-scorer risk #risk-oncall kv/db/orders
2 order-search-indexer search #search orders-env
2 invoice-export finance-eng #finance-eng orders-env > batch-env
3 nightly-report data-platform #data-oncall orders-env > batch-envTwo lines grep cannot give you: invoice-export gets the secret two includes away (orders-env > batch-env), and fraud-scorer's manifest never contains the string orders-db-password, only the alias.
Who to warn
Same graph, second walk: everything that calls one of those nine, directly or through other services. They do not restart, they see errors while their dependency does, so their channel gets a heads-up (same join, against d11_warn):
MATCH (s:d11_Secret {name: 'orders-db-password'})-[:INCLUDED_IN|MOUNTED_BY|READ_BY*1..6]->(r:d11_Service)
MATCH p = (w:d11_Service)-[:DEPENDS_ON*1..6]->(r)
RETURN w.name AS service, r.name AS restarts, [n IN nodes(p) | n.name] AS via
tier service team channel calls
1 checkout-web web #web-oncall orders-api
1 mobile-bff mobile #mobile orders-api, payments-gateway
...
3 support-console support-eng #support-eng refund-service
restart 9 (grep found 3), warn 9; tell 13 channels: #orders-oncall, #payments-oncall, #inventory, #risk-oncall, #search, #finance-eng, #data-oncall, #web-oncall, #mobile, #partners, #logistics, #growth, #support-engRan on SynapCores 2.5.1 on a Mac mini (Apple M4); 2.3.2 gave the same output. Script, sample files and run commands are in the first two comments. SynapCores is free to download: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-one-script-11
How do you answer "where is this secret used" today: a grep like the one above, a label on each deployment, the vault's own lease list, or whoever rotated it last time?