def _create_exports_configmap(exports_map): """Create config map of files from fuel-ccp-repo/exports dirs.""" exported_files_content = {} for key in exports_map: exported_files_content[key] = exports_map[key]['body'] serialized = templates.serialize_configmap(templates.EXPORTS_CONFIG, exported_files_content) return kubernetes.process_object(serialized)
def _create_exports_configmap(exports_map): """Create config map of files from fuel-ccp-repo/exports dirs.""" exported_files_content = {} for key in exports_map: exported_files_content[key] = exports_map[key]['body'] serialized = templates.serialize_configmap(templates.EXPORTS_CONFIG, exported_files_content) return kubernetes.process_object(serialized)
def _create_meta_configmap(service): configmap_name = "%s-%s" % (service["name"], templates.META_CONFIG) data = { templates.META_CONFIG: json.dumps( {"service-name": service["name"], "host-net": service.get("hostNetwork", False)}, sort_keys=True) } template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_meta_configmap(service): configmap_name = "%s-%s" % (service["name"], templates.META_CONFIG) data = { templates.META_CONFIG: json.dumps( {"service-name": service["name"], "host-net": service.get("hostNetwork", False)}, sort_keys=True) } template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_files_configmap(service_name, files, macros_imports): configmap_name = "%s-%s" % (service_name, templates.FILES_CONFIG) data = {} if files: for filename, f in files.items(): with open(f["content"], "r") as f: data[filename] = macros_imports + f.read() data["placeholder"] = "" template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_meta_configmap(service): configmap_name = "%s-%s" % (service["name"], templates.META_CONFIG) data = { templates.META_CONFIG: yaml.dump( {"service-name": service["name"], "host-net": service.get("host-net", False)}) } template = templates.serialize_configmap(configmap_name, data) kubernetes.handle_exists( kubernetes.create_object_from_definition, template)
def _create_files_configmap(service_name, files, macros_imports): configmap_name = "%s-%s" % (service_name, templates.FILES_CONFIG) data = {} if files: for filename, f in files.items(): with open(f["content"], "r") as f: data[filename] = macros_imports + f.read() data["placeholder"] = "" template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_configmap(self): data = { "config": CONF.configs._json(sort_keys=True), "nodes-config": utils.get_nodes_config(CONF.nodes), "workflow": self._get_workflow() } data.update(self._get_file_templates()) cm = templates.serialize_configmap(self.k8s_name, data) kubernetes.process_object(cm)
def _create_files_configmap(service_dir, service_name, files): configmap_name = "%s-%s" % (service_name, templates.FILES_CONFIG) data = {} if files: for filename, f in files.items(): with open(os.path.join( service_dir, "files", f["content"]), "r") as f: data[filename] = f.read() data["placeholder"] = "" template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_files_configmap(service_dir, service_name, configs): configmap_name = "%s-%s" % (service_name, templates.FILES_CONFIG) data = {} if configs: for filename, f in configs.items(): with open(os.path.join( service_dir, "files", f["content"]), "r") as f: data[filename] = f.read() data["placeholder"] = "" template = templates.serialize_configmap(configmap_name, data) kubernetes.handle_exists( kubernetes.create_object_from_definition, template)
def _create_configmap(self): CONF.configs._update(action_parameters=self._get_custom_parameters()) data = { "config": CONF.configs._json(sort_keys=True), "secret-config": CONF.secret_configs._json(sort_keys=True), "nodes-config": utils.get_nodes_config(CONF.nodes), "workflow": self._get_workflow() } data.update(self._get_file_templates()) cm = templates.serialize_configmap(self.k8s_name, data) kubernetes.process_object(cm)
def _create_start_script_configmap(): start_scr_path = os.path.join(CONF.repositories.path, "fuel-ccp-entrypoint", "fuel_ccp_entrypoint", "start_script.py") with open(start_scr_path) as f: start_scr_data = f.read() data = { templates.SCRIPT_CONFIG: start_scr_data } cm = templates.serialize_configmap(templates.SCRIPT_CONFIG, data) return kubernetes.process_object(cm)
def _create_start_script_configmap(): start_scr_path = os.path.join(CONF.repositories.path, "fuel-ccp-entrypoint", "ms_ext_config", "start_script.py") with open(start_scr_path) as f: start_scr_data = f.read() data = { templates.SCRIPT_CONFIG: start_scr_data } cm = templates.serialize_configmap(templates.SCRIPT_CONFIG, data) kubernetes.handle_exists(kubernetes.create_object_from_definition, cm)
def _create_service_configmap(service_name, service_config): configmap_name = "%s-%s" % (service_name, templates.SERVICE_CONFIG) data = {templates.SERVICE_CONFIG: service_config._json(sort_keys=True)} template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_workflow(workflow, name): configmap_name = "%s-%s" % (name, templates.ROLE_CONFIG) template = templates.serialize_configmap(configmap_name, workflow) kubernetes.handle_exists( kubernetes.create_object_from_definition, template)
def create_start_script_configmap(): data = {templates.SCRIPT_CONFIG: get_start_script()} cm = templates.serialize_configmap(templates.SCRIPT_CONFIG, data) return kubernetes.process_object(cm)
def _create_service_configmap(service_name, service_config): configmap_name = "%s-%s" % (service_name, templates.SERVICE_CONFIG) data = {templates.SERVICE_CONFIG: service_config._json(sort_keys=True)} template = templates.serialize_configmap(configmap_name, data) return kubernetes.process_object(template)
def _create_nodes_configmap(nodes): nodes_config = utils.get_nodes_config(nodes) data = {templates.NODES_CONFIG: nodes_config} cm = templates.serialize_configmap(templates.NODES_CONFIG, data) return kubernetes.process_object(cm)
def _create_globals_configmap(config): data = {templates.GLOBAL_CONFIG: config._json(sort_keys=True)} cm = templates.serialize_configmap(templates.GLOBAL_CONFIG, data) return kubernetes.process_object(cm)
def _create_workflow(workflow, name): configmap_name = "%s-%s" % (name, templates.ROLE_CONFIG) template = templates.serialize_configmap(configmap_name, workflow) return kubernetes.process_object(template)
def _create_workflow(workflow, name): configmap_name = "%s-%s" % (name, templates.ROLE_CONFIG) template = templates.serialize_configmap(configmap_name, workflow) return kubernetes.process_object(template)
def _create_globals_configmap(config): data = {templates.GLOBAL_CONFIG: config._json(sort_keys=True)} cm = templates.serialize_configmap(templates.GLOBAL_CONFIG, data) return kubernetes.process_object(cm)
def create_start_script_configmap(): data = { templates.SCRIPT_CONFIG: get_start_script() } cm = templates.serialize_configmap(templates.SCRIPT_CONFIG, data) return kubernetes.process_object(cm)
def _create_globals_configmap(config): data = { templates.GLOBAL_CONFIG: yaml.dump(config) } cm = templates.serialize_configmap(templates.GLOBAL_CONFIG, data) kubernetes.handle_exists(kubernetes.create_object_from_definition, cm)
def _create_nodes_configmap(nodes): nodes_config = utils.get_nodes_config(nodes) data = {templates.NODES_CONFIG: nodes_config} cm = templates.serialize_configmap(templates.NODES_CONFIG, data) return kubernetes.process_object(cm)