示例#1
0
文件: deploy.py 项目: sipb/homeworld
def launch_spec_direct(
        path):  # TODO: add a flag that enables this instead of launch_spec
    with tempfile.TemporaryDirectory() as d:
        specfile = os.path.join(d, "spec.yaml")
        util.writefile(specfile,
                       configuration.get_single_kube_spec(path).encode())
        access.call_kubectl(["apply", "-f", specfile], return_result=False)
示例#2
0
def launch_spec(spec_name):
    config = configuration.get_config()
    spec = configuration.get_single_kube_spec(spec_name).encode()
    for node in config.nodes:
        if node.kind == "supervisor":
            ssh.check_ssh(node, "mkdir", "-p", DEPLOYQUEUE)
            ssh.upload_bytes(
                node, spec,
                "%s/%d.%s" % (DEPLOYQUEUE, int(time.time()), spec_name))
            print("Uploaded spec to deployqueue.")
示例#3
0
文件: deploy.py 项目: sipb/homeworld
def launch_spec(path, extra_kvs: dict = None, export=False):
    config = configuration.get_config()
    spec = configuration.get_single_kube_spec(path, extra_kvs).encode()
    assert path[:2] == '//'
    yamlname = path[2:].replace(":", "-")
    if export:
        util.writefile(yamlname, spec)
    else:
        for node in config.nodes:
            if node.kind == "supervisor":
                ssh.check_ssh(node, "mkdir", "-p", DEPLOYQUEUE)
                ssh.upload_bytes(
                    node, spec,
                    "%s/%f.%s" % (DEPLOYQUEUE, time.time(), yamlname))
                print("Uploaded spec to deployqueue.")
示例#4
0
def launch_spec(spec_name):
    with tempfile.TemporaryDirectory() as d:
        specfile = os.path.join(d, "spec.yaml")
        util.writefile(specfile, configuration.get_single_kube_spec(spec_name).encode())
        access.call_kubectl(["apply", "-f", specfile], return_result=False)