Page MenuHomePhabricator

Proposal: scap deploy-service
Open, In Progress, HighPublicFeature

Description

During the WE5-WE6 offsite, we (@jijiki, @dancy, @brennen, and @jeena) discussed the idea of extending scap's functionality to support deploying Kubernetes services.

What?

We explored how scap could be extended to enable the deployment of Kubernetes services, allowing for a unified deployment experience across our infrastructure.

Why?

This work would improve developer confidence in deployments by providing a consistent, reliable process. More importantly, it would allow every deployer and SRE to deploy any service without needing to know all the service specifics beforehand, reducing friction and enabling faster, more confident deployments across the org.

Current Status

We only deploy MediaWiki via scap/spiderpig. One of scap’s key features is error-rate monitoring: metrics are checked during deployment to ensure error rates stay within safe thresholds, and the deploy can be automatically paused or rolled back if errors spike. This significantly increases deployer confidence, since the vast majority of production errors are caught before the change is rolled out everywhere.

When deploying other services, deployers have to run helmfile manually. Unless pods fail to start, sanity checks are performed by deployers manually either through smoke tests and/or checking bespoke dashboards.It gets even trickier when SREs need to redeploy all services in a Kubernetes cluster due to, for example, image upgrades such as Envoy.

How?

The integration of scap with MW-on-K8s has established many of the foundational components required for this initiative. Existing capabilities such as running helmfile, updating image versions, rolling out to canaries, and monitoring error rates are already in place.

Scap Specific work

TBA: more detailed input from Release-Engineering-Team

What would developer teams need to provide?

To onboard a service to scap deploy-service, development teams must provide the following:

  • Logstash expressions that clearly exhibit error rates
  • Smoke tests
  • Grafana dashboards that clearly demonstrate service health
  • Links to related dashboards

What will the deployer's UX be?

We are aiming for a streamlined deployment process (high level):

  • Run scap service-deploy <service-name> (from any directory)
  • Automatically roll out to canaries, if available, otherwise to a single datacenter
  • Automatically monitor and validate error rates
  • Execute helmfile post-upgrade hooks (various options here, TBD)
  • Complete the rollout upon successful validation
  • Print additional information, eg a grafana dashboard

Note: Given that MediaWiki interacts with most WikiKube services, we could consider adding an optional/mandatory check of mediawiki's error rate too.

🕷️ Weaving the Pig 🐷

The longer-term goal would be to enable one-push deployments via Spiderpig, allowing teams to trigger deployments with minimal manual intervention. This would substantially lower the bar to deployment, enabling even less experienced team members to confidently ship services to production.

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
deploy-service: Accept only a list of environments and releasesrepos/releng/scap!1360dancymaster-I715c15962bfec42e1e7f9b803041ffe1d01d8946master
deploy-service: Accept a list of environments and releasesrepos/releng/scap!1354dancymaster-I05ff26293ec988991d3868222beac1409503f694master
deploy-service: Announce each group of the planrepos/releng/scap!1340dancymaster-Ie62dbe3187732d770e6b7e7fece166a52e32ed47master
spiderpig: Update notifications to handle multiple jobsrepos/releng/scap!1321dancymaster-I10ebdeb703c298ddc45b0c22472a911896554fb3master
spiderpig: Add support for retrying a service deploymentrepos/releng/scap!1320dancymaster-I25e2c7e95bae83a9ccecdb9c7402ccae22141a6emaster
jobrunner: Run jobs in separate queues concurrentlyrepos/releng/scap!1319dancymaster-I44edb33ffe3dae8858c9f64de189f05cc48ba6d4master
spiderpig: Deploy a servicerepos/releng/scap!1312dancymaster-I99cad5582318fe8036778da3e5f2557c2997a53emaster
spiderpig: Show the output that an interaction prompt asks aboutrepos/releng/scap!1311dancymaster-I8b52fc78e205ed587c0146b31b66e3e584843880master
deploy-service: Add load_catalog()repos/releng/scap!1310dancymaster-I6e748227c9a6db322770091660b1261d0247f7a0master
spiderpig: Give each job a queuerepos/releng/scap!1308dancymaster-I877c79f9caf525b488f9703d697fa5078ded9e6cmaster
deploy-service: Reduce rollback prompt verbosityrepos/releng/scap!1302dancymaster-Id3982665aec3f394bedc0aaae3abc4803abf8f08master
deploy-service: Name the group of the plan from the planrepos/releng/scap!1301dancymaster-Id397a4a7ca62621d67e45be9250da434b93dda06master
deploy-service: Add manual check supportrepos/releng/scap!1300dancymaster-Ib861e8ff4a59baeb9f0275d7577736e4f4c7a5a3master
deploy-service: Run the check commands of the service catalogrepos/releng/scap!1297dancymaster-If33e4c6de36b81588441cb148748ca9677814d45master
deploy-service: Run the check commands of the service catalogrepos/releng/scap!1296dancymaster-I1ad24d1f8d3c1f3121675a0495bafbcb9005057fmaster
deploy: Add config files for scap deploy-servicerepos/releng/train-dev!195dancymain-Ideaf84db81e6f183e00b4cbf78552337ae06b52dmain
cli.py: Add prompt_for_message()repos/releng/scap!1284dancymaster-I32f8dcff56721118aa61cc188e414b7bfe2c06d2master
tests: Do not describe helm as holding a releaserepos/releng/scap!1275dancymaster-I0183ca3ceb6bc5741a8f8fa5870427d6dec67161master
deploy-service: Run helmfile commands, add --confirm-diffsrepos/releng/scap!1273dancymaster-Ie2aeb7d72cff0710ccb79de7e474641432432980master
Show related patches Customize query in GitLab

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change #1319890 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/deployment-charts@master] services/shellbox: Add traindev environment

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

