Skip to content

Commit cea1985

Browse files
authored
Fix k8s node join time not enough issue (sonic-net#20141)
What is the motivation for this PR? It's an improvement for testbed vms75-t0-7050cx3-1. For this SKU, the kubelet needs more time(around 70s) to join the minikube cluster. How did you do it? Increased the wait time for joining node to cluster. How did you verify/test it? Run this test in testbed vms75-t0-7050cx3-1 to see if it passes.
1 parent a72027b commit cea1985

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

tests/kubesonic/test_k8s_join_disjoin.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,13 @@ def trigger_join_and_check(duthost, vmhost):
361361
logger.info("Start to join duthost to k8s cluster and check the status")
362362
duthost.shell(f"sudo config kube server ip {vmhost.mgmt_ip}")
363363
duthost.shell("sudo config kube server disable off")
364-
time.sleep(60)
365-
nodes = vmhost.shell(f"{NO_PROXY} minikube kubectl -- get nodes {duthost.hostname}", module_ignore_errors=True)
366-
pytest_assert(duthost.hostname in nodes["stdout"], "Failed to join duthost to k8s cluster")
367-
pytest_assert("NotReady" not in nodes["stdout"], "The status of duthost in k8s cluster is not ready")
368-
logger.info(f"Successfully joined duthost {duthost.hostname} to k8s cluster")
364+
for _ in range(12):
365+
time.sleep(10)
366+
nodes = vmhost.shell(f"{NO_PROXY} minikube kubectl -- get nodes {duthost.hostname}", module_ignore_errors=True)
367+
if duthost.hostname in nodes["stdout"] and "NotReady" not in nodes["stdout"]:
368+
logger.info("Duthost is successfully joined to k8s cluster")
369+
return
370+
pytest_assert(False, "Failed to join duthost to k8s cluster")
369371

370372

371373
def trigger_disjoin_and_check(duthost, vmhost):

0 commit comments

Comments
 (0)