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

Provision for installing submariner downstream unreleased build #8716

Merged
Merged
4 changes: 4 additions & 0 deletions conf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ higher priority).
* `nb_nfs_mount` - NFS mount point used specifically for testing noobaa db NFS mount test
* `custom_default_storageclass_names` - Set to true if custom storageclass names use instead of default one.
* `storageclassnames` - Under this key, custom storage class names for `cephFilesystems`, `cephObjectStores`, `cephBlockPools`, `cephNonResilientPools`, `nfs` and for `encryption` are defined.
* `submariner_source` - Source from which we take submariner build, ex: upstream, downstream, downstream_unreleased
shylesh marked this conversation as resolved.
Show resolved Hide resolved
* `submariner_release_type` - Released OR Unreleased submariner build
* `enable_globalnet` - enable or disable globalnet for submariner
Copy link
Contributor Author

Choose a reason for hiding this comment

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

explain default value for enable_globalnet

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

* `submariner_unreleased_channel` - submariner channel for unreleased downstream build

#### UPGRADE

Expand Down
2 changes: 2 additions & 0 deletions conf/ocsci/enable_globalnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENV_DATA:
enable_globalnet: true
petr-balogh marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions conf/ocsci/submariner_downstream_unreleased.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ENV_DATA:
submariner_source: "downstream"
petr-balogh marked this conversation as resolved.
Show resolved Hide resolved
submariner_release_type: "unreleased"
submariner_version: "0.16.0"
Copy link
Member

Choose a reason for hiding this comment

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

Do we support only one specific unreleased DS version? Or we do support also previous unreleased DS versions, like we do in ODF? E.g. 4.13.5.

If so , then maybe we can move to the ODF or OCP configuration file - depends on to which is's more relevant.
If only one unreleased version, we can keep it here in the file. She same Q for the channel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keesturam , @prsurve @sidhant-agrawal , could you please provide your inputs here so that we can create OCP/ODF specific submariner versions?

Copy link
Member

Choose a reason for hiding this comment

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

For ODF's y stream releases, we will mostly support one unreleased submariner version until GA. However, after the GA we will have to support future versions.
For eg., all the while with 4.14, we have been using submariner 0.16.0.
I hope this helps.

submariner_unreleased_channel: "stable-0.16"
enable_globalnet: true
28 changes: 27 additions & 1 deletion ocs_ci/deployment/acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
CommandFailed,
DRPrimaryNotFoundException,
)
from ocs_ci.utility import templating
from ocs_ci.ocs.utils import get_non_acm_cluster_config
from ocs_ci.utility.utils import run_cmd, run_cmd_interactive
from ocs_ci.utility.utils import (
run_cmd,
run_cmd_interactive,
wait_for_machineconfigpool_status,
)
from ocs_ci.ocs.node import get_typed_worker_nodes, label_nodes

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -62,6 +67,8 @@ class Submariner(object):
def __init__(self):
# whether upstream OR downstream
self.source = config.ENV_DATA["submariner_source"]
# released/unreleased
self.submariner_release_type = config.ENV_DATA.get("submariner_release_type")
# Deployment type:
self.deployment_type = config.ENV_DATA.get("submariner_deployment")
# Designated broker cluster index where broker will be deployed
Expand Down Expand Up @@ -94,9 +101,28 @@ def deploy_downstream(self):

login_to_acm()
acm_obj = AcmAddClusters()
if self.submariner_release_type == "unreleased":
old_ctx = config.cur_index
for cluster in get_non_acm_cluster_config():
config.switch_ctx(cluster.MULTICLUSTER["multicluster_index"])
self.create_acm_brew_icsp()
config.switch_ctx(old_ctx)
acm_obj.install_submariner_ui()
acm_obj.submariner_validation_ui()

def create_acm_brew_icsp(self):
"""
This is a prereq for downstream unreleased submariner

"""
icsp_data = templating.load_yaml(constants.ACM_DOWNSTREAM_BREW_ICSP)
icsp_data_yaml = tempfile.NamedTemporaryFile(
mode="w+", prefix="acm_icsp", delete=False
)
templating.dump_data_to_temp_yaml(icsp_data, icsp_data_yaml.name)
run_cmd(f"oc create -f {icsp_data_yaml.name}", timeout=300)
shylesh marked this conversation as resolved.
Show resolved Hide resolved
wait_for_machineconfigpool_status(node_type="all")

def download_binary(self):
if self.source == "upstream":
# This script puts the platform specific binary in ~/.local/bin
Expand Down
38 changes: 38 additions & 0 deletions ocs_ci/deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
ocs_install_verification,
setup_ceph_debug,
get_osd_count,
StorageCluster,
)
from ocs_ci.ocs.uninstall import uninstall_ocs
from ocs_ci.ocs.utils import (
Expand Down Expand Up @@ -351,6 +352,43 @@ def do_deploy_ocs(self):
"ocs_registry_image", None
)
ocs_install_verification(ocs_registry_image=ocs_registry_image)
# if we have Globalnet enabled in case of submariner with RDR
# we need to add a flag to storagecluster
if config.ENV_DATA.get("enable_globalnet", None):
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
if config.ENV_DATA.get("enable_globalnet", None):
if config.ENV_DATA.get("enable_globalnet", True):