dancy changed the task status from Open to In Progress.Jul 31 2026, 10:23 PM
dancy claimed this task.
dancy raised the priority of this task from Medium to High.

Change #1319890 merged by jenkins-bot:

[operations/deployment-charts@master] services/shellbox: Add traindev environment

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

dancy merged https://gitlab.wikimedia.org/repos/releng/scap/-/merge_requests/1271

kubernetes.py: Roll back to the revision from before the deployment

dancy opened https://gitlab.wikimedia.org/repos/releng/scap/-/merge_requests/1311

spiderpig: Show the output that an interaction prompt asks about

dancy merged https://gitlab.wikimedia.org/repos/releng/scap/-/merge_requests/1311

spiderpig: Show the output that an interaction prompt asks about

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

[operations/puppet@production] O:deployment_server::kubernetes: Bootstrap 'scap deploy-service' config

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

Change #1338068 merged by Scott French:

[operations/puppet@production] O:deployment_server::kubernetes: Bootstrap 'scap deploy-service' config

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

Sample dry run output:

(scap-venv) dancy@deploy1003:~/src/scap$ bin/run-dev-scap deploy-service shellbox --dry-run
20:59:26 Deploying shellbox using cluster group wikikube (primary datacenter: eqiad)
20:59:26 [STAGING/DEFAULT] staging-eqiad, 6 at once:
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox && helmfile -e staging apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-constraints && helmfile -e staging apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-media && helmfile -e staging apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-syntaxhighlight && helmfile -e staging apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-timeline && helmfile -e staging apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-video && helmfile -e staging apply --context 5)
20:59:26     manual: Please verify staging shellbox services before proceeding.
20:59:26 [PRODUCTION/DEFAULT] codfw, 6 at once:
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox && helmfile -e codfw apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-constraints && helmfile -e codfw apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-media && helmfile -e codfw apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-syntaxhighlight && helmfile -e codfw apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-timeline && helmfile -e codfw apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-video && helmfile -e codfw apply --context 5)
20:59:26     manual: Please monitor and verify production shellbox services (https://grafana.wikimedia.org/d/RKogW1m7z/shellbox).
20:59:26 [PRODUCTION/DEFAULT] eqiad, 6 at once:
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox && helmfile -e eqiad apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-constraints && helmfile -e eqiad apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-media && helmfile -e eqiad apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-syntaxhighlight && helmfile -e eqiad apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-timeline && helmfile -e eqiad apply --context 5)
20:59:26     (cd /srv/deployment-charts/helmfile.d/services/shellbox-video && helmfile -e eqiad apply --context 5)
20:59:26     manual: Please monitor and verify production shellbox services (https://grafana.wikimedia.org/d/RKogW1m7z/shellbox).

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

[operations/puppet@production] hieradata: Tweak supervision messages on shellbox deploy-service config

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

Thanks for all of your work here, @dancy! As expected, the test deployment of shellbox yesterday went smoothly.

The only question I have is whether we want to set SUPPRESS_SAL in the environment from which helmfile is run, similar to what we do with MediaWiki deployments. While those SAL logs are usable, they're simultaneously rather verbose for services like shellbox (i.e., those which span multiple namespaces, released in parallel) and lossy (e.g., they don't identify the actor - you just see spiderpig).

Instead, I'm wondering if we might want to log a message for each DeploymentGroup (which may span multiple namespaces / releases), along with the service name and actor. That would still be quite clear for the common case of a single-namespace service, while avoiding the verbosity of helmfile_log_sal'ing everything.

As with MediaWiki deployments, the authoritative record of individual helmfile operations would still be present in logstash (example).

Change #1347761 merged by Scott French:

[operations/puppet@production] hieradata: Tweak supervision messages on shellbox deploy-service config

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add miscweb

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

Change #1352048 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add miscweb

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add aux-k8s

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

Change #1352555 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add aux-k8s

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add miscweb-aux

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

Change #1353973 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add miscweb-aux

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

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

[operations/deployment-charts@master] miscweb: update annualreport image to newest version

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

Change #1354767 merged by jenkins-bot:

[operations/deployment-charts@master] miscweb: update annualreport image to newest version

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add dse-k8s

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

Change #1354899 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/puppet@production] deployment_server::deploy_service::service_catalog: Document the format

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

Change #1354899 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: Document the format

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

Change #1354819 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add dse-k8s

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add airflow

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

Change #1355501 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add airflow

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add CANARY stage to dse-k8s

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

Change #1355531 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: add CANARY stage to dse-k8s

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

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

[operations/puppet@production] deployment_server::deploy_service::service_catalog: fix indentation in airflow spec

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

Change #1355542 merged by Jelto:

[operations/puppet@production] deployment_server::deploy_service::service_catalog: fix indentation

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