diff --git a/terraform/gitlab/ci-templates/k8s-cluster/.gitlab/scripts/dictmerge.py b/terraform/gitlab/ci-templates/k8s-cluster/.gitlab/scripts/dictmerge.py index dcf5cf2dc..7284bde21 100755 --- a/terraform/gitlab/ci-templates/k8s-cluster/.gitlab/scripts/dictmerge.py +++ b/terraform/gitlab/ci-templates/k8s-cluster/.gitlab/scripts/dictmerge.py @@ -121,13 +121,22 @@ def load_custom_config(custom_config_file): print("Please pass valid parameters usage : dictmerge.py defaultConfigFilePath customConfigFilePath outputPath") exit(1) else: + merged = {} for custom_config_file in custom_config_files: - data1 = dict(mergedicts(data1, load_custom_config(custom_config_file))) + if fileName == "pm4ml-vars.yaml": + data2 = load_custom_config(custom_config_file) + if "pm4mls" not in data2 or len(data2["pm4mls"]) == 0: + print(custom_config_file, " pm4mls is empty, please provide the correct configuration in case if it is a payment manager deployment") + exit(1) + merged = dict(mergedicts(merged, {'pm4mls': {name: dict(mergedicts(data1, pm4ml)) for name, pm4ml in data2['pm4mls'].items()}})) + else: + data1 = dict(mergedicts(data1, load_custom_config(custom_config_file))) + merged = data1 if defaultExt == ".yaml": #result = yaml.dump(dict(data1), indent=4, sort_keys=True) with open(outputFilename, 'w') as file: - yaml.dump(dict(data1), file, indent=4, default_flow_style=False) + yaml.dump(merged, file, indent=4, default_flow_style=False) elif defaultExt == ".json": with open(outputFilename, 'w') as file: - json.dump(dict(data1), file, indent=4) + json.dump(merged, file, indent=4) diff --git a/terraform/gitops/pm4ml/pm4ml.tf b/terraform/gitops/pm4ml/pm4ml.tf index 29e0717ff..fb1ff1c5f 100644 --- a/terraform/gitops/pm4ml/pm4ml.tf +++ b/terraform/gitops/pm4ml/pm4ml.tf @@ -110,27 +110,27 @@ locals { pm4ml_var_map = var.app_var_map - pm4ml_wildcard_gateways = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => pm4ml.pm4ml_ingress_internal_lb ? "internal" : "external" } - - portal_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "portal-${pm4ml.pm4ml}.${var.public_subdomain}" : "portal-${pm4ml.pm4ml}.${var.private_subdomain}" } - admin_portal_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "admin-portal-${pm4ml.pm4ml}.${var.public_subdomain}" : "admin-portal-${pm4ml.pm4ml}.${var.private_subdomain}"} - experience_api_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "exp-${pm4ml.pm4ml}.${var.public_subdomain}" : "exp-${pm4ml.pm4ml}.${var.private_subdomain}"} - mojaloop_connnector_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "conn-${pm4ml.pm4ml}.${var.public_subdomain}" : "conn-${pm4ml.pm4ml}.${var.private_subdomain}" } - test_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "test-${pm4ml.pm4ml}.${var.public_subdomain}" : "test-${pm4ml.pm4ml}.${var.private_subdomain}" } - pm4ml_ttk_frontend_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "ttkfront-${pm4ml.pm4ml}.${var.public_subdomain}" : "ttkfront-${pm4ml.pm4ml}.${var.private_subdomain}" } - pm4ml_ttk_backend_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "ttkback-${pm4ml.pm4ml}.${var.public_subdomain}" : "ttkback-${pm4ml.pm4ml}.${var.private_subdomain}"} - pm4ml_pta_portal_fqdns = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? "pta-portal-${pm4ml.pm4ml}.${var.public_subdomain}" : "pta-portal-${pm4ml.pm4ml}.${var.private_subdomain}"} - - pm4ml_istio_gateway_namespaces = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? var.istio_external_gateway_namespace : var.istio_internal_gateway_namespace } - pm4ml_istio_wildcard_gateway_names = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? var.istio_external_wildcard_gateway_name : var.istio_internal_wildcard_gateway_name } - pm4ml_istio_gateway_names = { for pm4ml in local.pm4ml_var_map : pm4ml.pm4ml => local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external" ? var.istio_external_gateway_name : var.istio_internal_gateway_name } - - pm4ml_internal_wildcard_admin_portal_hosts = [for pm4ml in local.pm4ml_var_map : local.admin_portal_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "internal"] - pm4ml_external_wildcard_admin_portal_hosts = [for pm4ml in local.pm4ml_var_map : local.admin_portal_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external"] - pm4ml_internal_wildcard_portal_hosts = [for pm4ml in local.pm4ml_var_map : local.portal_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "internal"] - pm4ml_external_wildcard_portal_hosts = [for pm4ml in local.pm4ml_var_map : local.portal_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external"] - pm4ml_internal_wildcard_exp_hosts = [for pm4ml in local.pm4ml_var_map : local.experience_api_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "internal"] - pm4ml_external_wildcard_exp_hosts = [for pm4ml in local.pm4ml_var_map : local.experience_api_fqdns[pm4ml.pm4ml] if local.pm4ml_wildcard_gateways[pm4ml.pm4ml] == "external"] + pm4ml_wildcard_gateways = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => pm4ml.pm4ml_ingress_internal_lb ? "internal" : "external" } + + portal_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "portal-${pm4ml_name}.${var.public_subdomain}" : "portal-${pm4ml_name}.${var.private_subdomain}" } + admin_portal_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "admin-portal-${pm4ml_name}.${var.public_subdomain}" : "admin-portal-${pm4ml_name}.${var.private_subdomain}"} + experience_api_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "exp-${pm4ml_name}.${var.public_subdomain}" : "exp-${pm4ml_name}.${var.private_subdomain}"} + mojaloop_connnector_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "conn-${pm4ml_name}.${var.public_subdomain}" : "conn-${pm4ml_name}.${var.private_subdomain}" } + test_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "test-${pm4ml_name}.${var.public_subdomain}" : "test-${pm4ml_name}.${var.private_subdomain}" } + pm4ml_ttk_frontend_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "ttkfront-${pm4ml_name}.${var.public_subdomain}" : "ttkfront-${pm4ml_name}.${var.private_subdomain}" } + pm4ml_ttk_backend_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "ttkback-${pm4ml_name}.${var.public_subdomain}" : "ttkback-${pm4ml_name}.${var.private_subdomain}"} + pm4ml_pta_portal_fqdns = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? "pta-portal-${pm4ml_name}.${var.public_subdomain}" : "pta-portal-${pm4ml_name}.${var.private_subdomain}"} + + pm4ml_istio_gateway_namespaces = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? var.istio_external_gateway_namespace : var.istio_internal_gateway_namespace } + pm4ml_istio_wildcard_gateway_names = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? var.istio_external_wildcard_gateway_name : var.istio_internal_wildcard_gateway_name } + pm4ml_istio_gateway_names = { for pm4ml_name, pm4ml in local.pm4ml_var_map : pm4ml_name => local.pm4ml_wildcard_gateways[pm4ml_name] == "external" ? var.istio_external_gateway_name : var.istio_internal_gateway_name } + + pm4ml_internal_wildcard_admin_portal_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.admin_portal_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "internal"] + pm4ml_external_wildcard_admin_portal_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.admin_portal_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "external"] + pm4ml_internal_wildcard_portal_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.portal_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "internal"] + pm4ml_external_wildcard_portal_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.portal_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "external"] + pm4ml_internal_wildcard_exp_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.experience_api_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "internal"] + pm4ml_external_wildcard_exp_hosts = [for pm4ml_name, pm4ml in local.pm4ml_var_map : local.experience_api_fqdns[pm4ml_name] if local.pm4ml_wildcard_gateways[pm4ml_name] == "external"] } diff --git a/terraform/gitops/stateful-resources/stateful-resources-config.tf b/terraform/gitops/stateful-resources/stateful-resources-config.tf index ba413a1d2..fcd2f580c 100644 --- a/terraform/gitops/stateful-resources/stateful-resources-config.tf +++ b/terraform/gitops/stateful-resources/stateful-resources-config.tf @@ -61,7 +61,7 @@ resource "local_file" "strimzi-crs" { for_each = { for key, stateful_resource in local.strimzi_operator_stateful_resources : key => stateful_resource } content = templatefile("${local.stateful_resources_template_path}/strimzi/kafka/kafka-with-dual-role-nodes.yaml.tpl", { - kafka_cluster_name = "${var.cluster_name}-${each.key}" + kafka_cluster_name = each.key node_pool_name = "${each.key}-nodepool" node_pool_size = each.value.local_operator_config.node_pool_size node_pool_storage_size = each.value.local_operator_config.kafka_data.storage_size