Skip to content
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

[Backport 1.28-strict] Fix microk8s import images for offline clusters (#4273) #4288

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions scripts/wrappers/distributed_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import json
import socket
import time

from common.cluster.utils import (
get_callback_token,
Expand Down Expand Up @@ -43,12 +44,16 @@ def get_cluster_agent_endpoints(include_self=False):
hostname = socket.gethostname()
token = get_callback_token()

subprocess.check_call(
[MICROK8S_STATUS, "--wait-ready", "--timeout=60"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
stdout = subprocess.check_output([KUBECTL, "get", "node", "-o", "json"])
for attempt in range(10):
try:
stdout = subprocess.check_output([KUBECTL, "get", "node", "-o", "json"])
break
except subprocess.CalledProcessError as e:
print("Failed to list nodes (try {}): {}".format(attempt + 1, e), file=sys.stderr)
if attempt == 9:
raise e
time.sleep(3)

info = json.loads(stdout)
for node_info in info["items"]:
node_ip = get_internal_ip_from_get_node(node_info)
Expand Down