for cluster in get_non_acm_cluster_config():
config.switch_ctx(cluster.MULTICLUSTER["multicluster_index"])
storage_cluster_name = config.ENV_DATA["storage_cluster_name"]
logger.info(
"Updating the StorageCluster resource for globalnet"
)
storage_cluster = StorageCluster(
resource_name=storage_cluster_name,
namespace=config.ENV_DATA["cluster_namespace"],
)
storage_cluster.reload_data()
storage_cluster.wait_for_phase(phase="Ready", timeout=1000)
ptch = (
f'\'{{"spec": {{"network": {{"multiClusterService": '
f"{{\"clusterID\": \"{config.ENV_DATA['cluster_name']}\", \"enabled\": true}}}}}}}}'"
)
ptch_cmd = (
f"oc patch storagecluster/{storage_cluster.data.get('metadata').get('name')} "
f"-n openshift-storage --type merge --patch {ptch}"
)
run_cmd(ptch_cmd)
ocs_registry_image = config.DEPLOYMENT.get(
"ocs_registry_image", None
)
storage_cluster.reload_data()
assert (
storage_cluster.data.get("spec")
.get("network")
.get("multiClusterService")
.get("enabled")
), "Failed to update StorageCluster globalnet"
ocs_install_verification(
timeout=2000, ocs_registry_image=ocs_registry_image
)
shylesh marked this conversation as resolved.
Show resolved Hide resolved
config.reset_ctx()
else:
logger.warning("OCS deployment will be skipped")
Expand Down
51 changes: 51 additions & 0 deletions ocs_ci/ocs/acm/acm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
import time
import os
import tempfile
import requests

from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
Expand All @@ -22,8 +24,10 @@
from ocs_ci.ocs.utils import get_non_acm_cluster_config, get_primary_cluster_config
from ocs_ci.utility.utils import (
TimeoutSampler,
get_ocp_version,
get_running_acm_version,
string_chunkify,
run_cmd,
)
from ocs_ci.ocs.ui.acm_ui import AcmPageNavigator
from ocs_ci.ocs.ui.base_ui import login_ui, SeleniumDriver
Expand Down Expand Up @@ -152,6 +156,38 @@ def install_submariner_ui(self, globalnet=True):
for s in get_non_acm_cluster_config()
if s.MULTICLUSTER["multicluster_index"] != primary_index
][0]
# submariner catalogsource creation
if config.ENV_DATA["submariner_release_type"] == "unreleased":
submariner_downstream_unreleased = templating.load_yaml(
constants.SUBMARINER_DOWNSTREAM_UNRELEASED
)
# Update catalog source
submariner_full_url = "".join(
[
constants.SUBMARINER_DOWNSTREAM_UNRELEASED_BUILD_URL,
config.ENV_DATA["submariner_version"],
]
)

resp = requests.get(submariner_full_url, verify=False)
raw_msg = resp.json()["raw_messages"]
version_tag = raw_msg[0]["msg"]["pipeline"]["index_image"][
f"v{get_ocp_version()}"
].split(":")[1]
submariner_downstream_unreleased["spec"]["image"] = ":".join(
[constants.SUBMARINER_BREW_REPO, version_tag]
)
submariner_data_yaml = tempfile.NamedTemporaryFile(
mode="w+", prefix="submariner_downstream_unreleased", delete=False
)
templating.dump_data_to_temp_yaml(
submariner_downstream_unreleased, submariner_data_yaml.name
)
old_ctx = config.cur_index
for cluster in get_non_acm_cluster_config():
config.switch_ctx(cluster.MULTICLUSTER["multicluster_index"])
run_cmd(f"oc create -f {submariner_data_yaml.name}", timeout=300)
config.switch_ctx(old_ctx)

cluster_name_a = cluster_env.get(f"cluster_name_{primary_index}")
cluster_name_b = cluster_env.get(f"cluster_name_{secondary_index}")
Expand Down Expand Up @@ -222,6 +258,8 @@ def install_submariner_ui(self, globalnet=True):
)
self.do_click(self.page_nav["gateway-count-btn"])
self.do_click(self.page_nav["gateway-count-btn"])
if config.ENV_DATA.get("submariner_release_type") == "unreleased":
self.submariner_unreleased_downstream_info()
log.info("Click on Next button")
self.do_click(self.page_nav["next-btn"])
log.info("Click on 'Enable NAT-T' to uncheck it [2]")
Expand All @@ -231,6 +269,8 @@ def install_submariner_ui(self, globalnet=True):
)
self.do_click(self.page_nav["gateway-count-btn"])
self.do_click(self.page_nav["gateway-count-btn"])
if config.ENV_DATA.get("submariner_release_type") == "unreleased":
self.submariner_unreleased_downstream_info()
log.info("Click on Next button [2]")
self.do_click(self.page_nav["next-btn"])
if ocs_version >= version.VERSION_4_13 and globalnet:
Expand All @@ -243,6 +283,17 @@ def install_submariner_ui(self, globalnet=True):
log.info("Click on 'Install'")
self.do_click(self.page_nav["install-btn"])

