-
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
Verify IPv6 Connectivity Between Rook-Ceph-Exporter and OCP Prometheus #11480
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
""" | ||
|
||
import logging | ||
import ipaddress | ||
|
||
import pytest | ||
|
||
|
@@ -17,11 +18,13 @@ | |
runs_on_provider, | ||
provider_client_platform_required, | ||
provider_mode, | ||
skipif_external_mode, | ||
) | ||
from ocs_ci.framework.testlib import skipif_ocs_version, tier1 | ||
from ocs_ci.ocs import constants, ocp | ||
from ocs_ci.ocs import constants, ocp, defaults | ||
from ocs_ci.ocs import metrics | ||
from ocs_ci.ocs.resources import pod | ||
from ocs_ci.utility.utils import run_cmd | ||
from ocs_ci.utility.prometheus import PrometheusAPI, check_query_range_result_enum | ||
from ocs_ci.helpers.helpers import storagecluster_independent_check | ||
from ocs_ci.framework.pytest_customization.marks import skipif_managed_service | ||
|
@@ -282,3 +285,46 @@ def test_provider_metrics_available(threading_lock): | |
"so that the list of metrics without results is empty." | ||
) | ||
assert list_of_metrics_without_results == [], msg | ||
|
||
|
||
@blue_squad | ||
@tier1 | ||
@bugzilla("2297285") | ||
@skipif_external_mode | ||
@pytest.mark.polarion_id("OCS-XXX") | ||
def test_monitoring_ipv6(threading_lock): | ||
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. should we check if ipv6 feature enabled on deployment before running this test? if not we may want to skip. 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. I added a condition for IPv4 so that the test now supports both IPv6 and IPv4. 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. if it in most cases will check on ipv4 (our default environment now) should not we rename test? test_monitoring_ipv6 -> test_monitoring_ip_version , or something similar |
||
""" | ||
Procedure: | ||
1. Retrieves the IPv6 addresses of rook-ceph-exporter pods. | ||
2. Logs into the prometheus-k8s pod in the openshift-monitoring namespace. | ||
3. Checks connectivity using curl to fetch metrics from each exporter's /metrics endpoint. | ||
4. Asserts that the expected Ceph metric is present in the response. | ||
|
||
""" | ||
exporter_pods = pod.get_pods_having_label(constants.EXPORTER_APP_LABEL) | ||
ipv6_addresses = [pod_obj["status"]["podIP"] for pod_obj in exporter_pods] | ||
pod_obj_list = pod.get_all_pods( | ||
namespace=defaults.OCS_MONITORING_NAMESPACE, selector_label=["prometheus"] | ||
) | ||
prometheus_pod_obj = None | ||
for pod_obj in pod_obj_list: | ||
if "prometheus-k8s" in pod_obj.name: | ||
prometheus_pod_obj = pod_obj | ||
break | ||
assert ( | ||
prometheus_pod_obj is not None | ||
), "Prometheus pod not found in the monitoring namespace" | ||
for ipv6_address in ipv6_addresses: | ||
formatted_ip = ( | ||
f"[{ipv6_address}]" | ||
if ipaddress.ip_address(ipv6_address).version == 6 | ||
else ipv6_address | ||
) | ||
cmd = ( | ||
f"oc rsh -n {defaults.OCS_MONITORING_NAMESPACE} {prometheus_pod_obj.name} " | ||
f"curl -vv http://{formatted_ip}:9926/metrics" | ||
) | ||
out = run_cmd(cmd=cmd) | ||
assert ( | ||
"ceph_AsyncMessenger_Worker_msgr_connection" in out | ||
), f"Expected Ceph metric not found in output for IP {ipv6_address}" |
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.
no
rook-ceph-exporter
on External mode clusters because rook does not manage ceph in this case.I think this test is irrelevant to External mode and we may add "skip_if" decorator
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.
done