Skip to content

Commit 50cf91a

Browse files
authored
Disable SSL verification for IBM node scenarios and fix node reboot s… (#861)
* Disable SSL verification for IBM node scenarios and fix node reboot scenario Signed-off-by: Sahil Shah <sahshah@redhat.com> * adding disable ssl as a scenario parameter for ibmcloud Signed-off-by: Sahil Shah <sahshah@redhat.com> --------- Signed-off-by: Sahil Shah <sahshah@redhat.com>
1 parent 11069c6 commit 50cf91a

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

krkn/scenario_plugins/node_actions/ibmcloud_node_scenarios.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,25 @@ def __init__(self):
3636
self.service = VpcV1(authenticator=authenticator)
3737

3838
self.service.set_service_url(service_url)
39+
3940
except Exception as e:
4041
logging.error("error authenticating" + str(e))
4142

42-
43+
def configure_ssl_verification(self, disable_ssl_verification):
44+
"""
45+
Configure SSL verification for IBM Cloud VPC service.
46+
47+
Args:
48+
disable_ssl_verification: If True, disables SSL verification.
49+
"""
50+
logging.info(f"Configuring SSL verification: disable_ssl_verification={disable_ssl_verification}")
51+
if disable_ssl_verification:
52+
self.service.set_disable_ssl_verification(True)
53+
logging.info("SSL verification disabled for IBM Cloud VPC service")
54+
else:
55+
self.service.set_disable_ssl_verification(False)
56+
logging.info("SSL verification enabled for IBM Cloud VPC service")
57+
4358
# Get the instance ID of the node
4459
def get_instance_id(self, node_name):
4560
node_list = self.list_instances()
@@ -260,9 +275,13 @@ def wait_until_rebooted(self, instance_id, timeout, affected_node):
260275

261276
@dataclass
262277
class ibm_node_scenarios(abstract_node_scenarios):
263-
def __init__(self, kubecli: KrknKubernetes, node_action_kube_check: bool, affected_nodes_status: AffectedNodeStatus):
278+
def __init__(self, kubecli: KrknKubernetes, node_action_kube_check: bool, affected_nodes_status: AffectedNodeStatus, disable_ssl_verification: bool):
264279
super().__init__(kubecli, node_action_kube_check, affected_nodes_status)
265280
self.ibmcloud = IbmCloud()
281+
282+
# Configure SSL verification
283+
self.ibmcloud.configure_ssl_verification(disable_ssl_verification)
284+
266285
self.node_action_kube_check = node_action_kube_check
267286

268287
def node_start_scenario(self, instance_kill_count, node, timeout):
@@ -327,7 +346,7 @@ def node_reboot_scenario(self, instance_kill_count, node, timeout):
327346
logging.info("Starting node_reboot_scenario injection")
328347
logging.info("Rebooting the node %s " % (node))
329348
self.ibmcloud.reboot_instances(instance_id)
330-
self.ibmcloud.wait_until_rebooted(instance_id, timeout)
349+
self.ibmcloud.wait_until_rebooted(instance_id, timeout, affected_node)
331350
if self.node_action_kube_check:
332351
nodeaction.wait_for_unknown_status(
333352
node, timeout, affected_node

krkn/scenario_plugins/node_actions/node_actions_scenario_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def get_node_scenario_object(self, node_scenario, kubecli: KrknKubernetes):
120120
node_scenario["cloud_type"].lower() == "ibm"
121121
or node_scenario["cloud_type"].lower() == "ibmcloud"
122122
):
123-
return ibm_node_scenarios(kubecli, node_action_kube_check, affected_nodes_status)
123+
disable_ssl_verification = get_yaml_item_value(node_scenario, "disable_ssl_verification", True)
124+
return ibm_node_scenarios(kubecli, node_action_kube_check, affected_nodes_status, disable_ssl_verification)
124125
else:
125126
logging.error(
126127
"Cloud type "

scenarios/openshift/ibmcloud_node_scenarios.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ node_scenarios:
77
timeout: 360
88
duration: 120
99
cloud_type: ibm
10+
disable_ssl_verification: true # Set to true for CI environments with certificate issues
1011
- actions:
1112
- node_reboot_scenario
1213
node_name:
1314
label_selector: node-role.kubernetes.io/worker
1415
instance_count: 1
1516
timeout: 120
16-
cloud_type: ibm
17+
cloud_type: ibm
18+
disable_ssl_verification: true # Set to true for CI environments with certificate issues

0 commit comments

Comments
 (0)