示例#1
0
文件: seq.py 项目: sipb/homeworld
def sequence_keysystem(ops: command.Operations,
                       skip_verify_keygateway: bool = False) -> None:
    "set up and verify functionality of the keyserver and keygateway"
    ops.add_command(
        iterative_verifier(verify.check_supervisor_accessible, 30.0))
    ops.add_subcommand(setup.setup_keyserver)
    ops.add_command(iterative_verifier(verify.check_keystatics, 60.0))
    ops.add_subcommand(setup.admit_keyserver)
    if configuration.get_config().is_kerberos_enabled():
        ops.add_subcommand(setup.setup_keygateway)
        if not skip_verify_keygateway:
            ops.add_command(verify.check_keygateway)
        else:
            ops.add_operation("skip keygateway verification", lambda: None)
    else:
        ops.add_operation("skip keygateway enablement (kerberos is disabled)",
                          lambda: None)
示例#2
0
def auto_install(ops: command.Operations,
                 authorized_key=None,
                 persistent: bool = False,
                 cdrom_install: bool = False,
                 debug_qemu: bool = False):
    "complete cluster installation and launch"
    if authorized_key is None:
        if "HOME" not in os.environ:
            command.fail(
                "expected $HOME to be set for authorized_key autodetect")
        authorized_key = os.path.join(os.getenv("HOME"), ".ssh/id_rsa.pub")
    project, config = configuration.get_project(), configuration.get_config()
    iso_path = os.path.join(project, "cluster-%d.iso" % os.getpid())
    ops.add_operation("check nested virtualization", qemu_check_nested_virt)
    ops.add_operation("update known hosts", access.update_known_hosts)
    ops.add_operation("generate ISO",
                      lambda: iso.gen_iso(iso_path, authorized_key, "serial"))
    with ops.context("networking", net_context()):
        with ops.context("termination", TerminationContext()) as tc:
            with ops.context("debug shell", DebugContext(persistent)):
                ops.add_subcommand(auto_install_supervisor,
                                   tc,
                                   config.keyserver,
                                   iso_path,
                                   cdrom_install=cdrom_install,
                                   debug_qemu=debug_qemu)
                ops.add_subcommand(auto_launch_supervisor,
                                   tc,
                                   config.keyserver,
                                   debug_qemu=debug_qemu)
                ops.add_subcommand(seq.sequence_supervisor)

                other_nodes = [
                    n for n in config.nodes if n != config.keyserver
                ]
                ops.add_subcommand(auto_install_nodes,
                                   tc,
                                   other_nodes,
                                   iso_path,
                                   cdrom_install=cdrom_install,
                                   debug_qemu=debug_qemu)
                ops.add_subcommand(auto_launch_nodes,
                                   tc,
                                   other_nodes,
                                   debug_qemu=debug_qemu)

                ops.add_subcommand(seq.sequence_cluster)
示例#3
0
文件: seq.py 项目: sipb/homeworld
def sequence_supervisor(ops: command.Operations,
                        skip_verify_keygateway: bool = False) -> None:
    "set up and verify functionality of entire supervisor node (keysystem + ssh)"
    config = configuration.get_config()
    ops.add_subcommand(sequence_keysystem,
                       skip_verify_keygateway=skip_verify_keygateway)
    ops.add_command(iterative_verifier(verify.check_certs_on_supervisor, 20.0))
    ops.add_subcommand(setup.setup_prometheus)
    ops.add_subcommand(sequence_ssh)
    ops.add_subcommand(setup.setup_bootstrap_registry)
    ops.add_subcommand(setup.update_registry)

    ops.add_command(deploy.launch_flannel)
    ops.add_command(deploy.launch_dns_addon)
    ops.add_command(deploy.launch_flannel_monitor)
    ops.add_command(deploy.launch_dns_monitor)

    if config.user_grant_domain != '':
        ops.add_command(deploy.launch_user_grant)
    else:
        ops.add_operation("skip pre-deploying user-grant (not configured)",
                          lambda: None)

    for node in config.nodes:
        if node.kind == 'supervisor':
            ops.add_subcommand(infra.infra_sync, node.hostname)
示例#4
0
文件: seq.py 项目: sipb/homeworld
def sequence_ssh(ops: command.Operations) -> None:
    "set up and verify ssh access to the supervisor node"
    ops.add_command(access.access_ssh)
    ops.add_subcommand(setup.setup_supervisor_ssh)
    ops.add_command(iterative_verifier(verify.check_ssh_with_certs, 20.0))