cli.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:kubey 作者: bradrf 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号