Skip to content

Docker Volume Driver#69

Draft
bpbradley wants to merge 44 commits intomainfrom
docker_volume
Draft

Docker Volume Driver#69
bpbradley wants to merge 44 commits intomainfrom
docker_volume

Conversation

@bpbradley
Copy link
Owner

Adds support for use of locket as a Docker Engine Plugin, implementing a volume driver.

This means volumes can use the locket driver instead of the default local driver. It will create a tmpfs mount with secrets injected, and can be used as normal docker volumes from there.

There are a few small caveats I need to document, and some tweaks to configuration I want to do. Then need to implement the actual configurations to be installed directly by docker with docker plugin install.

This allows for secrets to be automatically mounted into Docker
containers through volume definitions.

This is a first pass, with many rough edges and little testing.
instead of just the mount path.

Also fixed? a bug where a crash / stop of locket after a mount (but
without an unmount) causes layered mounts. i.e. Mount -> Mount ->
Unmount would cause the OS to stack mounts on top of each other, and
then the files cannot be removed because unmount only unmounted one of
the mounts, leaving the mount still busy. Now, this instead will
iteratively continue to call unmount until no mounts exist anymore.
Move signal handling to the run loop, and add a Drop for the plugin to
clean up the socket.
global locks

Introduces a `watch::channel` to manage the lifecycle instead of the
`Notify` mechanism for a more state-driven approach.
The `VolumeEntry` is now wrapped in an `Arc<RwLock<...>>` to allow
concurrent access.

Adds an `is_mounted` helper function to `VolumeMount` to determine if a
path is currently a mountpoint. This is used to avoid unnecessary
mount/unmount
operations when recovering existing volumes.
handle credential staleness.

Previously, provider must be set at install time, and the provider is
built on startup. Instead, this now allows the provider config to be
stored as a default at start time, but the actual provider is built
on-demand, after being merged with volume specific overrides.

The provider args themselves are now hashable, and so a map for all
built providers is held by he volume registry. Now, everytime a
different config is loaded, a new provider is built, and that config
will in the future use the built provider, allowing it to maintain
state.

Additionally, the problem of credential stalenss is addressed here.
Previously, a long running daemon where credentials may become stale
would result in a dead provider. Now, the provider is accessed through a
ManagedProvider interface instead, which holds a copy of its
configuration, and when necessary, it can check if it has new
credentials on-disk to reload from. This will allow it to seamlessly
rebuild itself with the new credentials, and continue operating.
ReferenceParser syntax.

Now, the reference syntax parsing can be delegated to the
SecretReference variant, and then the provider config and base
implementation can easily mark their reference type to gain access to
the ReferenceParser automatically. Now, the ReferenceParser for
ManagedConfig is just delegation, just like Signature.
to extract a specific SecretReference variant for SecretProvider
parsing more generic.

Needed to update vec parser to handle single entries.
notifcation only happens on drop, data isn't checked.
Now the plugin will require a metadata file from docker bake in order to
ensure that the bake file remains the source of truth.

Update CI to publish plugin, and add support for dockerhub.
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.

1 participant