Page MenuHomePhabricator

Route testwiki traffic to the Pretrain MVP environment
Open, MediumPublic

Description

Background

Our plan of record is to use k8s Ingress to route testwiki traffic to the associated Pretrain deployments - i.e., direct traffic bound for test.wikipedia.org to the appropriate services by path-dependent use case (generic web or API, jobrunner, etc.).

While Ingress is ideal for this kind of application, and converges toward ideas explored to enable Single Version MediaWiki, we're not yet at a point where we want put Ingress in the critical path for the existing set of MW-on-k8s services (e.g., mw-web).

What that means is that we must externally divert testwiki-bound traffic to Ingress.

Traffic diversion paths

To support this, we need to support traffic diversion on a number of different request paths:

  1. Divert external testwiki traffic to Ingress at ATS.
    • Note that this is limited to cases where ATS is the last-hop toward MW-on-k8s.
    • In practical terms, that means generic web traffic and X-Wikimedia-Debug traffic (we will have a Pretain-debug), and not traffic diverted to REST Gateway.
  2. Divert external testwiki traffic to Ingress at REST Gateway.
    • In practical terms, this means writing envoy configuration to divert to a different upstream cluster based on Host. This is the focus of T433752, together with supporting other forms of traffic diversion (e.g., based on the PHP_ENGINE cookie).
  3. Divert internal testwiki traffic to Ingress.
    • In practical terms, this is mainly focused on internal API traffic and jobrunner traffic, which will again rely on Host-header diversion via the envoy service mesh (i.e., for all services where the relevant listener(s) are enabled). We expect this to cover the vast majority of internal traffic.
      • One area where that gets tricky is changeprop. Although the jobqueue deployment thereof now also applies the appropriate Host header to outbound requests (T395451), we don't actually use the service mesh on either. Unless we were to implement diversion directly in changeprop (strongly not prefered), the most straightforward approach is to imbue them with service mesh. This, for both changeprop (as a client of the MediaWiki API) and changeprop-jobqueue (as a client of the jobrunners), is the focus of T434925.
    • Another area that may need further investigation is internal API traffic from Knative workloads running in the ml-serve k8s clusters, which appear to use a completely different mechanism to proxy egress HTTP to internal services (see e.g. net_istio.mesh.service_entries). It has yet to be seen whether this must be handled in some form (e.g., whether these workloads even produce testwiki-bound requests).

Nearly all of these will require deployment in two phases: one phase introducing new features to support traffic diversion and then a second phase where we enable said diversion for testwiki. Once that work is complete, the logging functionality that will be developed in T439144 can be enabled, and we can begin learning what we may have missed.

Work tracked directly in this task primarily covers horizontal routing concerns such diversion in the service mesh, as well as executing the traffic migration using the implementations developed here and in subtasks.

Current status of worked tracked here

