Пример #1
0
def launch_multus_cni(k8s_conf):
    """
    This function is used to launch multus cni
    """
    logger.info('EXECUTING MULTUS CNI PLAY')
    networking_plugin = config_utils.get_networking_plugin(k8s_conf)
    master_ips = config_utils.get_master_node_ips(k8s_conf)
    minion_ips = config_utils.get_minion_node_ips(k8s_conf)
    ips = master_ips
    for minion_ip in minion_ips:
        ips.append(minion_ip)

    ansible_utils.apply_playbook(
        consts.K8_MULTUS_NODE_BIN,
        ips,
        config_utils.get_node_user(k8s_conf),
        variables=config_utils.get_kubespray_proxy_dict(k8s_conf))

    ips = config_utils.get_minion_node_ips(k8s_conf)
    ansible_utils.apply_playbook(
        consts.K8_MULTUS_SET_NODE,
        ips,
        config_utils.get_node_user(k8s_conf),
        variables={
            'networking_plugin': networking_plugin,
            'PROJ_ARTIFACT_DIR':
            config_utils.get_project_artifact_dir(k8s_conf),
            'KUBERNETES_PATH': consts.NODE_K8S_PATH,
        })
Пример #2
0
 def test_get_master_node_ips(self):
     """
     Ensures the IP address of all configured master hosts are properly parsed
     """
     master_node_ips = config_utils.get_master_node_ips(self.config)
     master_node_ips_cfg = list()
     for node in self.node_list:
         if node[consts.HOST_KEY][
                 consts.NODE_TYPE_KEY] == consts.NODE_TYPE_MASTER:
             master_node_ips_cfg.append(
                 node[consts.HOST_KEY][consts.IP_KEY])
     self.assertEqual(master_node_ips_cfg, master_node_ips)
def __launch_ha_loadbalancer(k8s_conf):
    """
    function used to call launch_load_balancer
    :param k8s_conf: the config dict object
    :return:
    """
    if config_utils.get_ha_config(k8s_conf):
        loadbalancer_dict = config_utils.get_loadbalancer_dict(k8s_conf)
        lb_port = loadbalancer_dict.get("port")
        master_ip_list = config_utils.get_master_node_ips(k8s_conf)
        pb_vars = {
            'MASTER_IP_LIST': str(master_ip_list),
            'lb_port': lb_port,
        }
        pb_vars.update(config_utils.get_proxy_dict(k8s_conf))
        ansible_utils.apply_playbook(
            consts.K8_HA_EXT_LB, [loadbalancer_dict.get(consts.IP_KEY)],
            consts.NODE_USER, variables=pb_vars)