Skip to content

Add support for environmentd extra args #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ No modules.
| <a name="input_helm_repository"></a> [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 |
| <a name="input_helm_values"></a> [helm\_values](#input\_helm\_values) | Values to pass to the Helm chart | `any` | n/a | yes |
| <a name="input_install_metrics_server"></a> [install\_metrics\_server](#input\_install\_metrics\_server) | Whether to install the metrics-server | `bool` | `true` | no |
| <a name="input_instances"></a> [instances](#input\_instances) | Configuration for Materialize instances | <pre>list(object({<br/> name = string<br/> namespace = optional(string)<br/> create_database = optional(bool, true)<br/> database_name = string<br/> metadata_backend_url = string<br/> persist_backend_url = string<br/> license_key = optional(string)<br/> environmentd_version = optional(string, "v0.130.12") # META: mz version<br/> environmentd_extra_env = optional(list(object({<br/> name = string<br/> value = string<br/> })), [])<br/> cpu_request = optional(string, "1")<br/> memory_request = optional(string, "1Gi")<br/> memory_limit = optional(string, "1Gi")<br/> in_place_rollout = optional(bool, true)<br/> request_rollout = optional(string, "00000000-0000-0000-0000-000000000001")<br/> force_rollout = optional(string, "00000000-0000-0000-0000-000000000001")<br/> balancer_memory_request = optional(string, "256Mi")<br/> balancer_memory_limit = optional(string, "256Mi")<br/> balancer_cpu_request = optional(string, "100m")<br/> }))</pre> | `[]` | no |
| <a name="input_instances"></a> [instances](#input\_instances) | Configuration for Materialize instances | <pre>list(object({<br/> name = string<br/> namespace = optional(string)<br/> create_database = optional(bool, true)<br/> database_name = string<br/> metadata_backend_url = string<br/> persist_backend_url = string<br/> license_key = optional(string)<br/> environmentd_version = optional(string, "v0.130.12") # META: mz version<br/> environmentd_extra_env = optional(list(object({<br/> name = string<br/> value = string<br/> })), [])<br/> environmentd_extra_args = optional(list(string), [])<br/> cpu_request = optional(string, "1")<br/> memory_request = optional(string, "1Gi")<br/> memory_limit = optional(string, "1Gi")<br/> in_place_rollout = optional(bool, true)<br/> request_rollout = optional(string, "00000000-0000-0000-0000-000000000001")<br/> force_rollout = optional(string, "00000000-0000-0000-0000-000000000001")<br/> balancer_memory_request = optional(string, "256Mi")<br/> balancer_memory_limit = optional(string, "256Mi")<br/> balancer_cpu_request = optional(string, "100m")<br/> }))</pre> | `[]` | no |
| <a name="input_metrics_server_version"></a> [metrics\_server\_version](#input\_metrics\_server\_version) | Version of metrics-server to install | `string` | `"3.12.2"` | no |
| <a name="input_monitoring_namespace"></a> [monitoring\_namespace](#input\_monitoring\_namespace) | Namespace for monitoring resources | `string` | `"monitoring"` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace prefix for all resources | `string` | n/a | yes |
Expand Down
5 changes: 4 additions & 1 deletion examples/aws/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

instance_configs_example = [
{
name = "mz-instance-1"
Expand All @@ -10,6 +9,10 @@ instance_configs_example = [
cpu_request = "2"
memory_request = "4Gi"
memory_limit = "8Gi"
environmentd_extra_args = [
"--system-parameter-default=max_clusters=100",
"--system-parameter-default=max_connections=100"
]
},
{
name = "mz-instance-2"
Expand Down
4 changes: 4 additions & 0 deletions examples/gcp/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ instance_configs_example = [
cpu_request = "2"
memory_request = "4Gi"
memory_limit = "8Gi"
environmentd_extra_args = [
"--system-parameter-default=max_clusters=100",
"--system-parameter-default=max_connections=100"
]
},
{
name = "mz-instance-2"
Expand Down
11 changes: 10 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ locals {
}
] : null
}

format_env_args = {
for instance in var.instances : instance.name =>
length(lookup(instance, "environmentd_extra_args", [])) > 0 ? [
for item in instance.environmentd_extra_args :
item
] : null
}
}

resource "kubernetes_namespace" "materialize" {
Expand Down Expand Up @@ -98,7 +106,8 @@ resource "kubernetes_manifest" "materialize_instances" {
requestRollout = lookup(each.value, "request_rollout", null)
forceRollout = lookup(each.value, "force_rollout", null)

environmentdExtraEnv = lookup(local.format_env_vars, each.key, null)
environmentdExtraEnv = lookup(local.format_env_vars, each.key, null)
environmentdExtraArgs = lookup(local.format_env_args, each.key, null)

environmentdResourceRequirements = {
limits = {
Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ variable "instances" {
name = string
value = string
})), [])
environmentd_extra_args = optional(list(string), [])
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh neat! Is this what we'd uses to set, for example, enable_create_table_from_source = true; or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

exactly!

environmentd_extra_args:
  - --system-parameter-default=enable_create_table_from_source=true

There's a side effort I've got to let us do this via config files, that would allow us to do this without restarting environmentd, but it's not ready yet.

cpu_request = optional(string, "1")
memory_request = optional(string, "1Gi")
memory_limit = optional(string, "1Gi")
Expand Down