Пример #1
0
def delete_nodes_from_cluster(vapp, node_names):
    script = "#!/usr/bin/env bash\n" \
             "kubectl delete node "
    for node_name in node_names:
        script += f' {node_name}'
    script += '\n'
    master_node_names = get_node_names(vapp, NodeType.MASTER)
    result = execute_script_in_nodes(vapp=vapp,
                                     node_names=master_node_names,
                                     script=script,
                                     check_tools=False)
    if result[0][0] != 0:
        raise DeleteNodeError(f"Couldn't delete node(s):"
                              f"\n{result[0][2].content.decode()}")
Пример #2
0
def delete_nodes_from_cluster(config, vapp, template, nodes, force=False):
    script = '#!/usr/bin/env bash\nkubectl delete node '
    for node in nodes:
        script += ' %s' % node
    script += '\n'
    password = template['admin_password']
    master_nodes = get_nodes(vapp, NodeType.MASTER)
    result = execute_script_in_nodes(config,
                                     vapp,
                                     password,
                                     script,
                                     master_nodes,
                                     check_tools=False)
    if result[0][0] != 0:
        if not force:
            raise DeleteNodeError(f"Couldn't delete node(s):\n"
                                  f"{result[0][2].content.decode()}")