diff --git a/README.md b/README.md index b93ff39..4b4fa07 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,15 @@ No modules. |------|------| | [helm_release.materialize_operator](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.metrics_server](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.openebs](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [kubernetes_job.db_init_job](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/job) | resource | | [kubernetes_manifest.materialize_instances](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource | | [kubernetes_namespace.instance_namespaces](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_namespace.materialize](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_namespace.monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.openebs](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_secret.materialize_backends](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_resource.materialize_instances](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/resource) | data source | ## Inputs @@ -69,10 +72,13 @@ No modules. | [helm\_repository](#input\_helm\_repository) | Repository URL for the Materialize operator Helm chart. Leave empty if using local chart. | `string` | `"https://materializeinc.github.io/materialize/"` | no | | [helm\_values](#input\_helm\_values) | Values to pass to the Helm chart | `any` | n/a | yes | | [install\_metrics\_server](#input\_install\_metrics\_server) | Whether to install the metrics-server | `bool` | `true` | no | -| [instances](#input\_instances) | Configuration for Materialize instances |
list(object({
name = string
namespace = optional(string)
create_database = optional(bool, true)
database_name = string
metadata_backend_url = string
persist_backend_url = string
environmentd_version = optional(string, "v0.130.4")
cpu_request = optional(string, "1")
memory_request = optional(string, "1Gi")
memory_limit = optional(string, "1Gi")
in_place_rollout = optional(bool, true)
request_rollout = optional(string, "00000000-0000-0000-0000-000000000000")
force_rollout = optional(string, "00000000-0000-0000-0000-000000000000")
balancer_memory_request = optional(string, "256Mi")
balancer_memory_limit = optional(string, "256Mi")
balancer_cpu_request = optional(string, "100m")
}))
| `[]` | no | +| [install\_openebs](#input\_install\_openebs) | Whether to install OpenEBS for NVMe storage | `bool` | `false` | no | +| [instances](#input\_instances) | Configuration for Materialize instances |
list(object({
name = string
namespace = optional(string)
create_database = optional(bool, true)
database_name = string
metadata_backend_url = string
persist_backend_url = string
environmentd_version = optional(string, "v0.130.4")
cpu_request = optional(string, "1")
memory_request = optional(string, "1Gi")
memory_limit = optional(string, "1Gi")
in_place_rollout = optional(bool, true)
request_rollout = optional(string, "00000000-0000-0000-0000-000000000001")
force_rollout = optional(string, "00000000-0000-0000-0000-000000000001")
balancer_memory_request = optional(string, "256Mi")
balancer_memory_limit = optional(string, "256Mi")
balancer_cpu_request = optional(string, "100m")
}))
| `[]` | no | | [metrics\_server\_version](#input\_metrics\_server\_version) | Version of metrics-server to install | `string` | `"3.12.2"` | no | | [monitoring\_namespace](#input\_monitoring\_namespace) | Namespace for monitoring resources | `string` | `"monitoring"` | no | | [namespace](#input\_namespace) | Namespace prefix for all resources | `string` | n/a | yes | +| [openebs\_namespace](#input\_openebs\_namespace) | Namespace for OpenEBS components | `string` | `"openebs"` | no | +| [openebs\_version](#input\_openebs\_version) | Version of OpenEBS Helm chart to install | `string` | `"4.2.0"` | no | | [operator\_namespace](#input\_operator\_namespace) | Namespace for the Materialize operator | `string` | `"materialize"` | no | | [operator\_version](#input\_operator\_version) | Version of the Materialize operator to install | `string` | `"v25.1.2"` | no | | [postgres\_version](#input\_postgres\_version) | Postgres version to use for the metadata backend | `string` | `"15"` | no | @@ -82,7 +88,10 @@ No modules. | Name | Description | |------|-------------| +| [materialize\_instance\_resource\_ids](#output\_materialize\_instance\_resource\_ids) | Resource IDs of created Materialize instances | | [materialize\_instances](#output\_materialize\_instances) | Details of created Materialize instances | +| [openebs\_enabled](#output\_openebs\_enabled) | Whether OpenEBS is enabled | +| [openebs\_namespace](#output\_openebs\_namespace) | Namespace where OpenEBS is installed | | [operator\_namespace](#output\_operator\_namespace) | Namespace where the operator is installed | | [operator\_release\_name](#output\_operator\_release\_name) | Helm release name of the operator | | [operator\_release\_status](#output\_operator\_release\_status) | Status of the helm release | diff --git a/main.tf b/main.tf index 8fb535e..ebc21dd 100644 --- a/main.tf +++ b/main.tf @@ -223,3 +223,29 @@ resource "helm_release" "metrics_server" { depends_on = [kubernetes_namespace.monitoring] } + +# Install OpenEBS for lgalloc support +resource "kubernetes_namespace" "openebs" { + count = var.install_openebs ? 1 : 0 + + metadata { + name = var.openebs_namespace + } +} + +resource "helm_release" "openebs" { + count = var.install_openebs ? 1 : 0 + + name = "openebs" + namespace = kubernetes_namespace.openebs[0].metadata[0].name + repository = "https://openebs.github.io/openebs" + chart = "openebs" + version = var.openebs_version + + set { + name = "engines.replicated.mayastor.enabled" + value = "false" + } + + depends_on = [kubernetes_namespace.openebs] +} diff --git a/outputs.tf b/outputs.tf index 2643572..c99137a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -29,3 +29,13 @@ output "materialize_instance_resource_ids" { for name, instance in data.kubernetes_resource.materialize_instances : name => instance.object.status.resourceId } } + +output "openebs_enabled" { + description = "Whether OpenEBS is enabled" + value = var.install_openebs +} + +output "openebs_namespace" { + description = "Namespace where OpenEBS is installed" + value = var.install_openebs ? var.openebs_namespace : null +} diff --git a/variables.tf b/variables.tf index b7f86dc..1c1d88e 100644 --- a/variables.tf +++ b/variables.tf @@ -43,6 +43,7 @@ variable "operator_namespace" { default = "materialize" } +# Monitoring configuration variable "monitoring_namespace" { description = "Namespace for monitoring resources" type = string @@ -61,6 +62,26 @@ variable "install_metrics_server" { default = true } +# OpenEBS configuration +variable "install_openebs" { + description = "Whether to install OpenEBS for NVMe storage" + type = bool + default = false +} + +variable "openebs_namespace" { + description = "Namespace for OpenEBS components" + type = string + default = "openebs" +} + +variable "openebs_version" { + description = "Version of OpenEBS Helm chart to install" + type = string + default = "4.2.0" +} + +# Materialize instance configuration variable "instances" { description = "Configuration for Materialize instances" type = list(object({