olljanat / csi-plugins-for-docker-swarm

MIT License
46 stars 8 forks source link

Some learnings / questions while building a CSI driver #5

Open s4ke opened 1 year ago

s4ke commented 1 year ago

Leaving these here, so I can get some feedback if someone else stumbles across these:

Learnings:

  1. I can create volumes in the cluster without the plugin I refer to existing
  2. I can't delete volumes that are active calling docker volume rm
  3. I can drain a volume that is pending creation
  4. To debug plugins, nerdctl is useful to exec into the plugin container. You can list plugin containers with nerdctl ps --namespace plugins.moby
  5. To debug via logs (without filtering the docker engine log), you can change the entrypoint in the config.json to forward the logs to a file, then use nerdctl exec to exec into the container to get the logs
    "entrypoint": [
    "/bin/sh",
    "-c",
    "exec > /stdout 2> /stderr /plugin/aio.bin"
    ],
  6. All managers have to have the plugin installed (especially the leader) for CSI calls to work

Unsure if these are bugs:

  1. I can't delete a drained volume that is pending creation, I have to specify "-f"

Features that seem to be missing in the CSI support:

  1. Volume resizing (docker volume rm -f bypasses the plugin alltogether, useful for manual volume resizing - unclear if this is expected behaviour)
s4ke commented 1 year ago

@olljanat maybe moving the discussion about debug logs here, as this is useful for others as well. Did you find a way to access the plugin logs besides forwarding them to a file like I did above?

If there is no better way, I am thinking about using the mounts section of the plugin config.json to mount log files and simply append to those. This will require some log rotation logic then...

olljanat commented 1 year ago

@s4ke if you don't forward logs anywhere they appear to docker engine own log.

s4ke commented 1 year ago

Okay, this makes things easier then. I was under the impression that this didnt work this way, but this could have been a fluke due to debugging errors

neersighted commented 1 year ago

@s4ke if you don't forward logs anywhere they appear to docker engine own log.

I think I told you this in Discord as well :laughing: