Skip to content

Conversation

vdkotkar
Copy link
Contributor

@vdkotkar vdkotkar commented Sep 30, 2025

What this PR does / why we need it:
This PR takes care of following things:

  1. Adds file share export paths to volume context attributes in response once volume provisioning for file volume is successful. Later CSI provisioner reads these attributes and adds file share export paths as annotation on the PVC.
  2. Adds full sync code to check if file share export paths are available on PVC annotations, if not add them in full sync code. This is useful for cases where file volumes are created before upgrade to the VC 9.1.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Testing done:

Create a file PVC with these changes and verified that file share export paths are added as PVC annotations.

# k apply -f pvc.yaml -n svc-tkg-v59n1
persistentvolumeclaim/example-file-pvc created


# k get pvc -A
NAMESPACE       NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                  VOLUMEATTRIBUTESCLASS   AGE
svc-tkg-v59n1   example-file-pvc   Bound    pvc-fb559df1-f848-4e94-88d5-cb6d53d74efc   1Gi        RWX            vsan-default-storage-policy   <unset>                 17s


# k get pvc example-file-pvc  -n svc-tkg-v59n1 -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    csi.vsphere.exportpath.nfs3: host10.cibgst.com:/52f2c68a-6d2c-4f39-f2e8-93529a690863.                <<<<<
    csi.vsphere.exportpath.nfs41: host10.cibgst.com:/vsanfs/52f2c68a-6d2c-4f39-f2e8-93529a690863.   <<<<<
    csi.vsphere.volume-accessible-topology: '[{"topology.kubernetes.io/zone":"az1"}]'
...
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: vsan-default-storage-policy
  volumeMode: Filesystem
  volumeName: pvc-fb559df1-f848-4e94-88d5-cb6d53d74efc
status:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  phase: Bound

CSI controller logs:

{"level":"info","time":"2025-10-03T11:46:26.301484137Z","caller":"wcp/controller.go:1536","msg":"Access point details for volume pvc-fb559df1-f848-4e94-88d5-cb6d53d74efc are map[NFSv3:host10.cibgst.com:/52f2c68a-6d2c-4f39-f2e8-93529a690863 NFSv4.1:host10.cibgst.com:/vsanfs/52f2c68a-6d2c-4f39-f2e8-93529a690863]","TraceId":"2ad86870-5013-4549-86b6-1294c85af57e"}

CSI provisioner logs:

I1003 11:46:26.303865       1 controller.go:974] create volume rep: {CapacityBytes:1073741824 VolumeId:file:90a5e387-d1d1-40f0-9237-f38e51c8ade6 VolumeContext:map[csi.vsphere.exportpath.nfs3:host10.cibgst.com:/52f2c68a-6d2c-4f39-f2e8-93529a690863 csi.vsphere.exportpath.nfs41:host10.cibgst.com:/vsanfs/52f2c68a-6d2c-4f39-f2e8-93529a690863 type:vSphere CNS File Volume] ContentSource:<nil> AccessibleTopology:[segments:<key:"topology.kubernetes.io/zone" value:"az1" > ] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}
I1003 11:46:26.304288       1 controller.go:1083] successfully created PV pvc-fb559df1-f848-4e94-88d5-cb6d53d74efc for PVC example-file-pvc and csi volume name file:90a5e387-d1d1-40f0-9237-f38e51c8ade6
I1003 11:46:26.304404       1 controller.go:1171] Setting file share export paths as annotation on pvc: "example-file-pvc", namespace: "svc-tkg-v59n1"

To test fullsync changes, manually edited PVC to remove file share export path annotations from PVC and verified that fullsync added back those annotations.
Syncer logs:

{"level":"info","time":"2025-10-03T12:26:12.83378061Z","caller":"syncer/fullsync.go:661","msg":"setFileShareAnnotationsOnPVC: Setting file share annotation for pvc: \"example-file-pvc-2\", namespace: \"svc-tkg-v59n1\"","TraceId":"6cef2eff-ed1f-4671-87c4-9ba615b381ee"}
{"level":"info","time":"2025-10-03T12:26:13.180160851Z","caller":"syncer/fullsync.go:694","msg":"setFileShareAnnotationsOnPVC: Access point details for volume example-file-pvc-2 are map[NFSv3:host11.cibgst.com:/52ab0bf9-4c7d-7f89-1113-e3653295d095 NFSv4.1:host10.cibgst.com:/vsanfs/52ab0bf9-4c7d-7f89-1113-e3653295d095]","TraceId":"6cef2eff-ed1f-4671-87c4-9ba615b381ee"}
{"level":"info","time":"2025-10-03T12:26:13.258312896Z","caller":"syncer/fullsync.go:704","msg":"setFileShareAnnotationsOnPVC: Added file share export paths annotation successfully on PVC \"example-file-pvc-2\", namespce \"svc-tkg-v59n1\"","TraceId":"6cef2eff-ed1f-4671-87c4-9ba615b381ee"}

Special notes for your reviewer:

Release note:

Add file share export paths to volume attributes so that CSI provisioner can add them as PVC annotations

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 30, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vdkotkar
Once this PR has been reviewed and has the lgtm label, please assign deepakkinni for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 30, 2025
@vdkotkar vdkotkar force-pushed the publish_file_share_paths_pvc branch 3 times, most recently from d509325 to 8fbd987 Compare October 3, 2025 13:07
@vdkotkar vdkotkar changed the title [WIP] Add file share export paths to volume attributes so that CSI provisioner can add them as PVC annotations Add file share export paths to volume attributes so that CSI provisioner can add them as PVC annotations Oct 3, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 3, 2025
@vdkotkar vdkotkar force-pushed the publish_file_share_paths_pvc branch from 8fbd987 to 98a961b Compare October 7, 2025 09:33
@divyenpatel
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 7, 2025
@vdkotkar vdkotkar force-pushed the publish_file_share_paths_pvc branch from 98a961b to a9edeaf Compare October 8, 2025 10:05
@vdkotkar vdkotkar force-pushed the publish_file_share_paths_pvc branch from a9edeaf to fe6c644 Compare October 8, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants