Skip to content

Conversation

@nikhilbarge
Copy link
Contributor

@nikhilbarge nikhilbarge commented Dec 9, 2025

What this PR does / why we need it:
Update Periodic sync to calculate reserved for vmsnapshot storagepolicyusage
Periodic sync calculate the reserved values across storage policies and updates the storagequota reserved value.
This VMSnapshot StoragePolicyUsage instroduced with vmsnashot feature in 9.1.

Similar to other SPUs like pvc, vm, volume snapshot we need to update periodic sync to include calculation of vmsnapshot reserved values.
This change was missed earlier as assumption was vm and vmsnapshot will use same extension service, but vmsnapshot have different extension service name than virtualmachine only in SPU CR so we need to handle it seperately.

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:
Pre-checkins Pipelines Passed:
https://jenkins-vcf-csifvt.devops.broadcom.net/job/vks-instapp-e2e-pre-checkin/669/
https://jenkins-vcf-csifvt.devops.broadcom.net/job/wcp-instapp-e2e-pre-checkin/726/
https://jenkins-vcf-csifvt.devops.broadcom.net/job/wcp-instapp-e2e-pre-checkin/731/

Manual Testing

root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get pvc -n test-ns
NAME           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                VOLUMEATTRIBUTESCLASS   AGE
sample-claim   Bound    pvc-1f5c9f9c-10c4-4a43-98d3-27286454640c   5Gi        RWO            wcpglobal-storage-profile   <unset>                 34m
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get vm -n test-ns     sample-vm 
NAME        POWER-STATE   AGE
sample-vm   PoweredOn     33m
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get vmsnapshot -n test-ns     
NAME                   AGE
sample-vm-1-snapshot   31m
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get StorageQuotaPeriodicSync -n vmware-system-csi   storage-quota-periodic-sync  
NAME                          AGE
storage-quota-periodic-sync   20h
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get vmsnapshot -n test-ns      -o yaml
apiVersion: v1
items:
- apiVersion: vmoperator.vmware.com/v1alpha5
  kind: VirtualMachineSnapshot
  metadata:
    annotations:
      csi.vsphere.volume.sync: completed
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"vmoperator.vmware.com/v1alpha5","kind":"VirtualMachineSnapshot","metadata":{"annotations":{},"name":"sample-vm-1-snapshot","namespace":"test-ns"},"spec":{"memory":false,"vmName":"sample-vm"}}
    creationTimestamp: "2025-12-10T17:34:04Z"
    finalizers:
    - vmoperator.vmware.com/virtualmachinesnapshot
    - cns.vmware.com/syncvolume
    generation: 1
    labels:
      snapshot.vmoperator.vmware.com/vm-name: sample-vm
    name: sample-vm-1-snapshot
    namespace: test-ns
    ownerReferences:
    - apiVersion: vmoperator.vmware.com/v1alpha5
      kind: VirtualMachine
      name: sample-vm
      uid: 9bfde6fc-f093-43aa-83d5-521ac6e3495b
    resourceVersion: "739968"
    uid: bee56806-d712-4274-bd19-8a7971a6764c
  spec:
    vmName: sample-vm
  status:
    conditions:
    - lastTransitionTime: "2025-12-10T17:34:06Z"
      message: ""
      reason: "True"
      status: "True"
      type: VirtualMachineSnapshotCSISynced
    - lastTransitionTime: "2025-12-10T17:34:06Z"
      message: ""
      reason: "True"
      status: "True"
      type: VirtualMachineSnapshotCreated
    - lastTransitionTime: "2025-12-10T17:34:06Z"
      message: ""
      reason: "True"
      status: "True"
      type: VirtualMachineSnapshotReady
    powerState: PoweredOff
    storage:
      requested:
      - storageClass: wcpglobal-storage-profile
        total: 25Gi
      used: "8783160871"
    uniqueID: snapshot-266
kind: List
metadata:
  resourceVersion: ""
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# k get StorageQuotaPeriodicSync -n vmware-system-csi   storage-quota-periodic-sync   -o yaml
apiVersion: cns.vmware.com/v1alpha1
kind: StorageQuotaPeriodicSync
metadata:
  creationTimestamp: "2025-12-09T21:56:08Z"
  generation: 1
  name: storage-quota-periodic-sync
  namespace: vmware-system-csi
  resourceVersion: "757585"
  uid: 2f9caba7-dded-4389-ac68-3b37c30d6da5
spec:
  syncIntervalInMinutes: 10
status:
  expectedReservedValues:
  - namespace: svc-cci-ns-1ghah
    reserved:
      4d5f673c-536f-11e6-beb8-9e71128cae77: "0"
      61fa0b2a-a4be-4cfd-b704-1164aaa611f1: "0"
  - namespace: svc-example-ljuh4
    reserved:
      4d5f673c-536f-11e6-beb8-9e71128cae77: "0"
      61fa0b2a-a4be-4cfd-b704-1164aaa611f1: "0"
      579e1c15-3bf6-40b0-b387-f5f68c76d6ee: "0"
      cb66f23a-59d8-4b44-83aa-5da6085b101a: "0"
      fcbe7c8e-f669-41b6-8078-08e05675deea: "0"
  - namespace: svc-tkg-9svi8
    reserved:
      4d5f673c-536f-11e6-beb8-9e71128cae77: "0"
      61fa0b2a-a4be-4cfd-b704-1164aaa611f1: "0"
  - namespace: svc-velero-qh79y
    reserved:
      4d5f673c-536f-11e6-beb8-9e71128cae77: "0"
      61fa0b2a-a4be-4cfd-b704-1164aaa611f1: "0"
  - namespace: test-mobility-relocate-ns
    reserved:
      579e1c15-3bf6-40b0-b387-f5f68c76d6ee: "0"
  - namespace: test-ns
    reserved:
      61fa0b2a-a4be-4cfd-b704-1164aaa611f1: "0"
      fcbe7c8e-f669-41b6-8078-08e05675deea: "0"
  - namespace: storage-policy-test
    reserved:
      fcbe7c8e-f669-41b6-8078-08e05675deea: "0"
  lastSyncTimestamp: "2025-12-10T18:02:26Z"
root@4212231af159a62604cbf47a66ea1de1 [ ~ ]# 

manual_test_periodic_sync.log
syncer.log

Special notes for your reviewer:

Release note:

Update Periodic sync to calculate reserved for vmsnapshot storagepolicyusage

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 9, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @nikhilbarge. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 9, 2025
@deepakkinni
Copy link
Collaborator

SUCCESS --- Jenkins Build #726

@deepakkinni
Copy link
Collaborator

SUCCESS --- Jenkins Build #669

@nikhilbarge nikhilbarge force-pushed the periodicsync_calculate_vmsnapshot_reserved branch from a1cc915 to c8b6f2c Compare December 9, 2025 19:58
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 9, 2025
@deepakkinni
Copy link
Collaborator

Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete
Jenkins Build #731

@vdkotkar
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 11, 2025
@vdkotkar
Copy link
Contributor

/approve

@nikhilbarge nikhilbarge force-pushed the periodicsync_calculate_vmsnapshot_reserved branch from c8b6f2c to d141abb Compare December 11, 2025 10:30
@deepakkinni
Copy link
Collaborator

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 11, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepakkinni, nikhilbarge, vdkotkar

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 11, 2025
@k8s-ci-robot k8s-ci-robot merged commit 7da4c99 into kubernetes-sigs:master Dec 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants