Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ tests/.terraform.lock.hcl
*.env
.envrc
*.bak
venv/
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,55 @@ pip install -r requirements.txt

This will install the required Python packages in a virtual environment.

## Disk Support for Materialize on Azure

This module supports configuring disk support for Materialize on Azure using **local NVMe SSDs** available in specific VM families, along with **OpenEBS** and `lgalloc` for volume management.

### Recommended Azure VM Types with Local NVMe Disks

Materialize benefits from fast ephemeral storage and recommends a **minimum 2:1 disk-to-RAM ratio**. The [Lsv3-series](https://learn.microsoft.com/en-us/azure/virtual-machines/lsv3-series) virtual machines offer high-throughput local NVMe SSD storage and are ideal for performance-intensive workloads.

| VM Size | vCPUs | Memory | NVMe Storage | Disk-to-RAM Ratio |
|------------------|-------|---------|--------------|-------------------|
| Standard\_L8s\_v3 | 8 | 64 GiB | 1,900 GiB | ~29:1 |
| Standard\_L16s\_v3 | 16 | 128 GiB | 3,800 GiB | ~29:1 |
| Standard\_L32s\_v3 | 32 | 256 GiB | 7,600 GiB | ~29:1 |

> [!NOTE]
> These VM types provide **ephemeral local NVMe SSD disks**. Data is lost when the VM is stopped or deleted, so they should only be used for **temporary or performance-critical data** managed by Materialize.

### Enabling Disk Support on Azure

When `enable_disk_support` is set to `true`, the module:

1. Uses a bootstrap container to identify and configure available NVMe disks
1. Sets up **OpenEBS** with `lvm-localpv` to manage the ephemeral disks
1. Creates a StorageClass for Materialize

Example configuration:

```hcl
enable_disk_support = true

aks_config = {
node_count = 2
vm_size = "Standard_L8s_v3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this to one of the Epdsv6-series ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! Good catch!

os_disk_size_gb = 100
min_nodes = 2
max_nodes = 4
}

disk_support_config = {
install_openebs = true
run_disk_setup_script = true
create_storage_class = true

openebs_version = "4.2.0"
openebs_namespace = "openebs"
storage_class_name = "openebs-lvm-instance-store-ext4"
}
```

## Requirements

| Name | Version |
Expand Down Expand Up @@ -100,11 +149,14 @@ No resources.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_aks_config"></a> [aks\_config](#input\_aks\_config) | AKS cluster configuration | <pre>object({<br/> vm_size = string<br/> disk_size_gb = number<br/> min_nodes = number<br/> max_nodes = number<br/> })</pre> | <pre>{<br/> "disk_size_gb": 100,<br/> "max_nodes": 5,<br/> "min_nodes": 1,<br/> "vm_size": "Standard_E8ps_v6"<br/>}</pre> | no |
| <a name="input_aks_config"></a> [aks\_config](#input\_aks\_config) | AKS cluster configuration | <pre>object({<br/> vm_size = string<br/> disk_size_gb = number<br/> min_nodes = number<br/> max_nodes = number<br/> })</pre> | <pre>{<br/> "disk_size_gb": 100,<br/> "max_nodes": 5,<br/> "min_nodes": 1,<br/> "vm_size": "Standard_L8s_v3"<br/>}</pre> | no |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| <a name="input_cert_manager_chart_version"></a> [cert\_manager\_chart\_version](#input\_cert\_manager\_chart\_version) | Version of the cert-manager helm chart to install. | `string` | `"v1.17.1"` | no |
| <a name="input_cert_manager_install_timeout"></a> [cert\_manager\_install\_timeout](#input\_cert\_manager\_install\_timeout) | Timeout for installing the cert-manager helm chart, in seconds. | `number` | `300` | no |
| <a name="input_cert_manager_namespace"></a> [cert\_manager\_namespace](#input\_cert\_manager\_namespace) | The name of the namespace in which cert-manager is or will be installed. | `string` | `"cert-manager"` | no |
| <a name="input_database_config"></a> [database\_config](#input\_database\_config) | Azure Database for PostgreSQL configuration | <pre>object({<br/> sku_name = optional(string, "GP_Standard_D2s_v3")<br/> postgres_version = optional(string, "15")<br/> password = string<br/> username = optional(string, "materialize")<br/> db_name = optional(string, "materialize")<br/> })</pre> | n/a | yes |
| <a name="input_disk_setup_image"></a> [disk\_setup\_image](#input\_disk\_setup\_image) | Docker image for the disk setup script | `string` | `"materialize/ephemeral-storage-setup-image:v0.1.2"` | no |
| <a name="input_disk_support_config"></a> [disk\_support\_config](#input\_disk\_support\_config) | Advanced configuration for disk support (only used when enable\_disk\_support = true) | <pre>object({<br/> install_openebs = optional(bool, true)<br/> run_disk_setup_script = optional(bool, true)<br/> create_storage_class = optional(bool, true)<br/> openebs_version = optional(string, "4.2.0")<br/> openebs_namespace = optional(string, "openebs")<br/> storage_class_name = optional(string, "openebs-lvm-instance-store-ext4")<br/> storage_class_provisioner = optional(string, "local.csi.openebs.io")<br/> storage_class_parameters = optional(object({<br/> storage = optional(string, "lvm")<br/> fsType = optional(string, "ext4")<br/> volgroup = optional(string, "instance-store-vg")<br/> }), {})<br/> })</pre> | `{}` | no |
| <a name="input_enable_disk_support"></a> [enable\_disk\_support](#input\_enable\_disk\_support) | Enable disk support for Materialize using OpenEBS and local SSDs. When enabled, this configures OpenEBS, runs the disk setup script, and creates appropriate storage classes. | `bool` | `true` | no |
| <a name="input_helm_chart"></a> [helm\_chart](#input\_helm\_chart) | Chart name from repository or local path to chart. For local charts, set the path to the chart directory. | `string` | `"materialize-operator"` | no |
| <a name="input_helm_values"></a> [helm\_values](#input\_helm\_values) | Additional Helm values to merge with defaults | `any` | `{}` | no |
| <a name="input_install_cert_manager"></a> [install\_cert\_manager](#input\_install\_cert\_manager) | Whether to install cert-manager. | `bool` | `true` | no |
Expand Down
49 changes: 49 additions & 0 deletions docs/header.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,52 @@ pip install -r requirements.txt
```

This will install the required Python packages in a virtual environment.

## Disk Support for Materialize on Azure

This module supports configuring disk support for Materialize on Azure using **local NVMe SSDs** available in specific VM families, along with **OpenEBS** and `lgalloc` for volume management.

### Recommended Azure VM Types with Local NVMe Disks

Materialize benefits from fast ephemeral storage and recommends a **minimum 2:1 disk-to-RAM ratio**. The [Lsv3-series](https://learn.microsoft.com/en-us/azure/virtual-machines/lsv3-series) virtual machines offer high-throughput local NVMe SSD storage and are ideal for performance-intensive workloads.

| VM Size | vCPUs | Memory | NVMe Storage | Disk-to-RAM Ratio |
|------------------|-------|---------|--------------|-------------------|
| Standard_L8s_v3 | 8 | 64 GiB | 1,900 GiB | ~29:1 |
| Standard_L16s_v3 | 16 | 128 GiB | 3,800 GiB | ~29:1 |
| Standard_L32s_v3 | 32 | 256 GiB | 7,600 GiB | ~29:1 |

> [!NOTE]
> These VM types provide **ephemeral local NVMe SSD disks**. Data is lost when the VM is stopped or deleted, so they should only be used for **temporary or performance-critical data** managed by Materialize.

### Enabling Disk Support on Azure

When `enable_disk_support` is set to `true`, the module:

1. Uses a bootstrap container to identify and configure available NVMe disks
1. Sets up **OpenEBS** with `lvm-localpv` to manage the ephemeral disks
1. Creates a StorageClass for Materialize

Example configuration:

```hcl
enable_disk_support = true

aks_config = {
node_count = 2
vm_size = "Standard_L8s_v3"
os_disk_size_gb = 100
min_nodes = 2
max_nodes = 4
}

disk_support_config = {
install_openebs = true
run_disk_setup_script = true
create_storage_class = true

openebs_version = "4.2.0"
openebs_namespace = "openebs"
storage_class_name = "openebs-lvm-instance-store-ext4"
}
```
31 changes: 31 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ locals {
managed_by = "terraform"
module = "materialize"
})

# Disk support configuration
disk_config = {
install_openebs = var.enable_disk_support ? lookup(var.disk_support_config, "install_openebs", true) : false
run_disk_setup_script = var.enable_disk_support ? lookup(var.disk_support_config, "run_disk_setup_script", true) : false
create_storage_class = var.enable_disk_support ? lookup(var.disk_support_config, "create_storage_class", true) : false
openebs_version = lookup(var.disk_support_config, "openebs_version", "4.2.0")
openebs_namespace = lookup(var.disk_support_config, "openebs_namespace", "openebs")
storage_class_name = lookup(var.disk_support_config, "storage_class_name", "openebs-lvm-instance-store-ext4")
storage_class_provisioner = lookup(var.disk_support_config, "storage_class_provisioner", "local.csi.openebs.io")
storage_class_parameters = {
storage = try(var.disk_support_config.storage_class_parameters.storage, "lvm")
fsType = try(var.disk_support_config.storage_class_parameters.fsType, "ext4")
volgroup = try(var.disk_support_config.storage_class_parameters.volgroup, "instance-store-vg")
}
}
}

module "networking" {
Expand Down Expand Up @@ -36,6 +52,13 @@ module "aks" {
min_nodes = var.aks_config.min_nodes
max_nodes = var.aks_config.max_nodes

# Disk support configuration
enable_disk_setup = local.disk_config.run_disk_setup_script
install_openebs = local.disk_config.install_openebs
openebs_namespace = local.disk_config.openebs_namespace
openebs_version = local.disk_config.openebs_version
disk_setup_image = var.disk_setup_image

tags = local.common_labels
}

Expand Down Expand Up @@ -133,6 +156,14 @@ locals {
}
}
} : {}
storage = var.enable_disk_support ? {
storageClass = {
create = local.disk_config.create_storage_class
name = local.disk_config.storage_class_name
provisioner = local.disk_config.storage_class_provisioner
parameters = local.disk_config.storage_class_parameters
}
} : {}
}

merged_helm_values = merge(local.default_helm_values, var.helm_values)
Expand Down
Loading