Merge pull request #12061 from neoaggelos/feat/external
external: do not enforce need for monitoring endpoint
This commit is contained in:
4 files changed
+65
-15
No files matched your search
@@ -263,3 +263,32 @@ class TestRadosJSON(unittest.TestCase):
|
||||
self.fail("An exception was expected")
|
||||
except ext.ExecutionFailureException as err:
|
||||
print(f"Exception thrown successfully: {err}")
|
||||
|
||||
def test_skip_monitoring_endpoint_no_prometheus(self):
|
||||
cmd_key = '{"format": "json", "prefix": "status"}'
|
||||
cmd_out = self.rjObj.cluster.cmd_output_map[cmd_key]
|
||||
cmd_json_out = json.loads(cmd_out)
|
||||
del cmd_json_out["mgrmap"]["services"]["prometheus"]
|
||||
self.rjObj.cluster.cmd_output_map[cmd_key] = json.dumps(cmd_json_out)
|
||||
|
||||
endpoint, port = self.rjObj.get_active_and_standby_mgrs()
|
||||
if endpoint != "" or port != "":
|
||||
self.fail("Expected monitoring endpoint and port to be empty")
|
||||
|
||||
self.rjObj.main()
|
||||
|
||||
if self.rjObj.out_map["MONITORING_ENDPOINT"] != "":
|
||||
self.fail("MONITORING_ENDPOINT should be empty")
|
||||
|
||||
if self.rjObj.out_map["MONITORING_ENDPOINT_PORT"] != "":
|
||||
self.fail("MONITORING_ENDPOINT_PORT should be empty")
|
||||
|
||||
def test_skip_monitoring_endpoint(self):
|
||||
self.rjObj._arg_parser.skip_monitoring_endpoint = True
|
||||
self.rjObj.main()
|
||||
|
||||
if self.rjObj.out_map["MONITORING_ENDPOINT"] != "":
|
||||
self.fail("MONITORING_ENDPOINT should be empty")
|
||||
|
||||
if self.rjObj.out_map["MONITORING_ENDPOINT_PORT"] != "":
|
||||
self.fail("MONITORING_ENDPOINT_PORT should be empty")
|
||||
@@ -405,6 +405,12 @@ class RadosJSON:
|
||||
required=False,
|
||||
help="Ceph Manager prometheus exporter port",
|
||||
)
|
||||
output_group.add_argument(
|
||||
"--skip-monitoring-endpoint",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Do not check for a monitoring endpoint for the Ceph cluster",
|
||||
)
|
||||
output_group.add_argument(
|
||||
"--rbd-metadata-ec-pool-name",
|
||||
default="",
|
||||
@@ -710,9 +716,7 @@ class RadosJSON:
|
||||
json_out.get("mgrmap", {}).get("services", {}).get("prometheus", "")
|
||||
)
|
||||
if not monitoring_endpoint:
|
||||
raise ExecutionFailureException(
|
||||
"'prometheus' service not found, is the exporter enabled?.\n"
|
||||
)
|
||||
return "", ""
|
||||
# now check the stand-by mgr-s
|
||||
standby_arr = json_out.get("mgrmap", {}).get("standbys", [])
|
||||
for each_standby in standby_arr:
|
||||
@@ -1388,10 +1392,13 @@ class RadosJSON:
|
||||
self.out_map["CSI_CEPHFS_PROVISIONER_SECRET_NAME"],
|
||||
) = self.create_cephCSIKeyring_user("client.csi-cephfs-provisioner")
|
||||
self.out_map["RGW_TLS_CERT"] = ""
|
||||
(
|
||||
self.out_map["MONITORING_ENDPOINT"],
|
||||
self.out_map["MONITORING_ENDPOINT_PORT"],
|
||||
) = self.get_active_and_standby_mgrs()
|
||||
self.out_map["MONITORING_ENDPOINT"] = ""
|
||||
self.out_map["MONITORING_ENDPOINT_PORT"] = ""
|
||||
if not self._arg_parser.skip_monitoring_endpoint:
|
||||
(
|
||||
self.out_map["MONITORING_ENDPOINT"],
|
||||
self.out_map["MONITORING_ENDPOINT_PORT"],
|
||||
) = self.get_active_and_standby_mgrs()
|
||||
self.out_map["RBD_POOL_NAME"] = self._arg_parser.rbd_data_pool_name
|
||||
self.out_map[
|
||||
"RBD_METADATA_EC_POOL_NAME"
|
||||
@@ -1458,16 +1465,24 @@ class RadosJSON:
|
||||
"userKey": self.out_map["ROOK_EXTERNAL_USER_SECRET"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "monitoring-endpoint",
|
||||
"kind": "CephCluster",
|
||||
"data": {
|
||||
"MonitoringEndpoint": self.out_map["MONITORING_ENDPOINT"],
|
||||
"MonitoringPort": self.out_map["MONITORING_ENDPOINT_PORT"],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
# if 'MONITORING_ENDPOINT' exists, then only add 'monitoring-endpoint' to Cluster
|
||||
if (
|
||||
self.out_map["MONITORING_ENDPOINT"]
|
||||
and self.out_map["MONITORING_ENDPOINT_PORT"]
|
||||
):
|
||||
json_out.append(
|
||||
{
|
||||
"name": "monitoring-endpoint",
|
||||
"kind": "CephCluster",
|
||||
"data": {
|
||||
"MonitoringEndpoint": self.out_map["MONITORING_ENDPOINT"],
|
||||
"MonitoringPort": self.out_map["MONITORING_ENDPOINT_PORT"],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
# if 'CSI_RBD_NODE_SECRET' exists, then only add 'rook-csi-rbd-provisioner' Secret
|
||||
if (
|
||||
self.out_map["CSI_RBD_NODE_SECRET"]
|
||||
|
||||
Reference in new issue
Block a user