14 Commits
Author SHA1 Message Date
Guillaume LoursandPaweł Gronowski fccc7acfcf daemon: Add the jobs extension as an optional builtin
Add the builtin org.mobyproject.jobs.v0 extension, serving the Jobs API
on the daemon socket.
It is experimental and disabled by default; enable it with
extensions.enable (--extension-enable).

Run containers are driven through an Engine API client from the daemon
API point, and their exits observed through the container state point,
so restart-policy attempts do not count as exits.
Jobs persist through the storage point, and unnamed jobs are named
through the name-generator point.
Removing a run container also removes its anonymous volumes.

The extension host initializes before the daemon serves its API, so
activation reconciles runs and starts the scheduler in the background,
and the Jobs API answers Unavailable until then.
Shutdown releases blocked calls such as Wait, and waits for activation
and in-flight calls only until its deadline.
Authorization plugins are not supported yet, as the README states.

Integration tests cover a manual run, reconciliation after a killed
daemon, and the disabled extension.
A README next to the contract describes how to use it.

Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-11-06 01:43:32 +01:00
Guillaume LoursandPaweł Gronowski 1577cea701 extpoints/jobs: Add jobs extension point contract
Define the org.mobyproject.extension.jobs.api.v0 extension point: a
single-cardinality Jobs service with unary RPCs for registration,
execution, inspection, lifecycle, run history and wait.

The container definition travels as a container-create JSON body.
A trigger declaring no known kind is rejected, so a spec using a newer
trigger kind fails on an older daemon instead of registering as a
manual job.
Run logs are not proxied; consumers read the run container's logs.
Run history outlives its job by default, and a run container lives as
long as its run record.

Generated wire code is produced by mobyextgen (go generate
./extpoints/...) and committed.

Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-11-06 01:43:30 +01:00
Paweł Gronowski be285dcad8 daemon: Create the extension API socket on first use
Every daemon with an extension host opened an extra full-access API
socket at startup, even when no extension used the API.

The socket is now created when an extension first connects to the API.
The daemonapi client looks up the endpoint on its first connection, so
NewClient no longer takes a context.

The socket is served separately from the configured hosts, returns 503
until the daemon is ready, and closes after extensions shut down.
It is accessible only to the daemon user, or to Administrators and
LocalSystem on Windows.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-11-04 19:48:07 +01:00
Paweł Gronowski fca6d1f16d extpoints: Let extensions use a regular Engine API client
Extensions had no supported way to call the Engine API.
The configured hosts may be socket-activated or TLS-only TCP.

Add the org.mobyproject.extension.daemon.api.v0 point.
It returns the address of a private unix socket where the daemon serves
its regular API handler.

daemonapiv0.NewClient helper resolves the point and returns a
*client.Client.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-11-04 19:47:55 +01:00
Paweł Gronowski 1f4db24e32 Merge pull request #53947 from vvoland/ext-containerstate
Initial ContainerState extension point
2026-11-02 17:52:22 +01:00
Paweł Gronowski dda2877a6c Add an extension point for watching container state
Jobs extensions need to know when a container finishes so they can
record the outcome of a run.

Add org.mobyproject.extension.container.state.v0.
Its Wait call returns once the container reaches a requested status,
and Watch streams every status change until the container is removed.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-28 15:56:21 +01:00
Paweł Gronowski 88c9d21f4a daemon: Move name-generator provider resolution out of extpoints
The extpoints packages define the extension contract.
Provider selection, timeouts, name validation, and the built-in
fallback are daemon policy, and the daemon is the only caller.

The fallback helper is can be moved to github.com/moby/extensions once
another point needs it.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-10-26 21:35:07 +01:00
Paweł Gronowski 19ea93670c daemon/internal/extensionstorage/bbolt: Allow concurrent reads
Storage reads queued behind every transaction, including unrelated
writes.
Use RWMutex instead.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-30 21:23:01 +02:00
Paweł Gronowski 424316f5e9 extpoints/storage/kv: Add a versioned key-value storage contract
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-30 20:03:06 +02:00
Paweł Gronowski 0c71b3f8ce daemon/extensions: Expose bootstrap configuration to extensions
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-30 20:02:39 +02:00
Sebastiaan van Stijn 162f87a940 extpoints: use t.Context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-09-18 18:28:44 +02:00
Paweł Gronowski 90484e1ec5 extpoints: Remove unused mobyextgen service directives
mobyextgen infers each ordinary point's service interface from the
generic type argument to DefinePoint or DefineSinglePoint.

These comments were leftovers from the initial version which I forgot to
remove.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-04 13:45:02 +02:00
Paweł Gronowski f8b81d9066 daemon: Refactor namegenerator into extension
Add a single-provider namesgenerator point with the existing random
generator as its built-in implementation.

Installed extensions can now supply container and Swarm service names,
while failures fall back to the built-in generator so create operations
remain available.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-09-03 11:06:16 +02:00
Paweł Gronowski ad1af3b58c daemon/command: Route extension gRPC requests
Publish extension `service.grpc` services on the API socket while
retaining daemon services and rejecting name collisions. Route
matching gRPC requests through the extension proxy.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-08-26 22:33:40 +02:00