Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage policy quota #3027

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kavyashree-r
Copy link
Contributor

What this PR does / why we need it:

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:
A PR must be marked "[WIP]", if no test result is provided. A WIP PR won't be reviewed, nor merged.
The requester can determine a sufficient test, e.g. build for a cosmetic change, E2E test in a predeployed setup, etc.
For new features, new tests should be done, in addition to regression tests.
If jtest is used to trigger precheckin tests, paste the result after jtest completes and remove [WIP] in the PR subject.
The review cycle will start, only after "[WIP]" is removed from the PR subject.

Special notes for your reviewer:

Release note:

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 4, 2024
@svcbot-qecnsdp
Copy link

Started GC block pipeline...

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2024
@kavyashree-r kavyashree-r force-pushed the storageQuota1 branch 3 times, most recently from ac647e0 to 1f9abaf Compare October 11, 2024 20:03
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 11, 2024
@kavyashree-r kavyashree-r force-pushed the storageQuota1 branch 3 times, most recently from 8f39aa0 to 6bbac3f Compare October 17, 2024 11:36
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 24, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2024
@kavyashree-r kavyashree-r changed the title [WIP] storage policy quota - 1st set storage policy quota Nov 19, 2024
if vanillaCluster || supervisorCluster {
snapshotHandle = *snapshotContent.Status.SnapshotHandle
snapshotID = strings.Split(snapshotHandle, "+")[1]
framework.Logf("********** snapshotHandle :%v", snapshotHandle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unnecessary log and commented lines across all files

@@ -140,6 +142,9 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
} else {
fullSyncWaitTime = defaultFullSyncWaitTime
}
vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
isStorageQuotaFSSEnabled = isFssEnabled(ctx, vcAddress, "STORAGE_QUOTA_M2")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment to remove this once the FSS is enabled

storageclass.Name, namespace, volExtensionName)
framework.Logf("storagepolicyquota_pvc_after :%v", storagepolicyquota_pvc_after)

storagepolicy_usage_pvc_after, _ = getStoragePolicyUsageForSpecificResourceType(ctx, restConfig,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use camelCase to name your variables

storagepolicyUsage_reserved_Quota.String() == "0"

}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments to this specific method

}

// stopCSIPods function stops all the running csi pods
func stopKubeSystemPods(ctx context.Context, client clientset.Interface, namespace string) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this method to appropriate name and add a comment accordingly

6. Delete pvcs and SC
7. Verify no orphan volumes are left
*/
ginkgo.It("create volume when storage-quota-weebhook goes down", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This testcase will run for vanilla as well, we can add a tag to just run for supervisor suite

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please correct the test steps accordingly

@@ -1624,6 +1750,31 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
snapshotCreated, snapshotContentCreated, err = deleteVolumeSnapshot(ctx, snapc, namespace,
volumeSnapshot, pandoraSyncWaitTime, volHandle, snapshotId, true)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if isStorageQuotaFSSEnabled && supervisorCluster {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if this can be seperated into 3 different functions:

  1. For volume and snapshot quota and usage before
  2. For volume and snapshot quota and usage after
  3. For cleanup of volumes and snapshots


storagepolicyquota_pvc_before, _ = getStoragePolicyQuotaForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, volExtensionName)
framework.Logf("volume ********** storagepolicyquota_pvc_before :%v ", storagepolicyquota_pvc_before)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some proper comment


storagepolicy_usage_pvc_before, _ = getStoragePolicyUsageForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, pvcUsage)
framework.Logf("volume ********** storagepolicy_usage_pvc_before :%v", storagepolicy_usage_pvc_before)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well


storagepolicyquota_pvc_after, _ = getStoragePolicyQuotaForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, volExtensionName)
framework.Logf("********** storagepolicyquota_pvc_after :%v", storagepolicyquota_pvc_after)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also


storagepolicy_usage_pvc_after, _ = getStoragePolicyUsageForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, pvcUsage)
framework.Logf("********** pvc_Usage_Quota_After :%v", storagepolicy_usage_pvc_after)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

@@ -2272,7 +2427,7 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
})

/*
VMDK is deleted from datastore but CNS volume is still present
VMDK is deleted from datastore but CNS volume is still presentx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modify this


storagepolicyquota_pvc_before, _ = getStoragePolicyQuotaForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, volExtensionName)
framework.Logf("volume ********** storagepolicyquota_pvc_before :%v ", storagepolicyquota_pvc_before)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add meaningful log


storagepolicy_usage_pvc_before, _ = getStoragePolicyUsageForSpecificResourceType(ctx, restConfig,
storagePolicyName, namespace, pvcUsage)
framework.Logf("volume ********** storagepolicy_usage_pvc_before :%v", storagepolicy_usage_pvc_before)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

cnsOperatorClient, err := k8s.NewClientForGroup(ctx, restClientConfig, cnsoperatorv1alpha1.GroupName)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

//spq := &storagepolicyv1alpha2.StoragePolicyQuota{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment

if string(suffix1) == "Mi" {
var bytes int64 = quotaBefore
// Convert to Gi
//kibibytes := float64(bytes) / 1024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all commented code if not required

@@ -284,6 +290,45 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}()

if isStorageQuotaFSSEnabled {
totalquota_used_before, _ = getTotalQuotaConsumedByStoragePolicy(ctx, restConfig, storageclass.Name, namespace)
framework.Logf("************ totalUsedQuota_Before :%v", totalquota_used_before)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add meanningful comment

Copy link
Contributor

@rajguptavm rajguptavm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comment

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kavyashree-r, rajguptavm

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants