Description
This proposal is intended to open a discussion about the feasibility of making Controller Plugins able to create their own secrets (generated in CreateVolume/ControllerPublishVolume
RPCs), and then passing those secrets to Node Plugins - if this is something worth pursuing or not.
There's already a way of passing non-sensitive data from the Controller Plugin to the Node Plugin via CreateVolumeResponse
's attributes
. Passing secrets in similar fashion would complement this feature.
I'll start with two use-cases, both of them are related mainly to Ceph:
-
csi-cephfs plugin is able to provision and mount new CephFS shares. As a security measure, for each provisioned share it also creates a dedicated Ceph user who can access this share only. When attaching/mounting such share to a workload, the Plugin has to provide a keyring containing the user's credentials.
It would be really nice if the Controller Plugin, once the volume is created, would be able to pass those credentials to the CO, and the CO would in turn pass those to the Node Plugin when needed.
-
csi-manila is able to provision shared FS volumes managed by OpenStack's Manila service. Each provisioned volume needs a dedicated access and the Controller Plugin may need to expose sensitive data to make accessing the volumes from the Node Plugin possible.
So far I see two ways of achieving this:
-
Amending the contents of existing "node secrets" fields
Add a new optional field
amend_node_secrets
to eitherCreateVolumeResponse
orControllerPublishVolumeResponse
. If non-empty, coalesce this field withnode_stage_secrets
andnode_publish_secrets
.Or
Add new optional fields
amend_node_stage_secrets
,amend_node_publish_secrets
to eitherCreateVolumeResponse
orControllerPublishVolumeResponse
. If non-empty, coalesce these fields withnode_stage_secrets
andnode_publish_secrets
respectively.E.g. read stage volume secrets, read the amending stage secrets, unify both into a single string-to-string map and pass the result into
node_stage_secrets
. -
Creating separate fields for plugin-supplied secrets
Add a new optional field
provision_secrets
toCreateVolumeResponse
(orControllerPublishVolumeResponse
),NodeStageVolumeRequest
andNodePublishVolumeRequest
messages. Populate those similarly to option (1), only without coalescing.Or
Add new optional fields
provision_node_stage_secrets
andprovision_node_publish_secrets
toCreateVolumeResponse
(orControllerPublishVolumeResponse
). Add those also toNodeStageVolumeRequest
andNodePublishVolumeRequest
messages respectively.
The CO is responsible for managing the life-time of the secret and possibly making sure the keys of the "amending" secret don't collide with existing keys from "node_*_secrets
" in option (1).
The life-time of the secret would span from CreateVolume/ControllerPublishVolume
till DeleteVolume/ControllerUnpublishVolume
respectively. The CO has to create the secret, track the mapping between the secret and its corresponding volume, so that it can be disposed of.
Failing to create the secret (either as a result of CO's internal error or because of conflicting keys in option (1)) would result in an error, calling DeleteVolume/ControllerUnpublishVolume
and retrying.
Failing to delete the secret should be a bit more permissive. If the secret doesn't exist, the CO should continue with DeleteVolume/ControllerUnpublishVolume
normally. Otherwise issue an error and try deleting again.
Is this something that would fit CSI?