def get_libvirt_nodes_from_tf_state(network_names: Union[List[str],
                                                         Tuple[str]],
                                    tf_state):
    nodes = utils.extract_nodes_from_tf_state(tf_state, network_names,
                                              consts.NodeRoles.MASTER)
    nodes.update(
        utils.extract_nodes_from_tf_state(tf_state, network_names,
                                          consts.NodeRoles.WORKER))
    return nodes
Exemple #2
0
def set_hostnames_from_tf(client, cluster_id, tf_folder, network_name):
    tf = terraform_utils.TerraformUtils(working_dir=tf_folder)
    libvirt_nodes = utils.extract_nodes_from_tf_state(tf.get_state(),
                                                      network_name,
                                                      consts.NodeRoles.WORKER)
    utils.update_hosts(client,
                       cluster_id,
                       libvirt_nodes,
                       update_roles=False,
                       update_hostnames=True)
Exemple #3
0
def set_nodes_hostnames_if_needed(client, tf_folder,
                                  with_static_network_config, has_ipv_6,
                                  network_name, cluster_id):
    if has_ipv_6 or with_static_network_config:
        tf = terraform_utils.TerraformUtils(working_dir=tf_folder)
        libvirt_nodes = utils.extract_nodes_from_tf_state(
            tf.get_state(), network_name, consts.NodeRoles.WORKER)
        log.info(
            "Set hostnames of day2 cluster %s in case of static network configuration or "
            "to work around libvirt for Terrafrom not setting hostnames of IPv6 hosts",
            cluster_id)
        utils.update_hosts(client,
                           cluster_id,
                           libvirt_nodes,
                           update_roles=False,
                           update_hostnames=True)