Move environment manager state to a database and queue work for data planes - #4902
Open
bhagyasakalanka wants to merge 1 commit into
Open
Move environment manager state to a database and queue work for data planes#4902bhagyasakalanka wants to merge 1 commit into
bhagyasakalanka wants to merge 1 commit into
Conversation
bhagyasakalanka
requested review from
DonOmalVindula,
brionmario,
darshanasbg,
jeradrutnam and
rajithacharith
as code owners
August 12, 2026 16:02
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bhagyasakalanka
force-pushed
the
envmgr-database
branch
4 times, most recently
from
August 14, 2026 16:25
3230f1b to
cb907ee
Compare
3 tasks
…planes Environments and their captured versions moved from files under a data directory to an environmentdb datasource, so every Control Plane replica reads and writes the same state and no plane needs durable storage. ENVIRONMENT_VARIABLE moves there from configdb. A Control Plane pod can only speak to the data planes that dialed it, so an apply or a credential arriving at a pod holding no connection failed. Every such request is now written to that database first and delivered by whichever pod holds the connection, with the caller given an id to read the answer back from any pod. The pod that accepts the request delivers it immediately when it holds the connection, so the common case answers in the same response. A credential waiting to be delivered is encrypted with the server's configuration key. Reading which credentials a data plane holds no longer needs a connection either: the names it reports are recorded and answer that read, which also covers the check an apply makes before it runs. The console derives the environment manager URL from the server URL and gates promotion on the Control Plane, shows an apply that is queued rather than reporting success before the data plane has taken it, and no longer asks a generic OIDC issuer for a ThunderID user profile. Provisioning is now schema loading alone: the system tenant owns no resources, so the scripts that seeded it are gone.
bhagyasakalanka
force-pushed
the
envmgr-database
branch
from
August 14, 2026 16:52
cb907ee to
19e7457
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
All of the Control Plane work, as one commit.
Environment manager state moves to
environmentdbEnvironments and their captured versions were JSON files under
environment_manager.data_dir, so each Control Plane replica kept its own copy: capture on one pod, promote on another, and the second compares against a history it never saw. They are rows now, which removes the PersistentVolumeClaim.ENVIRONMENT_VARIABLEmoves across from configdb.DEPLOYMENT_IDis the organization, not one of its environments: promotion compares one environment against another, so an organization's whole chain stays in one partition.Work for a data plane is queued rather than requiring a live connection
A pod can only speak to the data planes that dialed it, so an apply or a credential arriving at a pod with no connection failed. Every such request is written to
DATA_PLANE_JOBfirst and delivered by whichever pod holds the connection; the caller gets an id and reads the answer from any pod.The pod that accepts the request delivers it immediately when it holds the connection, so the common case answers in the same response and nothing feels asynchronous. Ordering is preserved (oldest pending per data plane, one in flight). The claim is
UPDATE … WHERE STATUS='pending', so racing pods settle withoutSKIP LOCKEDand it still works on SQLite. A queued credential is encrypted with the server's configuration key.Applyis the only funnel to a data plane, so promote, revert and apply-all inherit this. Marking an environment applied moved to delivery time: it can no longer claim to hold a version the data plane has not taken.Reading which credentials a data plane holds no longer needs a connection either. The names it reports are recorded on the environment and answer that read, which also covers the check an apply makes before it runs.
Console
Derives the environment manager URL from the server URL and gates promotion on
plane === 'cp', replacingenv_manager.public_url. Shows an apply that is queued, with a control to check again, rather than reporting success before the data plane has taken it. No longer asks a generic OIDC issuer for a ThunderID user profile:/users/meis a ThunderID endpoint, and whoever signs in exists at the issuer rather than in this deployment.Provisioning
Schema loading alone. The system tenant owns no resources, nothing seeds from it, and tenants created through
/system/tenantsprovision themselves from the image's bundle, so the scripts that seeded it are gone.Testing
Verified against two Control Plane pods behind an nginx load balancer, a Data Plane behind another, and PostgreSQL:
claimed_bymatched its hostname) while the other left it alone, and the payload arrived on the data plane.failedwith the data plane's own error rather than lost or retried forever.make test_unit: 0 failures. Consoletsc -band tests clean. No lint issues in any new file.Not covered
The console's queued-apply notice is built and typechecked but has not been driven through a browser session.
Note
internal/system/i18n/core/defaults.gois regenerated here. It was already stale onfeature/cp-dp(secretservicerenamed tosecretstorewithout regenerating), which mademake lintfail before reaching the linter. Unrelated, swept up to unblock the gate.Checklist