Skip to content

Commit

Permalink
fixed pod conflict issue
Browse files Browse the repository at this point in the history
Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani committed Jan 15, 2024
1 parent b24c209 commit 0033793
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions kraken/time_actions/common_time_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def skew_node(node_name: str, action: str, kubecli: KrknKubernetes):
skew_command.append("2001-01-01")

try:
status_response = kubecli.exec_command_on_node(node_name,status_command,status_pod_name,pod_namespace)
status_response = kubecli.exec_command_on_node(node_name, status_command, status_pod_name, pod_namespace)
if "Network time on: no" in status_response:
ntp_enabled = False

Expand Down Expand Up @@ -272,12 +272,10 @@ def check_date_time(object_type, names, kubecli:KrknKubernetes):
skew_command = "date"
not_reset = []
max_retries = 30
check_pod_name = f"time-skew-pod-{get_random_string(5)}"
if object_type == "node":
for node_name in names:
first_date_time = datetime.datetime.utcnow()
# def skew_node(node_name: str, action: str, kubecli: KrknKubernetes):

check_pod_name = f"time-skew-pod-{get_random_string(5)}"
node_datetime_string = kubecli.exec_command_on_node(node_name, [skew_command], check_pod_name)
node_datetime = string_to_date(node_datetime_string)
counter = 0
Expand All @@ -304,7 +302,7 @@ def check_date_time(object_type, names, kubecli:KrknKubernetes):
logging.info(
"Date in node " + str(node_name) + " reset properly"
)
kubecli.delete_pod(check_pod_name)
kubecli.delete_pod(check_pod_name)

elif object_type == "pod":
for pod_name in names:
Expand Down

0 comments on commit 0033793

Please sign in to comment.