Beispiel #1
0
    def __write_config_file(self):
        """ Write sanitized yaml file of starting arguments """
        logging.info("Writing arguments to file for Posterity: {}".format(
            self._outfile))
        config = {}

        for key, value in self._data.items():
            if value and key not in self.keys_to_sanitize:
                config[key] = value

        logging.debug(config)
        try:
            write_yaml_file(self._repository_directory + "/" + self._outfile,
                            config)
        except Exception as e:
            logging.debug(traceback.format_exc(e))
            logging.error("Failed to write arguments to file")
            logging.error(e)
Beispiel #2
0
    def __write_config_file(self):
        logging.info("Writing arguments to file for Posterity: {}".format(
            self._outfile))
        config = {}

        if 'output_file' in config:
            config.pop('output_file')

        for key, value in self._args.items():
            if value and key != "aws_access_key" and key != "aws_secret_key":
                config[key] = value

        logging.debug(config)
        try:
            write_yaml_file(self._repository_directory + "/" + self._outfile,
                            config)
        except Exception as e:
            logging.debug(traceback.format_exc(e))
            logging.error("Failed to write arguments to file")
            logging.error(e)
Beispiel #3
0
 def __add_kops_production_cluster(self):
     context = {
         'cluster_name':
         self._production_kubernetes_cluster_name,
         'availability_zones':
         re.sub(" ", "", self._aws_availability_zones).split(","),
         'vpc_id':
         self._vpc_id,
         'ssh_key_path':
         "${{INFRASTRUCTURE_REPO}}/{}/{}.pub".format(
             self._private_path, self._ssh_keys['production_kube_key']),
         'kubernetes_version':
         self._kubernetes_version,
         'ig_max_size':
         self._production_kubernetes_node_count,
         'ig_min_size':
         self._production_kubernetes_node_count,
         'master_availability_zones': [
             zone.strip() for zone in
             self._production_kubernetes_master_aws_zones.split(',')
         ],
         'master_node_type':
         self._production_kubernetes_master_node_type,
         'worker_node_type':
         self._production_kubernetes_worker_node_type,
         'cluster_dns':
         self._production_kubernetes_dns_zone,
         'kubernetes_v_log_level':
         self._production_kubernetes_v_log_level,
         'network_cidr':
         self._production_kubernetes_network_cidr,
         'network_cidr_base':
         self._vpc_cidr_base,
         'kops_state_store_bucket':
         self._infrastructure_bucket,
         'third_octet':
         self._production_third_octet,
     }
     write_yaml_file(
         "{}/inventory/default/clusters/production/vars.yml".format(
             self._repository_directory), context)