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

Added mce.py file for mce installation related methods #11038

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

Conversation

amr1ta
Copy link
Contributor

@amr1ta amr1ta commented Dec 11, 2024

Added mce.py file for mce installation related methods and created libtest to check mce installation and hcp cluster creation without acm operator

@amr1ta amr1ta added the provider-client Provider-client solution label Dec 11, 2024
@amr1ta amr1ta requested a review from a team as a code owner December 11, 2024 15:09
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Dec 11, 2024
Copy link

openshift-ci bot commented Dec 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amr1ta

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

@@ -477,6 +488,8 @@ def deploy_dependencies(
self.deploy_lb()
if download_hcp_binary:
self.update_hcp_binary()
if deploy_mce:
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably check, if deploy_acm_hub: True, leaving ACM as a general option

Suggested change
if deploy_mce:
if deploy_mce and not deploy_acm_hub:

Creates a catalogsource for mce operator.

"""
logger.info("Adding CatalogSource for MCE")
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to check if MCE catalogSource is not already installed. This way we insure, the Deployment can be rerun again from any installation stage.
In opposite if we do not do this check, job will abort with error

Raises:
CommandFailed: If the 'oc create' command fails.
"""
try:
Copy link
Contributor

@DanielOsypenko DanielOsypenko Dec 12, 2024

Choose a reason for hiding this comment

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

it is better to check if resource exist than using try-except, to not pollute logs with false-errors

"""
operatorgroup_yaml_file = templating.load_yaml(constants.MCE_OPERATOR_YAM)
operatorgroup_yaml = OCS(**operatorgroup_yaml_file)
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

it is better to check if resource exist than using try-except, to not pollute logs with false-errors

mce_subscription_yaml_data, mce_subscription_manifest.name
)
logger.info("Creating subscription for mce operator")
run_cmd(f"oc create -f {mce_subscription_manifest.name}")
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 subscription exists in the beginning of the method; if exists skip execution of the method

"-n {self.namespace}"
)
cmd_res = exec_cmd(cmd, shell=True)
assert cmd_res.returncode == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

overall it its better not use assert in deployments, but in tests. This way we'll have errors in log showing that deployment failed, instead of assertion signaling about a product bug

"]}}}' --type=merge"
)
cmd_res = exec_cmd(cmd, shell=True)
assert cmd_res.returncode == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, assertion on this would not mean Product bug;
we have module with ocs-ci exceptions ocs_ci.ocs.exceptions, please use existing or add another with description

namespace=constants.HYPERSHIFT_NAMESPACE,
)

assert configmaps_obj.is_exist(
Copy link
Contributor

Choose a reason for hiding this comment

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

we have module with ocs-ci exceptions ocs_ci.ocs.exceptions, please use existing or add another with description instead of using assert

@@ -386,6 +390,7 @@ def deploy_ocp(
deploy_acm_hub=True,
deploy_metallb=True,
download_hcp_binary=True,
deploy_mce=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

we will need introduce this new parameter in configurations and .md file.

…btest to check mce installation and hcp cluster creation without acm operator

Signed-off-by: Amrita Mahapatra <[email protected]>
@amr1ta amr1ta force-pushed the create-hcp-cluster-without-acm branch from 65086be to a42dd98 Compare December 12, 2024 14:29
@amr1ta amr1ta force-pushed the create-hcp-cluster-without-acm branch from a42dd98 to d372a22 Compare December 12, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider-client Provider-client solution size/L PR that changes 100-499 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants