Skip to content

feat: add server.remotesAPI and server.behavior.eventScheduler to DoltDB - #19

Closed
realnedsanders wants to merge 1 commit into
dolthub:mainfrom
realnedsanders:feat/user-remotesapi-event-scheduler
Closed

realnedsanders wants to merge 1 commit into
dolthub:mainfrom
realnedsanders:feat/user-remotesapi-event-scheduler

Conversation

@realnedsanders

@realnedsanders realnedsanders commented Oct 22, 2026 •

Copy link
Copy Markdown

Dolt's sql-server can serve its databases over its user-facing remotes
API, the top-level remotesapi section of its configuration. Clients then
clone, fetch and push with dolt clone http://<host>:<port>/<database>.
The operator renders only cluster.remotesapi, and only with replication
enabled. It also patches its ConfigMap back on every reconcile. So today an
operator-managed DoltDB cannot serve the user-facing API, even by hand.

The operator also cannot set behavior.event_scheduler, so stored events
always run (Dolt's default is ON). An application that admits only plain
data has no way to turn the scheduler off declaratively.

This PR adds two optional fields to the DoltDB spec. Nothing changes for a
DoltDB that sets neither.

  • spec.server.remotesAPI renders remotesapi.port and
    remotesapi.read_only.
    • The port defaults to 50052, apart from the replication port 50051, so
      the two can be used together.
    • The port is added as http-remotesapi to the container and to the
      primary, reader and internal Services. One port carries both the gRPC
      calls and the plain HTTP table-file transfers.
  • spec.server.behavior.eventScheduler (ON or OFF) renders
    behavior.event_scheduler. Empty keeps Dolt's default.
apiVersion: k8s.dolthub.com/v1alpha
kind: DoltDB
spec:
  server:
    behavior:
      eventScheduler: "OFF"
    remotesAPI:
      port: 50052

renders

behavior:
  auto_gc_behavior:
    enable: false
  event_scheduler: "OFF"
remotesapi:
  port: 50052

Security note for users

An unauthenticated request to Dolt's remotes API runs as root with an
empty password (remotesrv/http.go). The remotes port therefore needs
network policy that admits only trusted clients. This PR does not change
that behaviour; it only lets the operator render the API that Dolt already
has. The field's documentation could say so, if you prefer.

Testing

  • make generate manifests: the deepcopy and the three generated CRDs gain
    only the new fields.
  • Unit tests:
    • config rendering, with and without the fields (pkg/dolt);
    • container and Service ports (pkg/builder);
    • go test $(go list ./... | grep -v /internal/controller) passes.
  • The rendered configuration was started with dolt sql-server 2.4.2.
    • The remotes API listened on 50052.
    • @@global.event_scheduler read OFF.
  • On a UDS Core k3d cluster, a downstream project ran a build of v0.0.1 with
    this commit and both fields set (remotesAPI.port: 50052,
    behavior.eventScheduler: "OFF"). Its packaged browser suite cloned and
    pushed through the remotes API: clones fetched table files from it
    directly, and publications pushed to it through an authorizing proxy. The
    rendered /db/config.yaml kept both settings. No differences were observed
    (SHA-256 3b31d515…) between two reconciles of spec.env changes, each
    rolling the StatefulSet, an OOM-killed container restart and a deleted
    pod. @@global.event_scheduler read OFF after the deleted pod came
    back. Deploying the patched operator to that cluster left another,
    unchanged DoltDB alone: no roll, no restart, the same configuration.

The integration suite (make tiltci) was not run.

Dolt's sql-server can serve its databases over the user-facing remotes API
(the top-level `remotesapi` section of its configuration), so that clients
clone, fetch and push with `dolt clone http://…/db`. The operator rendered
only `cluster.remotesapi`, and only with replication enabled, and it patches
its ConfigMap back on every reconcile, so the user-facing API could not be
turned on for an operator-managed DoltDB.

`spec.server.remotesAPI` is optional. When set, the operator renders
`remotesapi.port` (default 50052, apart from the replication port 50051) and
`remotesapi.read_only`, and adds the port as `http-remotesapi` to the
container and to the primary, reader and internal Services. The one port
carries the gRPC calls and the plain HTTP table-file transfers.

`spec.server.behavior.eventScheduler` is optional, ON or OFF, and renders
`behavior.event_scheduler`. When empty, Dolt's default (ON) applies, as
before.

Nothing changes for a DoltDB that sets neither field.
@rikez
rikez requested a review from coffeegoddd October 26, 2026 20:19
@coffeegoddd

Copy link
Copy Markdown

@realnedsanders thanks so much for the contribution! There were a couple places that needed shoring up, so I went ahead and picked up your commits and made the necessary changes in this pr, which will supersede this one: #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants