diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index fa44ea9..f3f7cc3 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -76,6 +76,9 @@ spec: # Required: AWS region region: us-east-2 + # VPC configuration + vpc_az_count: 2 # Number of availability zones (default: 3, max: 3) + # RDS PostgreSQL configuration db_engine_version: "15.12" db_instance_class: db.m5d.large @@ -278,6 +281,23 @@ workbench: accountId: account-name ``` +## VPC Availability Zone Configuration + +The `vpc_az_count` setting controls how many availability zones the VPC subnets span. This affects where EKS nodes and EBS volumes can be placed. + +| Value | Use Case | +|-------|----------| +| `3` (default) | Maximum redundancy across AZs | +| `2` | Recommended for workloads with StatefulSets using EBS volumes | + +### Why Use 2 AZs? + +EBS volumes are bound to a single availability zone. When using StatefulSets (like Loki or Mimir for monitoring), the PersistentVolumes are created in a specific AZ. If a node group rolls and new nodes are placed in different AZs than where the PVs exist, pods cannot schedule. + +With 3 AZs and 2 nodes, there's no guarantee that nodes will cover all AZs where PVs may exist. Restricting to 2 AZs ensures that after any node operation, there will always be a node available in each AZ where PVs are located. + +**Note:** This setting only affects new VPCs. Changing this value on an existing workload will cause Pulumi to attempt to delete subnets in the removed AZ. + ## See Also - [Getting Started](GETTING_STARTED.md) diff --git a/python-pulumi/src/ptd/pulumi_resources/aws_vpc.py b/python-pulumi/src/ptd/pulumi_resources/aws_vpc.py index f5ceef8..04bb4fc 100644 --- a/python-pulumi/src/ptd/pulumi_resources/aws_vpc.py +++ b/python-pulumi/src/ptd/pulumi_resources/aws_vpc.py @@ -9,7 +9,7 @@ import ptd AWS_UTILITIES_CUTOFF_VERSION_MAJOR = 6 -MIN_AZ_COUNT = 3 +MAX_AZ_COUNT = 3 MIN_CIDR_BLOCK_SIZE = 4096 @@ -83,7 +83,7 @@ def __init__( if len(azs) == 0: pulumi.error("Using zero availability zones is not supported") - if len(azs) > MIN_AZ_COUNT: + if len(azs) > MAX_AZ_COUNT: pulumi.error("Using more than three availability zones is not supported") if len(azs) == 1: diff --git a/python-pulumi/src/ptd/pulumi_resources/aws_workload_helm.py b/python-pulumi/src/ptd/pulumi_resources/aws_workload_helm.py index 029bfeb..b99e876 100644 --- a/python-pulumi/src/ptd/pulumi_resources/aws_workload_helm.py +++ b/python-pulumi/src/ptd/pulumi_resources/aws_workload_helm.py @@ -546,7 +546,12 @@ def _define_mimir(self, release: str, version: str, components): "alertmanager": {"enabled": False}, "ruler": {"enabled": False}, "ingester": { - "persistentVolume": {"size": "20Gi"}, + "persistentVolume": { + "size": "20Gi", + "enableRetentionPolicy": True, + "whenDeleted": "Delete", + "whenScaled": "Delete", + }, "replicas": components.mimir_replicas, "zoneAwareReplication": {"enabled": False}, "affinity": { @@ -567,7 +572,12 @@ def _define_mimir(self, release: str, version: str, components): }, }, "compactor": { - "persistentVolume": {"size": "20Gi"}, + "persistentVolume": { + "size": "20Gi", + "enableRetentionPolicy": True, + "whenDeleted": "Delete", + "whenScaled": "Delete", + }, "replicas": components.mimir_replicas, "affinity": { "nodeAffinity": { @@ -587,7 +597,12 @@ def _define_mimir(self, release: str, version: str, components): }, }, "store_gateway": { - "persistentVolume": {"size": "20Gi"}, + "persistentVolume": { + "size": "20Gi", + "enableRetentionPolicy": True, + "whenDeleted": "Delete", + "whenScaled": "Delete", + }, "replicas": components.mimir_replicas, "zoneAwareReplication": {"enabled": False}, "affinity": {