def webui(obj):
'''List dashboard links for matching pods (if only one matched, URL is opened in browser).'''
kubectl = obj.kubey.kubectl
info = click.unstyle(kubectl.call_capture('cluster-info'))
dash_endpoint = re.search(r'kubernetes-dashboard.*?(http\S+)', info).group(1)
urls = []
for pod in obj.kubey.each_pod(obj.maximum):
pod_path = '/#/pod/{0}/{1}?namespace={0}'.format(pod.namespace, pod.name)
urls.append(dash_endpoint + pod_path)
if len(urls) == 1:
url = urls[0]
click.echo(url)
click.launch(url)
else:
for url in urls:
click.echo(url)
评论列表
文章目录