Skip to content

Refactor determination of storageclass for deployments #12042

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

clacroix12
Copy link
Contributor

@clacroix12 clacroix12 added Needs Deployment Testing Needs Deployment and Some Tier1 Testing team/ecosystem Ecosystem team related issues/PRs labels Apr 30, 2025
@clacroix12 clacroix12 requested a review from a team April 30, 2025 22:38
@clacroix12 clacroix12 requested a review from a team as a code owner April 30, 2025 22:38
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Apr 30, 2025
Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: deployment
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.18-ga
OCS VERSION: 4.18
tested against branch: master

Job PASSED.

@clacroix12 clacroix12 changed the title WIP: Refactor determination of storageclass for deployments Refactor determination of storageclass for deployments May 1, 2025
Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: deployment
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.18-ga
OCS VERSION: 4.18
tested against branch: master

Job PASSED.

@clacroix12 clacroix12 added Verified Mark when PR was verified and log provided and removed Needs Deployment Testing Needs Deployment and Some Tier1 Testing labels May 1, 2025
dahorak
dahorak previously approved these changes May 2, 2025
Copy link
Contributor

@dahorak dahorak left a comment

Choose a reason for hiding this comment

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

Just some small questions/suggestions otherwise LGTM.

Comment on lines +12 to +20
DEFAULT_STORAGE_CLASS_MAP = {
constants.AWS_PLATFORM: "gp2-csi",
constants.IBMCLOUD_PLATFORM: "ibmc-vpc-block-10iops-tier",
constants.VSPHERE_PLATFORM: "thin-csi",
constants.AZURE_PLATFORM: "managed-csi",
constants.GCP_PLATFORM: None,
constants.ROSA_HCP_PLATFORM: None,
constants.RHV_PLATFORM: "ovirt-csi-sc",
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The thin-csi value is also available as constants.THIN_CSI_STORAGECLASS, but I'm not sure, if it is worth to change all the values and get them from constants, so maybe as it is now is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that as well and came to the same conclusion. I didn't think it was necessary to convert them each to their own constant. If you think it's worth it to move the map to the constants module I can do that, but for now I will leave it as is.

"customized_deployment_storage_class"
)

storage_class = DEFAULT_STORAGE_CLASS_MAP.get(platform)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't be better to use DEFAULT_STORAGE_CLASS_MAP[platform], so it will directly raise a clear KeyError: exception in case we will implement new platform or is None a reasonable "default"?

In the case of raising KeyError exception for missing platform, it might be worth to combine this with the following condition for customized_deployment_storage_class, so in case the platform will be missing in the map, but customized_deployment_storage_class will be defined, it will not raise the exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally had it this way but went with .get due to failures in test_cloud.py. I could revert back to using a direct call to the key and change the test class to just set the proper attribute so it doesn't hit any issues.

For the customized_deployment_storage_class case I did add keys for the platforms which leverage this but I do think it's a good idea to check both before raising the error so I will incorporate that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the check for customized_deployment_storage_class above setting the default value so we will check if that exists as a priority, and changed getting the default value to directly access the key.

@@ -129,6 +118,11 @@ def __init__(self):
self.cluster_launcer_repo_path = os.path.join(
constants.EXTERNAL_DIR, "v4-scaleup"
)
if version.get_semantic_ocp_version_from_config() >= version.VERSION_4_13:
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably remove this condition and run the following code directly as this condition will be always evaluated to true for the supported versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

petr-balogh
petr-balogh previously approved these changes May 2, 2025
@petr-balogh
Copy link
Member

Daniel had few valuable comments to consider, but I am also OK with this change - but if you will incorporate Daniel's suggestions I will re-approve.

Signed-off-by: Coady LaCroix <[email protected]>
@clacroix12 clacroix12 dismissed stale reviews from petr-balogh and dahorak via bab2b73 May 2, 2025 19:06
@openshift-ci openshift-ci bot removed the lgtm label May 2, 2025
Copy link

openshift-ci bot commented May 2, 2025

New changes are detected. LGTM label has been removed.

Copy link

openshift-ci bot commented May 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: clacroix12

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

2 similar comments
Copy link

openshift-ci bot commented May 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: clacroix12

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

Copy link

openshift-ci bot commented May 2, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: clacroix12

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

@clacroix12
Copy link
Contributor Author

A small change here that I want to mention: The default platform in our default_config is now aws as opposed to AWS. This was causing an issue with the test_cloud unit tests now that the platform is being used to retrieve the default storageclass. I suspect that nothing else in the framework was expecting the platform to be in all caps since our constant AWS_PLATFORM is lower case as well as the value in all of our aws specific config files, but I wanted to mention it since it's a change to the default config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines team/ecosystem Ecosystem team related issues/PRs Verified Mark when PR was verified and log provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants