コード例 #1
0
def validate_node_config_tag(config):
    """
    Checks the presence of node configuration tag
    """
    logger.info("checking node config tag")
    k8s_dict = config_utils.get_k8s_dict(config)
    validate_dict_data(k8s_dict, consts.NODE_CONF_KEY)
コード例 #2
0
def validate_api_ext_loadbalancer_tag_params(config):
    logger.info("checking api_ext_loadbalancer_tag")
    k8s_dict = config_utils.get_k8s_dict(config)
    node_configs = config_utils.get_node_configs(config)
    ha_configs = config_utils.get_ha_config(config)

    for ha_config in ha_configs:
        validate_dict_data(k8s_dict, consts.HA_CONFIG_KEY)
        validate_dict_data(ha_config, consts.HA_API_EXT_LB_KEY)
        ha_lb_conf = ha_config[consts.HA_API_EXT_LB_KEY]
        validate_dict_data(ha_lb_conf, consts.IP_KEY)
        validate_dict_data(node_configs[0], consts.HOST_KEY)

        for node_conf in node_configs:
            if (node_conf.get(consts.HOST_KEY)[consts.IP_KEY] == ha_lb_conf[
                    consts.IP_KEY]):
                raise ValidationException(
                    'Bootstrap ip should never match with the master or node')

        validate_dict_data(ha_lb_conf, consts.USER_KEY)
        validate_dict_data(ha_lb_conf, consts.PASSWORD_KEY)
        validate_dict_data(ha_lb_conf, consts.PORT_KEY)

        ha_lb_port = ha_lb_conf.get(consts.PORT_KEY)
        if not ha_lb_port or ha_lb_port == "" or ha_lb_port == 6443:
            raise ValidationException('Port shoud not be empty or 6443')
コード例 #3
0
def validate_network_tag(config):
    """
    Checks the presence of network tag
    """
    logger.info("checking networks tag")

    k8s_dict = config_utils.get_k8s_dict(config)
    validate_dict_data(k8s_dict, consts.NETWORKS_KEY)
コード例 #4
0
def validate_access_and_security_params(config):
    """
    Checks the presence of access_and_security parameters
    """
    logger.info("checking basic_authentication params")

    sec_params = config_utils.get_k8s_dict(config).get(consts.ACCESS_SEC_KEY)
    if consts.AUTH_KEY in sec_params:
        auth_key = sec_params[consts.AUTH_KEY]
        if (consts.BASIC_AUTH_KEY not in auth_key
                or consts.TOKEN_AUTH_KEY not in auth_key):
            raise ValidationException(
                "Atleast one out of basic_authentication or "
                "token_authentication must be present")
        else:
            return
    else:
        raise ValidationException("authentication is not present")