Repository navigation
feat: add control-plane connection management for processor - #7126
Conversation
… replica management 🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7126 +/- ##
==========================================
- Coverage 80.00% 79.73% -0.27%
==========================================
Files 587 589 +2
Lines 65615 65680 +65
==========================================
- Hits 52498 52373 -125
- Misses 10026 10243 +217
+ Partials 3091 3064 -27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // multi-workspace deployment, so the first one carrying the flag is enough. | ||
| func (c *Connector) apply(configData map[string]backendconfig.ConfigT) { | ||
| for _, wConfig := range configData { | ||
| flags := wConfig.ConnectionFlags |
There was a problem hiding this comment.
Not sure if CP is setting these flags today. for MT type deployments(which is the case for all our deployments), connections are made
for warehouse MT type deployments, this flag is set.
can we double check?
There was a problem hiding this comment.
we might have to add processor too here
There was a problem hiding this comment.
The CP router is setting this flag whenever the CP router's HTTP API is called from the config backend.
There was a problem hiding this comment.
that might be needed for open source data planes. but for transformation testing, we can proactively initiate a connection like we do for warehouse if it's a namespace deployment. So the ask is to add rudderstack-processor too, like warehouse is explicitly added
There was a problem hiding this comment.
I think for the warehouse we are doing this so that connections can be initiated whenever the warehouse master is restarted. CP router also closes the unused connections after some TTL. I don't think our flow is this much critical to initiate connection on every processor restart.
There was a problem hiding this comment.
yeah, shouldn't be hard to add a metric for wait time for a connection
There was a problem hiding this comment.
@fracasula good point, will add the metrics in the grpc server which we will be implementing in the next pr.
There was a problem hiding this comment.
All I asked is to just add
rudderstack-processorto the flags, like howwarehouseis done :D
Mihir, aren't we going to add this?
There was a problem hiding this comment.
I missed pushing the changes. I thought I already pushed 😅
| AuthInfo: controlplane.AuthInfo{ | ||
| Service: ServiceName, | ||
| ConnectionToken: connectionToken, | ||
| InstanceID: conf.GetStringVar("1", "INSTANCE_ID"), |
There was a problem hiding this comment.
Aren't we supposed to connect from node-0 only? I'm asking because I saw that isNode0 does this:
func isNode0() bool {
return misc.GetInstanceID() == "0"
}So "0" != "1".
There was a problem hiding this comment.
We will only be connecting from node 0. InstanceId is set for all the processor pods via operator; we will not be picking the default value. But I got your point will use misc.InstanceID() here.
| if !ok { | ||
| return nil | ||
| } | ||
| if configData, ok := data.Data.(map[string]backendconfig.ConfigT); ok { |
There was a problem hiding this comment.
shouldn't be will remove the check
| // Run subscribes to backend config and keeps the cp-router connection in sync | ||
| // with the workspace connection flags until ctx is cancelled, at which point it | ||
| // closes the connection. It blocks, so run it in the app errgroup. | ||
| func (c *Connector) Run(ctx context.Context) error { |
There was a problem hiding this comment.
The tests cover ShouldConnect, service registration, and an end-to-end Forward. But the actual subscribe→decode→apply→stop loop in Run, including the data.Data.(map[string]backendconfig.ConfigT) type assertion all the way till close-on-shutdown, has no direct coverage.
| } | ||
| for _, tc := range cases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| t.Setenv("INSTANCE_ID", tc.instanceID) |
There was a problem hiding this comment.
Aren't we able to use the config just below this line for this? In connection.go you're doing:
InstanceID: conf.GetStringVar("1", "INSTANCE_ID"),There was a problem hiding this comment.
no in misc.GetInstanceID() we are using global config
…ction 🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🤖 I have created a release *beep* *boop* --- ## [1.80.0-rc.1](v1.79.0...v1.80.0-rc.1) (2026-07-06) ### Features * add control-plane connection management for processor ([#7126](#7126)) ([ea6ca00](ea6ca00)) * carry integration version on DestinationT to the transformer ([#7125](#7125)) ([421c613](421c613)) * implement Forward RPC for control-plane requests to workspace pyt transformers ([#7143](#7143)) ([8a704cf](8a704cf)) * implement Kubernetes deployment scaler for workspace replica management ([#7123](#7123)) ([84fc747](84fc747)) * monthly active records (MAR) metering pipeline ([#7119](#7119)) ([d1df486](d1df486)) ### Bug Fixes * **router:** transformer returning response with empty metadata array causes server to panic ([#7144](#7144)) ([d6a4dbc](d6a4dbc)) ### Miscellaneous * enable compression for google pubsub ([#7137](#7137)) ([11c9ab8](11c9ab8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.80.0](v1.79.0...v1.80.0) (2026-07-06) ### Features * add control-plane connection management for processor ([#7126](#7126)) ([ea6ca00](ea6ca00)) * carry integration version on DestinationT to the transformer ([#7125](#7125)) ([421c613](421c613)) * implement Forward RPC for control-plane requests to workspace pyt transformers ([#7143](#7143)) ([8a704cf](8a704cf)) * implement Kubernetes deployment scaler for workspace replica management ([#7123](#7123)) ([84fc747](84fc747)) * monthly active records (MAR) metering pipeline ([#7119](#7119)) ([d1df486](d1df486)) ### Bug Fixes * **router:** transformer returning response with empty metadata array causes server to panic ([#7144](#7144)) ([d6a4dbc](d6a4dbc)) ### Miscellaneous * enable compression for google pubsub ([#7137](#7137)) ([11c9ab8](11c9ab8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Description
Opens the processor's dataplane-initiated gRPC connection to cp-router, reusing the shared
controlplane.ConnectionManager(the same mechanism rudder-sources and warehouse use). This makes the processor reachable from cp-router so that, test-flow requests can be forwarded to the per-workspacerudder-pytransformer.Only the node-0 pod opens the connection, so cp-router holds a single inbound connection per dataplane (not one per replica) and node-0 becomes the sole owner of any privileged work served over it.
The whole bootstrap is gated behind a config flag and defaults off — this PR is inert until enabled.
The
ForwardRPC itself is intentionally left unimplemented in this PR (a follow-up PR adds op-routing + the HTTP forward to pyt). Until then cp-router receivescodes.Unimplemented.What's in here
proto/processor/processor.proto(+ generated.pb.go/_grpc.pb.go): a genericProcessorServicewith a single RPC —Forward(op, workspace_id, payload) → (status_code, body). The op is anopaque string and payload/body are JSON bytes, so cp-router stays transformation-agnostic and never grows per-op code. Generated with the repo's pinned plugin versions (
protoc-gen-gov1.33.0,protoc-gen-go-grpcv1.3.0).processor/cpservice/cpservice.go—Service, theProcessorServicegRPC handler. EmbedsUnimplementedProcessorServiceServerso it registers and serves safely whileForwardis pending.processor/cpservice/connection.go—Connector, which wrapscontrolplane.ConnectionManager, registers the handler on the dataplane-side gRPC server, and drives the connection from the workspaceconnection flags published by the control plane (the warehouse pattern).
ShouldConnect= feature-enabled && node-0.app/apphandlers/{processor,embedded}AppHandler.go— gated bootstrap wired into both modes that run the processor pipeline. GATEWAY mode is intentionally excluded (no processor pipeline; the LLDkeeps this off the horizontally-scaled gateway).
Node-0 detection
Reuses
misc.GetInstanceID()— the same instance-ID ordinal signalapp/cluster/stateuses. It returns the trailing ordinal ofINSTANCE_ID("0","1", …); an unsetINSTANCE_IDyields"", so local runs never connect.Config
Processor.cpRouterConnection.enabledfalseProcessor.cpRouterConnection.retryInterval0(→ 1s)CP_ROUTER_USE_TLS(reused)trueINSTANCE_ID(reused)AuthInfo.InstanceIDLinear Ticket
pipe-3143
Security