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>
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>
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>
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>
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>
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>
Storage reads queued behind every transaction, including unrelated
writes.
Use RWMutex instead.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
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>
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>
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>