Current as of 2026-09-30:

  1. Divert external testwiki traffic to Ingress at ATS.
    • x-wikimedia-debug.lua routing supports diversion to mw-pretrain for testwiki traffic, when users select the k8s-mw-pretrain backends (see https://gerrit.wikimedia.org/r/1327621).
      • Add these backends to debug.json, so that they're available in the WikimediaDebug extension: https://gerrit.wikimedia.org/r/1346796.
      • Consider "aliasing" the more common k8s-mwdebug backends in x-wikimedia-debug.lua to k8s-mw-pretrain equivalents for compatibility when traffic is for testwiki. This will require two changes: (1) x-wikimedia-debug.lua will need updated to support this (for a demo, see: https://gerrit.wikimedia.org/r/1346799) and (2) mw-pretrain's ingress routing will need to become more relaxed in terms of the X-Wikimedia-Debug backends it supports. As I write this, I am not convinced that we actually want this. If we do go this route, we should only do so as traffic is migrated.
    • MIGRATE: When we're ready to start migrating traffic, we need to configure ATS to divert test.wikipedia.org traffic to mw-pretrain.
  2. Divert external testwiki traffic to Ingress at REST Gateway.
  3. Divert internal testwiki traffic to Ingress.
    • Host-based traffic splitting is now supported in Puppet (i.e., in our envoy listener definitions, as well as bare-metal envoy service mesh use cases; see, e.g., https://gerrit.wikimedia.org/r/1328247, https://gerrit.wikimedia.org/r/1328256), and the relevant deployment-charts mesh modules have been extended to match (see, e.g., https://gerrit.wikimedia.org/r/1331858).
    • We have prepared a global upgrade to all mesh-dependent charts to these new module versions, which have been split into three patches for clearer grouping (i.e., of upgraded modules). Once merged, these patches can be Charlie'd out to all affected services.
    • Once this module upgrade is complete, proceed with the work in T434925 for changeprop, and come back here when that's complete.
    • MIGRATE: When we're ready to begin internal (mesh) traffic migration:
      • For internal API traffic, merge https://gerrit.wikimedia.org/r/1328249. This will (1) enable diversion for all bare-metal use cases and (2) introduce a change to the services proxy data present in /etc/helmfile-defaults on the deployment host. Deploying the latter, thus enabling the functionality previously introduced via the new mesh modules, will require a round of Charlie'ing.
      • For jobrunner traffic, merge https://gerrit.wikimedia.org/r/1346775 and deploy changeprop-jobqueue (after running puppet on the deployment host).

Additional discussion

Why not Ingress-all-the-things? - When developing the proposal for the Pretrain MVP environment, we prioritized avoiding significant intrusive architectural changes for the existing MW-on-k8s services. However, if we were to migrate both mw-jobrunner and mw-api-int to Ingress, that would supersede all of the work in #3 (and in many ways result in a simpler-to-reason-about end state - diversion is consolidated in one place rather than being distributed in mesh configuration). One might further argue that if Single-Version MediaWiki is likely to become the future and follow the path set out last year (Ingress as PoR), then maybe this would be valuable regardless. There are many more pros and cons and practicalities than I'm detailing here, but I remain open to a change in approach here.

Details

Related Changes in Gerrit:
SubjectAuthorRepoBranchLines +/-
Scott Frenchoperations/deployment-chartsmaster+12 -0
Scott Frenchoperations/deployment-chartsmaster+3 K -61 K
Scott Frenchoperations/deployment-chartsmaster+116 -52
Scott Frenchoperations/deployment-chartsmaster+61 -46
Scott Frenchoperations/mediawiki-configmaster+4 -1
Scott Frenchoperations/puppetproduction+16 -0
Scott Frenchoperations/puppetproduction+50 -0
Scott Frenchoperations/puppetproduction+22 -0
Scott Frenchoperations/puppetproduction+6 -5
Scott Frenchoperations/puppetproduction+6 -3
Scott Frenchoperations/puppetproduction+8 -0
Scott Frenchoperations/puppetproduction+9 -0
Scott Frenchoperations/deployment-chartsmaster+65 -53
Scott Frenchoperations/deployment-chartsmaster+1 K -2
Scott Frenchoperations/deployment-chartsmaster+5 -2
Scott Frenchoperations/deployment-chartsmaster+905 -0
Scott Frenchoperations/deployment-chartsmaster+53 -1
Scott Frenchoperations/deployment-chartsmaster+5 -0
Scott Frenchoperations/deployment-chartsmaster+14 -7
Scott Frenchoperations/deployment-chartsmaster+10 -9
Scott Frenchoperations/deployment-chartsmaster+1 -1
Scott Frenchoperations/puppetproduction+29 -18
Scott Frenchoperations/puppetproduction+64 -50
Scott Frenchoperations/puppetproduction+2 -4
Scott Frenchoperations/puppetproduction+118 -27
Scott Frenchoperations/puppetproduction+27 -113
Scott Frenchoperations/puppetproduction+113 -27
Scott Frenchoperations/puppetproduction+9 -0
Scott Frenchoperations/deployment-chartsmaster+0 -3
Scott Frenchoperations/deployment-chartsmaster+38 -0
Scott Frenchoperations/deployment-chartsmaster+14 -12
Scott Frenchoperations/deployment-chartsmaster+35 -13
Scott Frenchoperations/deployment-chartsmaster+197 -0
Scott Frenchoperations/deployment-chartsmaster+3 -0
Scott Frenchoperations/dnsmaster+3 -0
Show related patches Customize query in gerrit

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Scott_French moved this task from Inbox to Scheduled (this Q) on the ServiceOps board.

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

[operations/puppet@production] trafficserver: Support testwiki pretrain routing in XWD

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

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

[operations/deployment-charts@master] mesh.configuration: Copy 1.15.3 to 1.15.4

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

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

[operations/deployment-charts@master] mesh.configuration: Add support for split host_regex in 1.15.4

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

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

[operations/puppet@production] envoy: Add support for host_regex listener split

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

A couple of updates before I'm out for the week:

  1. Divert external testwiki traffic to Ingress at ATS.

As expected, this looks largely straightforward. I've started sketching out how this might be reflected in X-Wikimedia-Debug routing (draft change attached). For other routed-at-ATS traffic (i.e., not diverted via REST Gateway), we should simply be able to insert a test.wikipedia.org special case in the mapping rules immediately before the mw-web.discovery.wmnet catch-all.

  1. Divert external testwiki traffic to Ingress at REST Gateway

This is an interesting one. I've experimented a bit with approaches that use an envoy envoy.filters.http.header_to_metadata filter to apply a dynamic metadata key that triggers Pretrain routing via cluster backend subset selection (i.e., similar to what we do for the PHP_ENGINE cookie, but here matching on the :authority-pseudo header; see the config template in the api-gateway chart).

While workable, this approach is still awkward, owing to the limited set of operations for header-value extraction / conversion when populating metadata keys.

A potentially cleaner alternative may be to to adopt the cluster-specifier plugin, which allows us to perform upstream cluster selection in a short snippet of Lua code on a per-RouteAction basis (rather than specifying a "fixed" cluster that then performs backend subset selection). We don't have any prior art that I'm aware of for using this, but it could (IMO) result in a far simpler config to reason about (vs. the somewhat tricky semantics of subset selection). I'll investigate this further when I return.

  1. Divert internal testwiki traffic to Ingress.

For the cases that either do or will use our standard service mesh, I believe it should be relatively straightforward to adapt something like our existing support for percentage-based listener splits (draft changes attached). For cases like ml-serve, I do not have a concrete answer yet, but hope to soon after I return.

NOTE: While experimenting with this, I noticed that sni_rewrites_host_header cannot vary independently from that of the "main" upstream of the listener in a split, at least as we model it in puppet, which we'll need to fix. See https://gerrit.wikimedia.org/r/c/operations/puppet/+/1134217 history.

As noted in the task description, and soon to become a reality in T427668: Turn up the Pretrain MVP environment, we plan to use Istio Ingress for the upstream portion of routing of test.wikipedia.org traffic toward distinct, use-case-specific services within the mw-pretrain namespace.

One interesting implication of that approach is that we can easily lose precision around the provenance of a request by the time we're making those routing decisions - including, e.g, which service(s) should be eligible to serve it.

Is that a problem?

That's pretty abstract, so let's make it more concrete:

For external user requests coming from ATS or (soon) REST Gateway, we'll be able to inspect the value of the X-Wikimedia-Debug header in the HTTPRoute(s) in the mw-pretrain VirtualService, and shunt to either a general-purpose service (main) or the debug one. Here, it doesn't really matter where the request is coming from at this point in the flow - i.e., it's totally fine that external users can arbitrarily control this decision, as today with mw-debug and friends.

This gets tricky for routing decisions where we care about provenance. For example, we don't want external users to be able to hit /rpc/RunSingleJob.php with an arbitrary payload, but we also want to use Ingress to route (internal) requests to the mw-pretrain jobrunner service. Stated differently, simply being able to send a request to mw-pretrain.discovery.wmnet - as ATS will dutifully do (eventually) on your behalf if you access test.wikipedia.org externally - should not grant the authority to call /rpc/RunSingleJob.php.

What can we do about that?

There are a lot of ways we could try to solve this, some more awkward than others. For example, we probably want to avoid introducing path allow lists at the edge, which can be brittle and subject to canonicalization issues.

At a high level, one (relatively) simple option is the following, again using jobrunner as a representative example:

  1. Introduce the mw-pretrain-jobrunner.discovery.wmnet CNAME, identical to mw-pretrain.discovery.wmnet.
  2. Include mw-pretrain-jobrunner in the SAN list of the TLS certificate associated with mw-pretrain's Gateway resource, as well as in the hosts list in the (sole) Gateway servers entry.
  3. Configure the mw-pretrain VirtualService to serve mw-pretrain-jobrunner, where we configure the HTTPRoute to (exact) match on the /rpc/RunSingleJob.php path and ...
    1. match specifically on mw-pretrain-jobrunner Host header
    2. (optional) apply an HTTPRewrite to replace the Host header with test.wikipedia.org.
  4. Use mw-pretrain-jobrunner as the upstream cluster in the soon-to-appear service mesh sidecar alongside changeprop.

The reason 3.B is optional is that the jobrunner entrypoint doesn't actually care what the Host header is, since it extracts the database name from the payload. Another reason to skip that step is that it loses meaning if / when additional wikis move to Pretrain.

This gives us what is "logically" a different front door to mw-pretrain, which communicates something about provenance (i.e., one that would only ever be open to internal requests), without having to introduce hard isolation of some form (e.g., dedicated NodePort).

But that still loses information, right? Can we do better?

An important downside to note is that this is a step away from the direction proposed for Single Version routing via Ingress, which makes the "true" Host header (e.g., test.wikipedia.org) uniformly load-bearing for service selection. The above makes routing (for at least this use case) oblivious to the "true" Host header, since in practice we don't actually need it, and that information is lost. See T395451: Make the JobQueue compatible with the MediaWiki Single version HTTP routing system for background on how we ended up with a Host header in jobrunner traffic at all.

One potential alternative to / variation on the above that doesn't lose the "true" Host header is a variation on what we learned in T427668#12026417 about how mw-wikifunctions can be made to serve wikidata traffic. In effect, we could probably:

  1. Create a second Gateway resource that will match for clients that negotiate TLS for mw-pretrain-jobrunner.discovery.wmnet via SNI. Notably, unlike the "main" Gateway associated with mw-pretrain, test.wikipedia.org appears nowhere in that list.
  2. Configure the service mesh (at changeprop) to use that name for SNI upstream while leaving the Host header intact (this is very similar to how the mw-wikifunctions mesh listener is configured).
  3. Attach a single VirtualService to that Gateway that is only capable of serving jobrunner traffic.

That should achieve the same result, while simply passing the Host header through. Further, if this works, it's actually a generic pattern for handling internal requests, and even though jobrunner traffic would the first use case, perhaps we should simply call it mw-pretrain-internal.


In any case, I'm going to think on this a bit more, but I believe we have enough options at our disposal that this should not introduce any major blockers to the high level plan we have in mind.

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

[operations/deployment-charts@master] ingress: Copy istio 1.2.0 to 1.3.0

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

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

[operations/deployment-charts@master] ingress: Introduce istio 1.3.0

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

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

[operations/deployment-charts@master] mediawiki: Bump ingress.istio from 1.2.0 to 1.3.0

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

... snip ...

But that still loses information, right? Can we do better?

An important downside to note is that this is a step away from the direction proposed for Single Version routing via Ingress, which makes the "true" Host header (e.g., test.wikipedia.org) uniformly load-bearing for service selection. The above makes routing (for at least this use case) oblivious to the "true" Host header, since in practice we don't actually need it, and that information is lost. See T395451: Make the JobQueue compatible with the MediaWiki Single version HTTP routing system for background on how we ended up with a Host header in jobrunner traffic at all.

One potential alternative to / variation on the above that doesn't lose the "true" Host header is a variation on what we learned in T427668#12026417 about how mw-wikifunctions can be made to serve wikidata traffic. In effect, we could probably:

  1. Create a second Gateway resource that will match for clients that negotiate TLS for mw-pretrain-jobrunner.discovery.wmnet via SNI. Notably, unlike the "main" Gateway associated with mw-pretrain, test.wikipedia.org appears nowhere in that list.
  2. Configure the service mesh (at changeprop) to use that name for SNI upstream while leaving the Host header intact (this is very similar to how the mw-wikifunctions mesh listener is configured).
  3. Attach a single VirtualService to that Gateway that is only capable of serving jobrunner traffic.

After further reading of the Istio documentation and a bit of reverse engineering of how Istio resources are translated to envoy configuration, I believe this will work - i.e., it should provide a mechanism for introducing a dedicated "front door" (i.e., Gateway resource) for jobrunner traffic, isolated from "normal" traffic-serving use cases.

To achieve this, we will need to:

  1. Introduce mw-pretrain-jobrunner.discovery.wmnet as a CNAME to k8s-ingress-wikikube-rw.discovery.wmnet.
  2. Extend the mw-pretrain's tlsExtraSans to include the above.
  3. Support direct control over the VirtualService hosts list, independent of the Gateway servers hosts list. See https://gerrit.wikimedia.org/r/c/operations/deployment-charts/+/1324343 and related patches.
  4. Configure mw-pretrain's jobrunner release with:
    • ingress.gatewayHosts.extraFQDNs: [mw-pretrain-jobrunner.discovery.wmnet] and ingress.gatewayHosts.disableDefaultHosts: true
    • ingress.routeHosts: [test.wikipedia.org, mw-pretrain-jobrunner.discovery.wmnet] (we could perhaps elide the latter, but let's not for now)
    • a minimal HTTPRoute that targets only the two supported endpoints (health-check.php and RunSingleJob.php).

So, how are we going to deal with changeprop?

Phase 1: Enable the mesh

Although unused, the changeprop chart already supports the envoy service mesh, with fairly recent versions of mesh.deployment and mesh.configuration already vendored - it's just not used.

In this first phase, we'll (incrementally) enable the envoy container and adopt the local listener(s) as the target exec.uri for rules that execute via MediaWiki (mw-api-int and mw-jobrunner, for changeprop and changeprop-jobqueue, respectively). Additional targets we can / should support in changeprop (not relevant to -jobqueue), though perhaps at a later stage, include mobileapps, eventgate, and inference.

One curious point of note: It seems changeprop exposes its HTTP server by way of a k8s Service with a NodePort configured (see Service ports). While one could ostensibly use this to interact with the configured handlers, I'm straining to think of a valid / supported use case for doing so, and can't seem to find this documented anywhere.

The reason this is relevant is that if we want to continue to offer this, then for consistency / completeness we should use the mesh for inbound TLS termination, but that transition becomes rather painful in the presence of a NodePort - i.e., for "reasons" this involves moving the NodePort to a different Service (backed by envoy), which is not possible to do cleanly. The simplest option is if we stop exposing this, setting mesh.enabled: true without also setting a mesh.public_port (i.e., explicitly nulling it out).

I'll try to get clarity on this this week.

Note that, to support this, we'll need to tune request timeouts on the mw-jobrunner mesh listener originally added for T360625 (i.e., this should be a bit more that 1202.5s, which is the timeout we set upstream).

Phase 2: Diversion

This phase will have a lot in common with how we're handling diversion more generally for mesh-ful internal services (e.g., for any service that hits the MediaWiki API), potentially using something that rhymes with https://gerrit.wikimedia.org/r/1305514.

That will require:

  • Introducing appropriately configured (i.e., for an Ingress-backed service) listeners for mw-pretrain (API) and mw-pretrain-jobrunner. That includes setting sni_rewrites_host_header to ensure we retain test.wikipedia.org in the Host header - see, e.g., what we do for mw-wikifunctions. As noted in T427666#12052297, this may not be fully supported if we go the split-listener route (i.e., may need additional tweaks to config rendering).
  • When we're ready to actually start traffic diversion [0], enabling those listeners, together with diversion for testwiki traffic specifically, on both changeprop services.

[0] There are a couple of interlocking concerns here. The most important one is that, at the time we migrate, there will be no functional difference between Pretrain and "normal" MediaWiki services (i.e., same container images).

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

[operations/deployment-charts@master] admin_ng: Add mw-pretrain-jobrunner to mw-pretrain tlsExtraSANs

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

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

[operations/dns@master] wmnet: Add mw-pretrain-jobrunner k8s Ingress CNAMEs

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

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

[operations/deployment-charts@master] mw-pretrain: Introduce dedicated Ingress Gateway for jobrunner

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

Change #1324776 merged by Scott French:

[operations/dns@master] wmnet: Add mw-pretrain-jobrunner k8s Ingress CNAMEs

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

Change #1324775 merged by jenkins-bot:

[operations/deployment-charts@master] admin_ng: Add mw-pretrain-jobrunner to mw-pretrain tlsExtraSANs

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

Change #1324342 merged by jenkins-bot:

[operations/deployment-charts@master] ingress: Copy istio 1.2.0 to 1.3.0

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

Change #1324343 merged by jenkins-bot:

[operations/deployment-charts@master] ingress: Introduce istio 1.3.0

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

Change #1324344 merged by jenkins-bot:

[operations/deployment-charts@master] mediawiki: Bump ingress.istio from 1.2.0 to 1.3.0

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

Mentioned in SAL (#wikimedia-operations) [2026-08-13T17:09:11Z] <swfrench@deploy1003> Started scap sync-world: Helmfile-only deployment for mediawiki chart bump - T427666

Mentioned in SAL (#wikimedia-operations) [2026-08-13T17:12:14Z] <swfrench@deploy1003> Finished scap sync-world: Helmfile-only deployment for mediawiki chart bump - T427666 (duration: 03m 03s)

Change #1324780 merged by jenkins-bot:

[operations/deployment-charts@master] mw-pretrain: Introduce dedicated Ingress Gateway for jobrunner

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

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

[operations/deployment-charts@master] mw-pretrain: Inherit VirtualService route hosts from Gateway hosts

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

Change #1325538 merged by jenkins-bot:

[operations/deployment-charts@master] mw-pretrain: Inherit VirtualService route hosts from Gateway hosts

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

Turns out the trick proposed in T427666#12204243 does not work. As noted in https://gerrit.wikimedia.org/r/1325538, it seems there's an additional filtering step during istio envoy config generation, where the intersection of the VirtualService hosts list and the Gateway server hosts is taken, and only that set is included in the attached routes. When that intersection is the empty set, it simply attaches routes with a single vhost that 404s everything (and istiod kindly emits warnings: constructed http route config for route https.443.https.mediawiki-jobrunner.mw-pretrain on port 443 with no vhosts; Setting up a default 404 vhost). As usual, dumping the live config was quite useful in understanding what's happening.

So, I've gone the route (ha) of falling back to inheriting the exact Gateway host list relevant to that cluster, which is what https://gerrit.wikimedia.org/r/1325538 does.

And indeed that works as expected:

swfrench@deploy1003:~$ curl -v https://mw-pretrain-jobrunner.discovery.wmnet:30443/w/health-check.php                                                                                                                                          
[ ... snip ... ]
> GET /w/health-check.php HTTP/2
> Host: mw-pretrain-jobrunner.discovery.wmnet:30443
> user-agent: curl/7.88.1
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200 
< date: Thu, 13 Aug 2026 17:56:21 GMT
< server: mw-pretrain.eqiad.jobrunner-6c897d9974-dkf6p
< x-powered-by: PHP/8.3.33
< backend-timing: D=3974 t=1786643781052349
< content-type: text/html; charset=UTF-8
< x-envoy-upstream-service-time: 11
< 
PHP interpreter running
CPU count: 48
Request weight: 10
* Connection #0 to host mw-pretrain-jobrunner.discovery.wmnet left intact
swfrench@deploy1003:~$ cat testjob.json                                                                                     
{
  "$schema": "/mediawiki/job/1.0.0",
  "meta": {
    "id": "353b28fa-8a27-11f1-868a-60452e486c64",
    "domain": "test.wikipedia.org",
    "stream": "mediawiki.job.null",
    "dt": "2026-08-11T00:00:00.000Z"
  },
  "database": "testwiki",
  "type": "null",
  "params": {}
}
swfrench@deploy1003:~$ curl -v https://mw-pretrain-jobrunner.discovery.wmnet:30443/rpc/RunSingleJob.php --json @testjob.json
[ ... snip ... ]
> POST /rpc/RunSingleJob.php HTTP/2
> Host: mw-pretrain-jobrunner.discovery.wmnet:30443
> user-agent: curl/7.88.1
> content-type: application/json
> accept: application/json
> content-length: 276
> 
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200 
< date: Thu, 13 Aug 2026 17:56:58 GMT
< server: mw-pretrain.eqiad.jobrunner-6c897d9974-dkf6p
< x-powered-by: PHP/8.3.33
< x-content-type-options: nosniff
< cache-control: no-cache
< traceparent: 00-c7ab19506f230fd073f73a2395daa6a4-7d592e9f8c74c0a5-01
< x-request-id: 71b2ddda-2767-4f73-88cc-e2ede9219e30
< backend-timing: D=356585 t=1786643818465223
< content-length: 0
< content-type: text/html; charset=UTF-8
< x-envoy-upstream-service-time: 361
< 
* Connection #0 to host mw-pretrain-jobrunner.discovery.wmnet left intact
swfrench@deploy1003:~$

What this means is that we actually will want the default sni_rewrites_host_header: true behavior when configuring diversion at changeprop-jobrunner, at the expense of not really making using of the Host header sent following the work in T395451, and continuing to rely on the in-band database attribute.

So, does it actually make sense to stay in this configuration?

I think the answer is yes, even though we don't get to play tricks with the Host header, because it rules out a wide range of "whoops" that could happen and inadvertently expose the RunSingleJob.php endpoint to external traffic. I'll give it some more thought, though.

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

[operations/puppet@production] Profile::Service_listener: Add sni_rewrites_host_header to 'split'

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

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

[operations/puppet@production] P:services_proxy::envoy: Fix split set_sni behavior

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

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

[operations/puppet@production] P:services_proxy::envoy: Add support for split host_regex

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

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

[operations/puppet@production] P:kubernetes::deployment_server::global_config: Pass split host_regex

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

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

[operations/deployment-charts@master] mesh.configuration: Fix split listener stream idle timeout in 1.15.4

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

Change #1305519 abandoned by Scott French:

[operations/puppet@production] envoy: Add support for host_regex listener split

Reason:

Abandoned in favor of I7af2e5793fafd3852164e4042f19429e6a6a6964

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

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

[operations/puppet@production] hieradata: Divert testwiki traffic to mw-pretrain at ATS

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

Mentioned in SAL (#wikimedia-operations) [2026-08-20T16:51:54Z] <swfrench-wmf> disable-puppet on A:cp for ATS Lua change - T427666

Change #1304189 merged by Scott French:

[operations/puppet@production] trafficserver: Support testwiki pretrain routing in XWD

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

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

[operations/puppet@production] Revert "trafficserver: Support testwiki pretrain routing in XWD"

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

Change #1327592 merged by Scott French:

[operations/puppet@production] Revert "trafficserver: Support testwiki pretrain routing in XWD"

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

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

[operations/puppet@production] trafficserver: Support testwiki pretrain routing in XWD

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

Mentioned in SAL (#wikimedia-operations) [2026-08-24T17:42:29Z] <swfrench-wmf> disable-puppet on A:cp for ATS Lua change - T427666

Change #1327621 merged by Scott French:

[operations/puppet@production] trafficserver: Support testwiki pretrain routing in XWD

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

Mentioned in SAL (#wikimedia-operations) [2026-08-24T17:55:31Z] <swfrench-wmf> start rolling run-puppet-agent on A:cp after validation on cp4041 - T427666

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

[operations/puppet@production] P:services_proxy::envoy: Drop support for split and introduce splits

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

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

[operations/puppet@production] P:kubernetes::deployment_server::global_config: Update services_proxy

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

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

[operations/puppet@production] P:services_proxy::envoy: Fix sni_rewrites_host_header handling

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

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

[operations/deployment-charts@master] modules: Prepare mesh.configuration / networkpolicy minor version bump

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

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

[operations/deployment-charts@master] Rakefile: Fix 'upstream' mock in services_proxy data

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

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

[operations/deployment-charts@master] mesh: Support Host splits in configuration 1.16.0, networkpolicy 1.3.0

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

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

[operations/deployment-charts@master] Rakefile: Simply and update 'upstream' mock data population

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

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

[operations/deployment-charts@master] Rakefile: Update mock services_proxy data for splits

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

Change #1330689 merged by Scott French:

[operations/puppet@production] P:services_proxy::envoy: Fix sni_rewrites_host_header handling

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

Change #1328247 merged by Scott French:

[operations/puppet@production] P:services_proxy::envoy: Drop support for split and introduce splits

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

Change #1328256 merged by Scott French:

[operations/puppet@production] P:kubernetes::deployment_server::global_config: Update services_proxy

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

Change #1331857 merged by jenkins-bot:

[operations/deployment-charts@master] Rakefile: Fix 'upstream' mock in services_proxy data

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

Change #1331872 merged by jenkins-bot:

[operations/deployment-charts@master] Rakefile: Simplify and update 'upstream' mock data population

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

Change #1328274 merged by jenkins-bot:

[operations/deployment-charts@master] Rakefile: Update mock services_proxy data for splits

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

Change #1325996 abandoned by Scott French:

[operations/deployment-charts@master] mesh.configuration: Fix split listener stream idle timeout in 1.15.4

Reason:

Abandoned in favor of Iadcb65dd5a8d7d77b954aeef04e5f21c6a6a6964

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

Change #1305514 abandoned by Scott French:

[operations/deployment-charts@master] mesh.configuration: Add support for split host_regex in 1.15.4

Reason:

Abandoned in favor of Iadcb65dd5a8d7d77b954aeef04e5f21c6a6a6964

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

Change #1305513 abandoned by Scott French:

[operations/deployment-charts@master] mesh.configuration: Copy 1.15.3 to 1.15.4

Reason:

Abandoned in favor of Iadcb65dd5a8d7d77b954aeef04e5f21c6a6a6964

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

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

[operations/deployment-charts@master] api-gateway: Allow auto_host_rewrite to be overridden

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

Change #1328738 merged by jenkins-bot:

[operations/deployment-charts@master] modules: Prepare mesh.configuration / networkpolicy minor version bump

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

Change #1331858 merged by jenkins-bot:

[operations/deployment-charts@master] mesh: Support Host splits in configuration 1.16.0, networkpolicy 1.3.0

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

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

[operations/deployment-charts@master] mediawiki: Update mesh modules and dependents

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

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

[operations/deployment-charts@master] Update mesh.{configuration,networkpolicy} and dependents in all charts

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

Change #1325992 abandoned by Scott French:

[operations/puppet@production] P:kubernetes::deployment_server::global_config: Extend services_proxy

Reason:

Opted for I697019bcae instead.

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

Change #1325989 abandoned by Scott French:

[operations/puppet@production] P:services_proxy::envoy: Add support for split host_regex

Reason:

Opted for I697019bcae instead.

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

Change #1325988 abandoned by Scott French:

[operations/puppet@production] P:services_proxy::envoy: Fix split set_sni behavior

Reason:

Opted for I697019bcae instead.

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

Change #1325987 abandoned by Scott French:

[operations/puppet@production] Profile::Service_listener: Add sni_rewrites_host_header to 'split'

Reason:

Opted for I697019bcae instead.

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

With https://gerrit.wikimedia.org/r/1331858 merged at the end of last week, the next step here is proceed with https://gerrit.wikimedia.org/r/1338000 and https://gerrit.wikimedia.org/r/1338030 to update all charts to the new module versions and then charlie out the changes. These were split simply due to the different sets of relevant modules.

That should put is in a position where k8s clients using the service mesh support Host-based diversion to Pretrain. Configuring diversion will look like https://gerrit.wikimedia.org/r/1328249, albeit touching a wider ranger of listeners. Applying that change would then be another round of charlie'ing.

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

[operations/puppet@production] hieradata: Divert testwiki traffic to mw-pretrain for mw-api-int

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

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

[operations/puppet@production] hieradata: Divert testwiki traffic to mw-pretrain for mw-jobrunner

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

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

[operations/mediawiki-config@master] debug.json: Add k8s-mw-pretrain debug backends

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

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

[operations/deployment-charts@master] changeprop: Update mesh modules and dependents

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

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

[operations/deployment-charts@master] rest-gateway: Enable diversion of testwiki traffic to mw-pretrain

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