Description
Background:
Issue #170
You can specify a provisioner-secret-name
and provisioner-secret-namespace
as a parameter in the StorageClass
. Every volume provisioned using that StorageClass
uses that secret. There was a desire to be able to specify a different secret for every volume generated.
To enable this @liggitt introduced templating so that secret references could be different per volume (see pull #69 and see documentation).
The problem is that for provisioner-secret-name
and provisioner-secret-namespace
the only supported template variable is ${pv.name}
. They do not support PVC.
Problem:
This is problematic because pv.name
is generated during volume provisioning, it is hard to predict what the generated PV name will be, so it is hard to provision a secret named pv.name
before the volume is provisioned.
Effectively it means that provisioner-secret-name
and provisioner-secret-namespace
don't really support templating and have to be hard coded so provisioning secrets effectively can not be different per volume.
Proposal:
Support the template variable ${pvc.namespace}
, ${pvc.name}
, and ${pvc.annotations['<ANNOTATION_KEY>']}
for both the provisioner-secret-name
and provisioner-secret-namespace
secret values. This would enable a different secret per provisioned volume.
The counter argument to this proposal per @liggitt:
The reason the secrets in the pvc namespace are not made available for paired create/delete operations is that the PVC and its namespace may not exist at deletion time
My suggestion:
Unless there is a security issue, relax the limitation and adopt the proposal so that storage systems (like Portworx) where secrets are not needed for volume delete can do this. And add documentation to discourage storage systems that require secret on delete from doing this.