dash.py 文件源码

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

项目:kyber 作者: TakumiHQ 项目源码 文件源码
def launch(cfg=None, executor=None):
    if cfg is None:
        from kyber.lib.kube import kube_api
        cfg = kube_api.config
    if executor is None:
        executor = os.execve

    try:
        context = Context()
        click.echo("Opening dashboard for `{}` in `{}`".format(context.name, cfg.namespace))
        url = service_dashboard(cfg, context.name)
    except ContextError:  # fall back to opening the kubernetes dashboard
        click.echo("Not in a kyber context, showing dash for k8s pods in `{}`".format(cfg.namespace))
        url = namespace_dashboard(cfg)

    try:
        executor(get_executable_path('open'), ["open", url], os.environ)
    except Exception as e:
        click.echo("Unable to launch dashboard automatically ({})".format(e.message))
        click.echo("URL: {}".format(url))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号