Skip to content

Commit

Permalink
Add RBAC and sync interval for storageQuotaPeriodicSync in cns-csi.ya…
Browse files Browse the repository at this point in the history
…ml (#3086)
  • Loading branch information
akankshapanse authored Oct 22, 2024
1 parent dda4a02 commit 1402690
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions manifests/supervisorcluster/1.28/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ rules:
- apiGroups: ["cns.vmware.com"]
resources: ["storagepolicyusages/status"]
verbs: ["update", "patch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagequotaperiodicsyncs"]
verbs: ["create", "get", "list", "patch", "delete" ,"watch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagequotaperiodicsyncs/status"]
verbs: ["update", "patch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagepolicyquotas"]
verbs: ["get", "list", "watch"]
Expand Down Expand Up @@ -377,6 +383,7 @@ spec:
- "--leader-election-lease-duration=120s"
- "--leader-election-renew-deadline=60s"
- "--leader-election-retry-period=30s"
- "--storagequota-sync-interval=10m"
env:
- name: CLUSTER_FLAVOR
value: "WORKLOAD"
Expand Down
7 changes: 7 additions & 0 deletions manifests/supervisorcluster/1.29/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ rules:
- apiGroups: ["cns.vmware.com"]
resources: ["storagepolicyusages/status"]
verbs: ["update", "patch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagequotaperiodicsyncs"]
verbs: ["create", "get", "list", "patch", "delete" ,"watch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagequotaperiodicsyncs/status"]
verbs: ["update", "patch"]
- apiGroups: ["cns.vmware.com"]
resources: ["storagepolicyquotas"]
verbs: ["get", "list", "watch"]
Expand Down Expand Up @@ -377,6 +383,7 @@ spec:
- "--leader-election-lease-duration=120s"
- "--leader-election-renew-deadline=60s"
- "--leader-election-retry-period=30s"
- "--storagequota-sync-interval=10m"
env:
- name: CLUSTER_FLAVOR
value: "WORKLOAD"
Expand Down
2 changes: 1 addition & 1 deletion manifests/supervisorcluster/1.30/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ spec:
- "--leader-election-lease-duration=120s"
- "--leader-election-renew-deadline=60s"
- "--leader-election-retry-period=30s"
- "--storagequota-sync-interval=30m"
- "--storagequota-sync-interval=10m"
env:
- name: CLUSTER_FLAVOR
value: "WORKLOAD"
Expand Down
5 changes: 5 additions & 0 deletions pkg/syncer/metadatasyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,11 @@ func InitMetadataSyncer(ctx context.Context, clusterFlavor cnstypes.CnsClusterFl

func initStorageQuotaPeriodicSync(ctx context.Context, metadataSyncer *metadataSyncInformer) error {
log := logger.GetLogger(ctx).WithOptions()
if int(PeriodicSyncIntervalInMin.Minutes()) == 0 {
log.Info("initStorageQuotaPeriodicSync: sync interval is set to 0, " +
"will skip the Periodic Sync for storage quota")
return nil
}
// create storagequotaperiodicsync CR

log.Info("initStorageQuotaPeriodicSync: Initialize the storage quota periodic sync")
Expand Down

0 comments on commit 1402690

Please sign in to comment.