I want to create a directory with the pod name, not the PV name, in the SMB directory when doing dynamic provisioning.
rubyon opened this issue · 1 comments
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: smb-csi provisioner: smb.csi.k8s.io parameters: source: "//192.168.10.110/EVDang-DATABASE" csi.storage.k8s.io/node-stage-secret-name: "evdang-smb-secret" csi.storage.k8s.io/node-stage-secret-namespace: "sample-service" csi.storage.k8s.io/provisioner-secret-name: "evdang-smb-secret" csi.storage.k8s.io/provisioner-secret-namespace: "sample-service" reclaimPolicy: Retain volumeBindingMode: WaitForFirstConsumer
`apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nginx
spec:
serviceName: "nginx"
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
volumeMounts:
- name: smb-vol
mountPath: /mnt/smb
volumeClaimTemplates:
- metadata:
name: smb-vol
spec:
accessModes: ["ReadWriteMany"]
storageClassName: "smb-csi"
resources:
requests:
storage: 1Gi`
Currently, when using the setup mentioned above, the SMB directory is created with the PV name (e.g., pvc-xxxxxxxxxxxxxxxx) by default. What I want is for the directory to be created with the pod name (e.g., nginx-01).
Is that possible?
unfortunately that's not supported by the external-provisioner sidecar container, the supported subDir naming is as following:
- if subDir value contains following string, it would be converted into corresponding pv/pvc name or namespace
${pvc.metadata.name}
${pvc.metadata.namespace}
${pv.metadata.name}
https://github.com/kubernetes-csi/csi-driver-smb/blob/master/docs/driver-parameters.md#tips