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

Create hosted cluster deploy - destroy fixtures #9957

Conversation

DanielOsypenko
Copy link
Contributor

  • added fixture to create Hosted cluster and add configuration to multicluster job
  • added fixture that abruptly destroys hosted clusters (leaving OCS resources)

@DanielOsypenko DanielOsypenko self-assigned this Jun 17, 2024
@DanielOsypenko DanielOsypenko requested a review from a team as a code owner June 17, 2024 17:24
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Jun 17, 2024
@DanielOsypenko DanielOsypenko requested a review from shylesh June 17, 2024 17:29
@DanielOsypenko DanielOsypenko force-pushed the create_hosted_cluster_destroy_hosted_cluster_fixtures branch from ba9942b to 266ac11 Compare July 1, 2024 08:41
@pull-request-size pull-request-size bot added size/XL and removed size/L PR that changes 100-499 lines labels Jul 7, 2024
@DanielOsypenko DanielOsypenko force-pushed the create_hosted_cluster_destroy_hosted_cluster_fixtures branch from d0ba084 to c9df3a7 Compare July 18, 2024 11:12
@DanielOsypenko DanielOsypenko changed the title Create hosted cluster destroy hosted cluster fixtures Create hosted cluster deploy - destroy fixtures Jul 21, 2024
Returns:
str: random cluster name
"""
# getting the cluster name from the env data, fo instance "ibm_cloud_baremetal3; mandatory conf field"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# getting the cluster name from the env data, fo instance "ibm_cloud_baremetal3; mandatory conf field"
# getting the cluster name from the env data, for instance "ibm_cloud_baremetal3; mandatory conf field"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Check if the storage client installation was requested in the config

Args:
cluster_name: str: Name of the cluster
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 add Returns section to the docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


class CustomJSONEncoder(json.JSONEncoder):
"""
Custom JSON encoder to handle set objects
Copy link
Contributor

Choose a reason for hiding this comment

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

Please describe in docstring what this custom json encoder does differently and maybe change its name to reflect it. Also please consider if it should be in its own file (e.g. ocs_ci/utility/json.py).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return super().default(obj)


def get_odf_tag_from_redhat_catsrc():
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to have this function in ocs/resources/catalog_source.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved, thanks

@DanielOsypenko DanielOsypenko requested a review from ebondare July 23, 2024 08:20
fbalak
fbalak previously approved these changes Jul 24, 2024
self, create_hypershift_clusters, destroy_hosted_cluster
):
"""
Test create hosted cluster with fixture
Copy link
Contributor

Choose a reason for hiding this comment

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

Docstring is identical to the one of the previous test. I'd write something like "create and destroy hosted cluster", to avoid confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

ebondare
ebondare previously approved these changes Jul 29, 2024
Signed-off-by: Daniel Osypenko <[email protected]>
Signed-off-by: Daniel Osypenko <[email protected]>
@DanielOsypenko DanielOsypenko dismissed stale reviews from ebenahar, fbalak, and ebondare via 4d121c6 August 12, 2024 07:58
@DanielOsypenko DanielOsypenko force-pushed the create_hosted_cluster_destroy_hosted_cluster_fixtures branch from 39f5653 to 4d121c6 Compare August 12, 2024 07:58
@openshift-ci openshift-ci bot removed the lgtm label Aug 12, 2024
dahorak
dahorak previously approved these changes Aug 12, 2024
ocs_ci/deployment/helpers/hypershift_base.py Show resolved Hide resolved
Comment on lines 75 to 80
# getting the cluster name from the env data, for instance "ibm_cloud_baremetal3; mandatory conf field"
bm_name = config.ENV_DATA.get("baremetal").get("env_name")
ocp_version = get_latest_release_version()
hcp_version = "".join([c for c in ocp_version if c.isdigit()][:3])
match = re.search(r"\d+$", bm_name)
if match:
Copy link
Contributor

Choose a reason for hiding this comment

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

I understood, that it is good to be able to match the hosted cluster somehow with the hosting cluster, but I'm not sure about this approach, because it is quite specific for the particular environment. I'm not sure, if it is possible, that we would like to run this on octo-argo environment (maybe that is not even sufficient, not sure), or wouldn't this be later used on other platforms as well - e.g. vSphere?
What about at least make the bm_name part optional? So it will not fail if the env_name will not match the expected form or will be missing. Since the last part of the cluster name is anyway random, there shouldn't be any conflict in the cluster name and the only drawback will be the fact, that it will not be directly visible where the cluster belongs to.
Another option which might be sufficient would be to make the whole part bmX configurable and add this configuration to the environment specific conf files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, thanks. I've added a ticket for this.
#10279

ocs_ci/deployment/helpers/hypershift_base.py Outdated Show resolved Hide resolved
ocs_ci/ocs/resources/catalog_source.py Outdated Show resolved Hide resolved
Signed-off-by: Daniel Osypenko <[email protected]>
dahorak
dahorak previously approved these changes Aug 12, 2024
@openshift-ci openshift-ci bot added the lgtm label Aug 12, 2024
Check if the storage client installation was requested in the config

Args:
cluster_name: str: Name of the cluster
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cluster_name: str: Name of the cluster
cluster_name (str): Name of the cluster

"""
Deploy multiple hosted OCP clusters on Provider platform

Args:
cluster_names_list (list, optional): List of cluster names to deploy. If not provided, all clusters
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cluster_names_list (list, optional): List of cluster names to deploy. If not provided, all clusters
cluster_names_list (list): List of cluster names to deploy. If not provided, all clusters (optional argument)

ebenahar
ebenahar previously approved these changes Aug 12, 2024
Signed-off-by: Daniel Osypenko <[email protected]>
@DanielOsypenko DanielOsypenko dismissed stale reviews from ebenahar and dahorak via e171dbc August 12, 2024 12:38
@openshift-ci openshift-ci bot removed the lgtm label Aug 12, 2024
Copy link

openshift-ci bot commented Aug 12, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dahorak, DanielOsypenko, petr-balogh

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

@dahorak dahorak merged commit 533ce37 into red-hat-storage:master Aug 12, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm size/XL Verified Mark when PR was verified and log provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants