-
Notifications
You must be signed in to change notification settings - Fork 170
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
Version details for DR operators #9956
Changes from 4 commits
3106ab2
2e67781
0136367
5971b48
8c0d955
152e6f2
529f32a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||
from ocs_ci.framework import config | ||||||
from ocs_ci.ocs import defaults | ||||||
from ocs_ci.ocs.exceptions import WrongVersionExpression | ||||||
from ocs_ci.ocs import constants | ||||||
|
||||||
|
||||||
def get_semantic_version( | ||||||
|
@@ -172,3 +173,121 @@ def get_previous_version(version, count=1): | |||||
new_minor = version.minor - count | ||||||
previous_version = f"{version.major}.{new_minor}" | ||||||
return previous_version | ||||||
|
||||||
|
||||||
def get_dr_hub_operator_version(namespace=constants.OPENSHIFT_NAMESPACE): | ||||||
""" | ||||||
Get DR Hub Operator Version | ||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
vavuthu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix( | ||||||
constants.ACM_ODR_HUB_OPERATOR_RESOURCE, namespace=namespace | ||||||
) | ||||||
for csv in csv_list: | ||||||
if constants.ACM_ODR_HUB_OPERATOR_RESOURCE in csv["metadata"]["name"]: | ||||||
# extract version string | ||||||
return csv["spec"]["version"] | ||||||
|
||||||
|
||||||
def get_ocp_dr_cluster_operator_version(namespace=constants.OPENSHIFT_NAMESPACE): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
""" | ||||||
Get DR Hub Operator Version | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
petr-balogh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix("odr-cluster-operator", namespace=namespace) | ||||||
for csv in csv_list: | ||||||
if "odr-cluster-operator" in csv["metadata"]["name"]: | ||||||
# extract version string | ||||||
return csv["spec"]["version"] | ||||||
|
||||||
|
||||||
def get_odf_multicluster_orchestrator_version(namespace=constants.ACM_HUB_NAMESPACE): | ||||||
""" | ||||||
Get ODF Multicluster Orchestrator Version | ||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
vavuthu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix( | ||||||
constants.ACM_ODF_MULTICLUSTER_ORCHESTRATOR_RESOURCE, | ||||||
namespace=namespace, | ||||||
) | ||||||
for csv in csv_list: | ||||||
if ( | ||||||
constants.ACM_ODF_MULTICLUSTER_ORCHESTRATOR_RESOURCE | ||||||
in csv["metadata"]["name"] | ||||||
): | ||||||
# extract version string | ||||||
return csv["spec"]["version"] | ||||||
|
||||||
|
||||||
def get_ocp_gitops_operator_version(namespace=constants.OPENSHIFT_NAMESPACE): | ||||||
""" | ||||||
Get OCP Gitops Operator Version | ||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
vavuthu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix( | ||||||
"openshift-gitops-operator", namespace=namespace | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
for csv in csv_list: | ||||||
if constants.GITOPS_OPERATOR_NAME in csv["metadata"]["name"]: | ||||||
# extract version string | ||||||
return csv["spec"]["version"] | ||||||
|
||||||
|
||||||
def get_submariner_operator_version(namespace=constants.SUBMARINER_OPERATOR_NAMESPACE): | ||||||
""" | ||||||
Get Submariner Operator Version | ||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
vavuthu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix("submariner", namespace=namespace) | ||||||
for csv in csv_list: | ||||||
if "submariner" in csv["metadata"]["name"]: | ||||||
# extract version string | ||||||
return csv["spec"]["version"] | ||||||
|
||||||
|
||||||
def get_volsync_operator_version(namespace=constants.SUBMARINER_OPERATOR_NAMESPACE): | ||||||
""" | ||||||
Get VolSync Operator Version | ||||||
|
||||||
Returns: | ||||||
str: returns version string | ||||||
vavuthu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
""" | ||||||
# Importing here to avoid circular dependency | ||||||
from ocs_ci.ocs.resources.csv import get_csvs_start_with_prefix | ||||||
|
||||||
csv_list = get_csvs_start_with_prefix("volsync", namespace=namespace) | ||||||
for csv in csv_list: | ||||||
if "volsync" in csv["metadata"]["name"]: | ||||||
# extract version string | ||||||
return csv["spec"]["version"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to import sections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you updated this function, could we add doc string as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a Circular Import Error when i move to import section.
Added doc string.