From 5f7b6089b5bb43375d3a462d8841bca4e51ca76c Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 9 Jun 2023 16:58:48 +0100 Subject: [PATCH 1/5] first attempt at regex --- src/aosm/azext_aosm/custom.py | 24 ++----- .../generate_nfd/cnf_nfd_generator.py | 67 ++++++++++++++----- src/aosm/azext_aosm/util/constants.py | 13 ++-- 3 files changed, 64 insertions(+), 40 deletions(-) diff --git a/src/aosm/azext_aosm/custom.py b/src/aosm/azext_aosm/custom.py index ed8e708e9d6..a237180e3e7 100644 --- a/src/aosm/azext_aosm/custom.py +++ b/src/aosm/azext_aosm/custom.py @@ -125,33 +125,17 @@ def publish_definition( """ Publish a generated definition. - :param cmd: :param client: :type client: HybridNetworkManagementClient :param - definition_type: VNF or CNF :param config_ - file: - Path to the config file for the NFDV :param definition_file: Optional path to a - bicep template to deploy, in case the user wants to edit the - built NFDV template. If omitted, the default built NFDV - template will be used. :param parameters_json_ - file: - Optional path to a parameters file for the bicep file, in case - the user wants to edit the built NFDV template. If omitted, - parameters from config will be turned into parameters for the - bicep file :param manifest_ - file: - Optional path to an override bicep template to deploy - manifests :param manifest_parameters_json_ - file: :param cmd: :param client: :type client: HybridNetworkManagementClient :param definition_type: VNF or CNF :param config_file: Path to the config file for the NFDV :param definition_file: Optional path to a bicep template to deploy, in case the - user wants to edit the built NFDV template. If omitted, the default - built NFDV template will be used. + user wants to edit the built NFDV template. + If omitted, the default built NFDV template will be used. :param parameters_json_file: Optional path to a parameters file for the bicep file, - in case the user wants to edit the built NFDV template. If omitted, - parameters from config will be turned into parameters for the bicep file + in case the user wants to edit the built NFDV template. If omitted, + parameters from config will be turned into parameters for the bicep file :param manifest_file: Optional path to an override bicep template to deploy manifests :param manifest_parameters_json_file: Optional path to an override bicep parameters diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py index deb06343879..f7730256026 100644 --- a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -97,18 +97,24 @@ def generate_nfd(self) -> None: # Get all image line matches for files in the chart. # Do this here so we don't have to do it multiple times. + # image_line_matches = self.find_pattern_matches_in_chart( + # helm_package, IMAGE_LINE_REGEX + # ) image_line_matches = self.find_pattern_matches_in_chart( - helm_package, IMAGE_LINE_REGEX + helm_package, IMAGE_LINE_REGEX, "image:" ) - + print("first", image_line_matches) # Generate the NF application configuration for the chart # passed to jinja2 renderer to render bicep template self.nf_application_configurations.append( self.generate_nf_application_config( helm_package, image_line_matches, + # self.find_pattern_matches_in_chart( + # helm_package, IMAGE_PULL_SECRET_LINE_REGEX + # ), self.find_pattern_matches_in_chart( - helm_package, IMAGE_PULL_SECRET_LINE_REGEX + helm_package, IMAGE_PULL_SECRET_LINE_REGEX, "imagePullSecrets:" ), ) ) @@ -288,7 +294,7 @@ def _find_yaml_files(self, directory) -> Iterator[str]: yield os.path.join(root, file) def find_pattern_matches_in_chart( - self, helm_package: HelmPackageConfig, pattern: str + self, helm_package: HelmPackageConfig, pattern: str, start_string: str ) -> List[Tuple[str, ...]]: """ Find pattern matches in Helm chart, using provided REGEX pattern. @@ -298,12 +304,38 @@ def find_pattern_matches_in_chart( """ chart_dir = os.path.join(self._tmp_folder_name, helm_package.name) matches = [] - + path = [] + # name_and_version = () + # for file in self._find_yaml_files(chart_dir): + # with open(file, "r", encoding="UTF-8") as f: + # contents = f.read() + # print(re.findall(pattern, contents)) + # matches += re.findall(pattern, contents) for file in self._find_yaml_files(chart_dir): with open(file, "r", encoding="UTF-8") as f: - contents = f.read() - matches += re.findall(pattern, contents) - + for line in f: + if start_string in line: + print("LINE", start_string, line) + path = re.findall(pattern, line) + # testing splitting regex to get version and name + if start_string == "image:": + # re.findall(r"\/(.*)\:(.*)", line) + + # name_and_version = re.search(r"\/([^\s\/:]+):([^\s\/]+)", line) + name_and_version = re.search(r"\/([^\/]+):([^\/]+)", line) + # name_and_version = re.search(r'/(.+?):[\s"]*([^/)\s"]+)', line) + print("name_and_version", name_and_version) + print("n", name_and_version.group(1)) + print("v", name_and_version.group(2)) + # name = name_and_version[0][0] + # version = name_and_version[0][1] + # print("name", name) + # ( ['image1', 'image2'], 'name', 'version' ) + matches += (path, name_and_version.group(1), name_and_version.group(2)) + print("path", path) + else: + matches += path + print("MATCHES", matches) return matches def get_artifact_list( @@ -351,7 +383,8 @@ def get_chart_mapping_schema( values_schema = os.path.join( self._tmp_folder_name, helm_package.name, "values.schema.json" ) - + print("helm", helm_package.name) + if not os.path.exists(mappings_path): raise InvalidTemplateError( f"ERROR: The helm package '{helm_package.name}' does not have a valid values mappings file. \ @@ -360,8 +393,8 @@ def get_chart_mapping_schema( ) if not os.path.exists(values_schema): raise InvalidTemplateError( - f"ERROR: The helm package '{helm_package.name}' is missing values.schema.json. \ - Please fix this and run the command again." + f"ERROR: The helm package '{helm_package.name}' is missing values.schema.json.\n\ + Please fix this and run the command again." ) with open(mappings_path, "r", encoding="utf-8") as stream: @@ -387,7 +420,11 @@ def find_deploy_params( ) -> Dict[Any, Any]: """Find the deploy parameters in the values.mappings.yaml file and add them to the schema.""" original_schema_nested_dict = schema_nested_dict + # if given a blank mapping file, return empty schema + if nested_dict is None: + return {} for k, v in nested_dict.items(): + # print("k", k) # if value is a string and contains deployParameters. if isinstance(v, str) and re.search(DEPLOYMENT_PARAMETER_MAPPING_REGEX, v): # only add the parameter name (e.g. from {deployParameter.zone} only param = zone) @@ -440,10 +477,10 @@ def get_chart_name_and_version( def generate_parameter_mappings(self, helm_package: HelmPackageConfig) -> str: """Generate parameter mappings for the given helm package.""" - values = os.path.join( - self._tmp_folder_name, helm_package.name, "values.mappings.yaml" - ) - + # values = os.path.join( + # self._tmp_folder_name, helm_package.name, "values.mappings.yaml" + # ) + values = helm_package.path_to_mappings mappings_folder_path = os.path.join(self._tmp_folder_name, CONFIG_MAPPINGS) mappings_filename = f"{helm_package.name}-mappings.json" diff --git a/src/aosm/azext_aosm/util/constants.py b/src/aosm/azext_aosm/util/constants.py index 3ea1f7c25fe..4f036dbe58e 100644 --- a/src/aosm/azext_aosm/util/constants.py +++ b/src/aosm/azext_aosm/util/constants.py @@ -10,7 +10,7 @@ NSD = "nsd" SCHEMA = "schema" -## TODO pk5: clean up these names +# TODO pk5: clean up these names # Names of files used in the repo NSD_DEFINITION_BICEP_SOURCE_TEMPLATE = "nsd_template.bicep" @@ -47,8 +47,11 @@ "type": "object", "properties": {}, } -IMAGE_LINE_REGEX = ( - r"image: \{\{ .Values.(.+?) \}\}/(.+?):(\d+\.\d+\.\d+(-\w+)?(\.\d+)?)" -) -IMAGE_PULL_SECRET_LINE_REGEX = r"imagePullSecrets: \[name: \{\{ .Values.(.+?) \}\}\]" +# IMAGE_LINE_REGEX = ( +# r"image: \{\{ .Values.(.+?) \}\}/(.+?):(\d+\.\d+\.\d+(-\w+)?(\.\d+)?)" +# ) +IMAGE_LINE_REGEX = r".Values\.([^\s})]*)" +# IMAGE_PULL_SECRET_LINE_REGEX = r"imagePullSecrets: \[name: \{\{ .Values.(.+?) \}\}\]" +IMAGE_PULL_SECRET_LINE_REGEX = r".Values\.([^\s})]*)" + DEPLOYMENT_PARAMETER_MAPPING_REGEX = r"\{deployParameters.(.+?)\}" From 4c543678d98fb6fc9be3a9ba68dd9acbd81772f0 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 15 Jun 2023 16:22:59 +0100 Subject: [PATCH 2/5] fixed regex; tested on existing charts and sas charts; committing to not lose prints for testing --- .../generate_nfd/cnf_nfd_generator.py | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py index f7730256026..95bbef47a64 100644 --- a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -97,22 +97,21 @@ def generate_nfd(self) -> None: # Get all image line matches for files in the chart. # Do this here so we don't have to do it multiple times. - # image_line_matches = self.find_pattern_matches_in_chart( - # helm_package, IMAGE_LINE_REGEX - # ) image_line_matches = self.find_pattern_matches_in_chart( helm_package, IMAGE_LINE_REGEX, "image:" ) - print("first", image_line_matches) + + # Creates a flattened list to prevent set error + image_registry_paths = [] + for m in image_line_matches: + image_registry_paths += m[0] + # Generate the NF application configuration for the chart # passed to jinja2 renderer to render bicep template self.nf_application_configurations.append( self.generate_nf_application_config( helm_package, - image_line_matches, - # self.find_pattern_matches_in_chart( - # helm_package, IMAGE_PULL_SECRET_LINE_REGEX - # ), + image_registry_paths, self.find_pattern_matches_in_chart( helm_package, IMAGE_PULL_SECRET_LINE_REGEX, "imagePullSecrets:" ), @@ -121,7 +120,7 @@ def generate_nfd(self) -> None: # Workout the list of artifacts for the chart and # update the list for the NFD with any unique artifacts. chart_artifacts = self.get_artifact_list( - helm_package, set(image_line_matches) + helm_package, image_line_matches ) self.artifacts += [ a for a in chart_artifacts if a not in self.artifacts @@ -264,12 +263,14 @@ def copy_to_output_folder(self) -> None: def generate_nf_application_config( self, helm_package: HelmPackageConfig, - image_line_matches: List[Tuple[str, ...]], + # image_line_matches: List[Tuple[str, ...]], + image_registry_path: List[str], image_pull_secret_line_matches: List[Tuple[str, ...]], ) -> Dict[str, Any]: """Generate NF application config.""" (name, version) = self.get_chart_name_and_version(helm_package) - registryValuesPaths = set({m[0] for m in image_line_matches}) + + registryValuesPaths = set(image_registry_path) imagePullSecretsValuesPaths = set(image_pull_secret_line_matches) return { @@ -318,21 +319,14 @@ def find_pattern_matches_in_chart( print("LINE", start_string, line) path = re.findall(pattern, line) # testing splitting regex to get version and name - if start_string == "image:": - # re.findall(r"\/(.*)\:(.*)", line) - - # name_and_version = re.search(r"\/([^\s\/:]+):([^\s\/]+)", line) - name_and_version = re.search(r"\/([^\/]+):([^\/]+)", line) - # name_and_version = re.search(r'/(.+?):[\s"]*([^/)\s"]+)', line) + if start_string == "image:": + name_and_version = re.search(r"\/([^\s]*):([^\s)\"}]*)", line) print("name_and_version", name_and_version) print("n", name_and_version.group(1)) print("v", name_and_version.group(2)) - # name = name_and_version[0][0] - # version = name_and_version[0][1] - # print("name", name) # ( ['image1', 'image2'], 'name', 'version' ) - matches += (path, name_and_version.group(1), name_and_version.group(2)) - print("path", path) + match = (path, name_and_version.group(1), name_and_version.group(2)) + matches.append(match) else: matches += path print("MATCHES", matches) @@ -356,7 +350,6 @@ def get_artifact_list( "version": chart_version, } artifact_list.append(helm_artifact) - for match in image_line_matches: artifact_list.append( { @@ -383,7 +376,6 @@ def get_chart_mapping_schema( values_schema = os.path.join( self._tmp_folder_name, helm_package.name, "values.schema.json" ) - print("helm", helm_package.name) if not os.path.exists(mappings_path): raise InvalidTemplateError( @@ -424,7 +416,6 @@ def find_deploy_params( if nested_dict is None: return {} for k, v in nested_dict.items(): - # print("k", k) # if value is a string and contains deployParameters. if isinstance(v, str) and re.search(DEPLOYMENT_PARAMETER_MAPPING_REGEX, v): # only add the parameter name (e.g. from {deployParameter.zone} only param = zone) From 70c73460c47b806629942e55be95774f21590bad Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 15 Jun 2023 16:40:04 +0100 Subject: [PATCH 3/5] changed regex constants + tidied --- .../generate_nfd/cnf_nfd_generator.py | 52 +++++++------------ src/aosm/azext_aosm/util/constants.py | 8 +-- 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py index 95bbef47a64..70cba2ec698 100644 --- a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -24,15 +24,14 @@ CNF_MANIFEST_BICEP_TEMPLATE, CNF_MANIFEST_JINJA2_SOURCE_TEMPLATE, DEPLOYMENT_PARAMETER_MAPPING_REGEX, - IMAGE_LINE_REGEX, - IMAGE_PULL_SECRET_LINE_REGEX, + IMAGE_NAME_AND_VERSION_REGEX, + IMAGE_PATH_REGEX, CONFIG_MAPPINGS, SCHEMAS, SCHEMA_PREFIX, DEPLOYMENT_PARAMETERS, ) - logger = get_logger(__name__) @@ -98,13 +97,13 @@ def generate_nfd(self) -> None: # Get all image line matches for files in the chart. # Do this here so we don't have to do it multiple times. image_line_matches = self.find_pattern_matches_in_chart( - helm_package, IMAGE_LINE_REGEX, "image:" + helm_package, "image:" ) - # Creates a flattened list to prevent set error + # Creates a flattened list of image registry paths to prevent set error image_registry_paths = [] - for m in image_line_matches: - image_registry_paths += m[0] + for registry_path in image_line_matches: + image_registry_paths += registry_path[0] # Generate the NF application configuration for the chart # passed to jinja2 renderer to render bicep template @@ -113,7 +112,7 @@ def generate_nfd(self) -> None: helm_package, image_registry_paths, self.find_pattern_matches_in_chart( - helm_package, IMAGE_PULL_SECRET_LINE_REGEX, "imagePullSecrets:" + helm_package, "imagePullSecrets:" ), ) ) @@ -263,23 +262,22 @@ def copy_to_output_folder(self) -> None: def generate_nf_application_config( self, helm_package: HelmPackageConfig, - # image_line_matches: List[Tuple[str, ...]], image_registry_path: List[str], image_pull_secret_line_matches: List[Tuple[str, ...]], ) -> Dict[str, Any]: """Generate NF application config.""" (name, version) = self.get_chart_name_and_version(helm_package) - registryValuesPaths = set(image_registry_path) - imagePullSecretsValuesPaths = set(image_pull_secret_line_matches) + registry_values_paths = set(image_registry_path) + image_pull_secrets_values_paths = set(image_pull_secret_line_matches) return { "name": helm_package.name, "chartName": name, "chartVersion": version, "dependsOnProfile": helm_package.depends_on, - "registryValuesPaths": list(registryValuesPaths), - "imagePullSecretsValuesPaths": list(imagePullSecretsValuesPaths), + "registryValuesPaths": list(registry_values_paths), + "imagePullSecretsValuesPaths": list(image_pull_secrets_values_paths), "valueMappingsPath": self.generate_parameter_mappings(helm_package), } @@ -295,41 +293,29 @@ def _find_yaml_files(self, directory) -> Iterator[str]: yield os.path.join(root, file) def find_pattern_matches_in_chart( - self, helm_package: HelmPackageConfig, pattern: str, start_string: str + self, helm_package: HelmPackageConfig, start_string: str ) -> List[Tuple[str, ...]]: """ Find pattern matches in Helm chart, using provided REGEX pattern. param helm_package: The helm package config. - param pattern: The regex pattern to match. + param start_string: The string to search for, either imagePullSecrets: or image: """ chart_dir = os.path.join(self._tmp_folder_name, helm_package.name) matches = [] path = [] - # name_and_version = () - # for file in self._find_yaml_files(chart_dir): - # with open(file, "r", encoding="UTF-8") as f: - # contents = f.read() - # print(re.findall(pattern, contents)) - # matches += re.findall(pattern, contents) + for file in self._find_yaml_files(chart_dir): with open(file, "r", encoding="UTF-8") as f: for line in f: if start_string in line: - print("LINE", start_string, line) - path = re.findall(pattern, line) - # testing splitting regex to get version and name - if start_string == "image:": - name_and_version = re.search(r"\/([^\s]*):([^\s)\"}]*)", line) - print("name_and_version", name_and_version) - print("n", name_and_version.group(1)) - print("v", name_and_version.group(2)) - # ( ['image1', 'image2'], 'name', 'version' ) - match = (path, name_and_version.group(1), name_and_version.group(2)) - matches.append(match) + path = re.findall(IMAGE_PATH_REGEX, line) + # If "image:", search for chart name and version + if start_string == "image:": + name_and_version = re.search(IMAGE_NAME_AND_VERSION_REGEX, line) + matches.append((path, name_and_version.group(1), name_and_version.group(2))) else: matches += path - print("MATCHES", matches) return matches def get_artifact_list( diff --git a/src/aosm/azext_aosm/util/constants.py b/src/aosm/azext_aosm/util/constants.py index 4f036dbe58e..f760ee3a345 100644 --- a/src/aosm/azext_aosm/util/constants.py +++ b/src/aosm/azext_aosm/util/constants.py @@ -47,11 +47,7 @@ "type": "object", "properties": {}, } -# IMAGE_LINE_REGEX = ( -# r"image: \{\{ .Values.(.+?) \}\}/(.+?):(\d+\.\d+\.\d+(-\w+)?(\.\d+)?)" -# ) -IMAGE_LINE_REGEX = r".Values\.([^\s})]*)" -# IMAGE_PULL_SECRET_LINE_REGEX = r"imagePullSecrets: \[name: \{\{ .Values.(.+?) \}\}\]" -IMAGE_PULL_SECRET_LINE_REGEX = r".Values\.([^\s})]*)" +IMAGE_PATH_REGEX = r".Values\.([^\s})]*)" +IMAGE_NAME_AND_VERSION_REGEX = r"\/([^\s]*):([^\s)\"}]*)" DEPLOYMENT_PARAMETER_MAPPING_REGEX = r"\{deployParameters.(.+?)\}" From 126c68c206e3f5521ec898518854b028580d4e48 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 15 Jun 2023 16:48:02 +0100 Subject: [PATCH 4/5] fixed blankspace --- src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py index 70cba2ec698..cbb51508f58 100644 --- a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -99,7 +99,6 @@ def generate_nfd(self) -> None: image_line_matches = self.find_pattern_matches_in_chart( helm_package, "image:" ) - # Creates a flattened list of image registry paths to prevent set error image_registry_paths = [] for registry_path in image_line_matches: @@ -362,7 +361,6 @@ def get_chart_mapping_schema( values_schema = os.path.join( self._tmp_folder_name, helm_package.name, "values.schema.json" ) - if not os.path.exists(mappings_path): raise InvalidTemplateError( f"ERROR: The helm package '{helm_package.name}' does not have a valid values mappings file. \ From 93fb6afd797c615f96ce89b843316c68bcdf6166 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 15 Jun 2023 17:59:35 +0100 Subject: [PATCH 5/5] markups --- .../generate_nfd/cnf_nfd_generator.py | 18 +++++++++++++----- src/aosm/azext_aosm/util/constants.py | 7 +++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py index 4f300d2763b..f77acd637bf 100644 --- a/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py +++ b/src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py @@ -27,12 +27,12 @@ DEPLOYMENT_PARAMETER_MAPPING_REGEX, IMAGE_NAME_AND_VERSION_REGEX, IMAGE_PATH_REGEX, - CONFIG_MAPPINGS, - SCHEMAS, DEPLOYMENT_PARAMETERS, GENERATED_VALUES_MAPPINGS, SCHEMA_PREFIX, SCHEMAS, + IMAGE_PULL_SECRETS_START_STRING, + IMAGE_START_STRING ) from azext_aosm.util.utils import input_ack @@ -112,7 +112,7 @@ def generate_nfd(self) -> None: # Get all image line matches for files in the chart. # Do this here so we don't have to do it multiple times. image_line_matches = self.find_pattern_matches_in_chart( - helm_package, "image:" + helm_package, IMAGE_START_STRING ) # Creates a flattened list of image registry paths to prevent set error image_registry_paths = [] @@ -126,7 +126,7 @@ def generate_nfd(self) -> None: helm_package, image_registry_paths, self.find_pattern_matches_in_chart( - helm_package, "imagePullSecrets:" + helm_package, IMAGE_PULL_SECRETS_START_STRING ), ) ) @@ -389,6 +389,14 @@ def find_pattern_matches_in_chart( param helm_package: The helm package config. param start_string: The string to search for, either imagePullSecrets: or image: + + If searching for imagePullSecrets, + returns list of lists containing image pull secrets paths, + e.g. Values.foo.bar.imagePullSecret + + If searching for image, + returns list of tuples containing the list of image paths and the name and version of the image. + e.g. (Values.foo.bar.repoPath, foo, 1.2.3) """ chart_dir = os.path.join(self._tmp_folder_name, helm_package.name) matches = [] @@ -400,7 +408,7 @@ def find_pattern_matches_in_chart( if start_string in line: path = re.findall(IMAGE_PATH_REGEX, line) # If "image:", search for chart name and version - if start_string == "image:": + if start_string == IMAGE_START_STRING: name_and_version = re.search(IMAGE_NAME_AND_VERSION_REGEX, line) matches.append((path, name_and_version.group(1), name_and_version.group(2))) else: diff --git a/src/aosm/azext_aosm/util/constants.py b/src/aosm/azext_aosm/util/constants.py index 15ac55d35a9..c5274b8ee93 100644 --- a/src/aosm/azext_aosm/util/constants.py +++ b/src/aosm/azext_aosm/util/constants.py @@ -64,6 +64,13 @@ "properties": {}, } +# For CNF NFD Generator +# To match the image path if image: is present in the yaml file +IMAGE_START_STRING = "image:" IMAGE_PATH_REGEX = r".Values\.([^\s})]*)" + +# To match the image name and version if imagePullSecrets: is present in the yaml file +IMAGE_PULL_SECRETS_START_STRING = "imagePullSecrets:" IMAGE_NAME_AND_VERSION_REGEX = r"\/([^\s]*):([^\s)\"}]*)" + DEPLOYMENT_PARAMETER_MAPPING_REGEX = r"\{deployParameters.(.+?)\}"