def submariner_unreleased_downstream_info(self):
self.do_click(self.page_nav["submariner-custom-subscription"])
self.do_clear(self.page_nav["submariner-custom-source"])
self.do_send_keys(
self.page_nav["submariner-custom-source"], "submariner-catalogsource"
)
self.do_send_keys(
self.page_nav["submariner-custom-channel"],
config.ENV_DATA["submariner_unreleased_channel"],
)

def submariner_validation_ui(self):
"""
This function validates submariner status on ACM console which connects 2 managed OCP clusters.
Expand Down
14 changes: 14 additions & 0 deletions ocs_ci/ocs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@
)
MDR_BACKUP_SCHEDULE_RESOURCE = "schedule-acm"


# DR constants
SUBMARINER_DOWNLOAD_URL = "https://get.submariner.io"
DR_DEFAULT_NAMESPACE = "openshift-dr-systems"
Expand Down Expand Up @@ -2069,6 +2070,16 @@
SUBMARINER_GATEWAY_ACTIVE_LABEL = "gateway.submariner.io/status=active"
SUBMARINER_GATEWAY_NODE_LABEL = "submariner.io/gateway=true"
GLOBALNET_STATUS = "True"
SUBMARINER_DOWNSTREAM_UNRELEASED = os.path.join(
TEMPLATE_MULTICLUSTER_DIR, "submariner_downstream_unreleased_catsrc.yaml"
)
# We need to append version string at the end of this url
SUBMARINER_DOWNSTREAM_UNRELEASED_BUILD_URL = (
"https://datagrepper.engineering.redhat.com/raw?topic=/topic/"
"VirtualTopic.eng.ci.redhat-container-image.pipeline.complete"
"&rows_per_page=25&delta=1296000&contains=submariner-operator-bundle-container-v"
)
SUBMARINER_BREW_REPO = "brew.registry.redhat.io/rh-osbs/iib"

# Multicluster related

Expand Down Expand Up @@ -2102,6 +2113,9 @@
ACM_HUB_UNRELEASED_ICSP_YAML = os.path.join(
TEMPLATE_DIR, "acm-deployment", "imagecontentsourcepolicy.yaml"
)
ACM_DOWNSTREAM_BREW_ICSP = os.path.join(
TEMPLATE_DIR, "acm-deployment", "acm_downstream_brew_icsp.yaml"
)
ACM_HUB_UNRELEASED_PULL_SECRET_TEMPLATE = "pull-secret.yaml.j2"
ACM_ODF_MULTICLUSTER_ORCHESTRATOR_RESOURCE = "odf-multicluster-orchestrator"
ACM_ODR_HUB_OPERATOR_RESOURCE = "odr-hub-operator"
Expand Down
8 changes: 8 additions & 0 deletions ocs_ci/ocs/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,13 @@
**acm_configuration_4_12,
}

acm_configuration_4_14 = {
**acm_configuration_4_13,
"submariner-custom-subscription": ("isCustomSubscription", By.ID),
"submariner-custom-source": ("source", By.ID),
"submariner-custom-channel": ("channel", By.ID),
}

add_capacity = {
"ocs_operator": (
'a[data-test-operator-row="OpenShift Container Storage"]',
Expand Down Expand Up @@ -1710,6 +1717,7 @@
**acm_configuration_4_11,
**acm_configuration_4_12,
**acm_configuration_4_13,
**acm_configuration_4_14,
},
"validation": {
**validation,
Expand Down
18 changes: 18 additions & 0 deletions ocs_ci/templates/acm-deployment/acm_downstream_brew_icsp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
name: brew-registry
spec:
repositoryDigestMirrors:
- mirrors:
- brew.registry.redhat.io
source: registry.redhat.io
- mirrors:
- brew.registry.redhat.io/rhacm2
source: registry.redhat.io/rhacm2
- mirrors:
- brew.registry.redhat.io
source: registry.stage.redhat.io
- mirrors:
- brew.registry.redhat.io
source: registry-proxy.engineering.redhat.com
shylesh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: submariner-catalogsource
namespace: openshift-marketplace
spec:
icon:
base64data: ""
mediatype: ""
image: PLACE_HOLDER
publisher: Red Hat
sourceType: grpc
priority: 100
updateStrategy:
registryPoll:
interval: 15m
Loading