- Notifications
You must be signed in to change notification settings - Fork928
feat: implement runtime configuration package with multi-org support#14470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is the look aside cache just going to be a wrapper on the resolver?
I like the interface simplicity. The only thing that I don't 100% follow is the usage of reflect. It would be good to drop comments on why it is required.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
3650ee6
to12e798f
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@Emyrk good to go 👍 |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
* chore: refactor entry into deployment and runtimeRuntimeEntry has no startup value, and omits functions requiredto be serpent compatible.Co-authored-by: Danny Kopping <danny@coder.com>---------Co-authored-by: Danny Kopping <danny@coder.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Approving to unblock.
Uh oh!
There was an error while loading.Please reload this page.
RFC.
What this does
Adds a new
runtimeconfig
package for managing all runtime related configuration. The goal of this package is to create a consistent method for CRUD on runtime configuration (as opposed to startup values).The motivation and driver is mutli-org. Multi org settings must be configured at runtime. Instead of creating ad-hoc CRUD operations to a key/val store, this package creates a single code path for all settings.
Design
The design uses a
Manager
singleton that producesResolvers
to enable a cache layer in the future. A pure singleton cannot be used as theResolver
requires adatabase.Store
, which could be atx
. So the user of the package must create theResolver
on demand with their local instance of thedb
.Usage
The design is intentionally created so that we can deprecate startup values in favor of runtime in the future. The
DeploymentEntry
type specifically uses startup values as a fallback.This will allow us to move some startup values into runtime, which has been a sticky point for configuring aspects of coder for awhile now.
Future work
Caching layer ::#14586
A follow up to this PR will be a caching layer that uses pubsub to update it's cached values. Adding a cache layer will make all settings essentially free to read, allowing use in hot paths such as
httpmw
(as we currently do for startup values).RBAC layer ::coder/internal#154
When caching is implemented,
dbauthz
will not be called for cache hits. So this layer, or some layer above, needs to be RBAC aware.Maybe in the
initialize
? theNew
? The field could know it's own RBAC properties??Remove old runtime settings in favor of this
Pretty much all these sql queries:https://github.com/coder/coder/blob/e461d2773b5a2f1bd04ff899a922032b373e187f/coderd/database/queries/siteconfig.sql
Upside is we will remove a lot of database.Store queries (always nice to trim)