aws-ia / terraform-aws-mendix-private-cloud

This AWS Partner Solution uses Terraform to deploy a Mendix infrastructure in the AWS Cloud.
Apache License 2.0
11 stars 14 forks source link

Mendix namespace is hardcoded #8

Open ssahadevan-mendix opened 1 year ago

ssahadevan-mendix commented 1 year ago

Enhance to handle variable namespaces and mutiple namespaces if needed. Raised by @atheiman The helm chart seems to assume Mendix will only be registered within one namespace. What would need to change to register multiple namespaces into Mendix? We have found “mendix” namespace hardcoded in a few spots in the helm chart and tried to change the chart to support deploying to multiple namespaces, but we want your opinions on what needs to be considered before we deploy the helm chart into multiple namespaces using multiple terraform helm_release resources.

carlos-salinas commented 1 year ago

Thanks for sharing this. The hardcoded namespace is by design. This project is meant to ease the try out of Mendix on an EKS environment, automating any resource-related configuration at expense of certain rigidity as you noticed. Nevertheless, you can install another namespaces following the regular steps of Mendix for Private Cloud. Bear in mind, adding more than three app environments - already preconfigured - might degrade the overall performance as warned in the documentation:

If you're deploying more than three apps, change the default instance type of the eks_node_instance_type variable. By default, the instance type for the Kubernetes nodes is optimized to support up to three apps. Deploying more than three apps with the default instance type may affect the performance of your applications. For more information, refer to Choosing an Amazon EC2 instance type in the Amazon EKS User Guide.

We may change the scope of this project in the future, adding more capabilities and flexibility, attending customer's feedback. And we will update the documentation accordingly.

geoffreyme commented 1 year ago

Hello and thanks for this feedback. As mentioned by @carlos-salinas, the mendix namespace is hardcoded by design, but if this is a feature request it is possible to add a variable to be able to change the default namespace name, or even add the possibility to use multiple namespaces. It will require a little refactoring though, but we can imagine using a list object variable with all the necessary parameters :

variable "namespaces" {
  type = list(object({
    namespace_name = string
    cluster_id = string
    cluster_secret = string
    environments_internal_names = list(string)
  }))

  default = [
    {
      namespace_name = "mendix"
      environments_internal_names = ["app1", "app2"]
      cluster_id                   = "cluster_id"
      cluster_secret               = "cluster_secret"
    }
  ]
}

And move the mendix_installer helm_release resource to a dedicated module :

 module "mendix_installer" {
  for_each = {
    for namespace in var.namespaces:  namespace.namespace_name => namespace
  }

  source         = "./modules/mendix-installer"
  [...]
  environments_internal_names  = each.value.environments_internal_names
  namespace                    = each.value.namespace_name
}