Skip to content

Commit 8d23210

Browse files
authored
Merge pull request #29 from zama-ai/ghislain/fix/mpc-node-pool
fix(mpc-party): remove node taint configuration
2 parents a5fc4ab + dee9391 commit 8d23210

File tree

7 files changed

+29
-47
lines changed

7 files changed

+29
-47
lines changed

examples/mpc-party/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ module "mpc_party" {
6161
nodegroup_enable_remote_access = var.nodegroup_enable_remote_access
6262
nodegroup_ec2_ssh_key = var.nodegroup_ec2_ssh_key
6363
nodegroup_labels = var.nodegroup_labels
64-
nodegroup_taints = var.nodegroup_taints
6564

6665
kms_image_attestation_sha = var.kms_image_attestation_sha
6766
kms_deletion_window_in_days = var.kms_deletion_window_in_days

examples/mpc-party/terraform.tfvars.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ nodegroup_ami_release_version = "1.32.3-20250620"
5656
nodegroup_labels = {
5757
"nodepool" = "kms"
5858
}
59-
nodegroup_taints = {}
6059
nodegroup_additional_security_group_ids = ["sg-04e41735e6bdc6007"]
6160
nodegroup_enable_nitro_enclaves = true
6261
nodegroup_enable_ssm_managed_instance = true

examples/mpc-party/variables.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,6 @@ variable "nitro_enclaves_override_memory_mib" {
230230
default = null
231231
}
232232

233-
variable "nodegroup_taints" {
234-
description = "Taints for the nodegroup"
235-
type = map(object({
236-
key = string
237-
value = string
238-
effect = string
239-
}))
240-
default = {
241-
dedicated = {
242-
key = "kms_dedicated"
243-
value = "true"
244-
effect = "NO_SCHEDULE"
245-
}
246-
}
247-
}
248-
249233
variable "nodegroup_additional_security_group_ids" {
250234
description = "List of additional security group IDs to associate with the node group"
251235
type = list(string)

modules/mpc-party/README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,6 @@ module "mpc_party" {
166166
"environment" = "production"
167167
}
168168
169-
nodegroup_taints = {
170-
"mpc-dedicated" = {
171-
key = "mpc.io/dedicated"
172-
value = "true"
173-
effect = "NO_SCHEDULE"
174-
}
175-
}
176-
177169
# Nitro Enclaves Configuration
178170
nodegroup_enable_nitro_enclaves = true
179171
kms_enabled_nitro_enclaves = true
@@ -386,7 +378,6 @@ The module can optionally create:
386378
| <a name="input_nodegroup_nitro_enclaves_image_repo"></a> [nodegroup\_nitro\_enclaves\_image\_repo](#input\_nodegroup\_nitro\_enclaves\_image\_repo) | Image repository for Nitro Enclaves | `string` | `"public.ecr.aws/aws-nitro-enclaves/aws-nitro-enclaves-k8s-device-plugin"` | no |
387379
| <a name="input_nodegroup_nitro_enclaves_image_tag"></a> [nodegroup\_nitro\_enclaves\_image\_tag](#input\_nodegroup\_nitro\_enclaves\_image\_tag) | Image tag for Nitro Enclaves | `string` | `"v0.3"` | no |
388380
| <a name="input_nodegroup_source_security_group_ids"></a> [nodegroup\_source\_security\_group\_ids](#input\_nodegroup\_source\_security\_group\_ids) | List of security group IDs allowed for remote access | `list(string)` | `[]` | no |
389-
| <a name="input_nodegroup_taints"></a> [nodegroup\_taints](#input\_nodegroup\_taints) | Map of Kubernetes taints to apply to the node group | <pre>map(object({<br/> key = string<br/> value = string<br/> effect = string<br/> }))</pre> | `{}` | no |
390381
| <a name="input_nodegroup_use_custom_launch_template"></a> [nodegroup\_use\_custom\_launch\_template](#input\_nodegroup\_use\_custom\_launch\_template) | Whether to use a custom launch template | `bool` | `true` | no |
391382
| <a name="input_nodegroup_use_latest_ami_release_version"></a> [nodegroup\_use\_latest\_ami\_release\_version](#input\_nodegroup\_use\_latest\_ami\_release\_version) | Whether to use the latest AMI release version | `bool` | `false` | no |
392383
| <a name="input_party_name"></a> [party\_name](#input\_party\_name) | The name of the MPC party (used for resource naming and tagging) | `string` | n/a | yes |
@@ -443,6 +434,7 @@ The module can optionally create:
443434
| <a name="output_irsa_summary"></a> [irsa\_summary](#output\_irsa\_summary) | Summary of the IRSA role for MPC party |
444435
| <a name="output_k8s_configmap_summary"></a> [k8s\_configmap\_summary](#output\_k8s\_configmap\_summary) | Summary of the Kubernetes ConfigMap for MPC party |
445436
| <a name="output_k8s_service_account_summary"></a> [k8s\_service\_account\_summary](#output\_k8s\_service\_account\_summary) | Summary of the Kubernetes service account for MPC party |
437+
| <a name="output_node_group_tolerations"></a> [node\_group\_tolerations](#output\_node\_group\_tolerations) | Kubernetes tolerations derived from EKS node group taints |
446438
| <a name="output_party_name"></a> [party\_name](#output\_party\_name) | Name of the MPC party |
447439
| <a name="output_rds_summary"></a> [rds\_summary](#output\_rds\_summary) | Aggregated RDS database information |
448440
| <a name="output_vault_bucket_storage_summary"></a> [vault\_bucket\_storage\_summary](#output\_vault\_bucket\_storage\_summary) | Summary of the vault buckets public and private storage |

modules/mpc-party/main.tf

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ locals {
5050
node_group_nitro_enclaves_memory_mib = var.nitro_enclaves_override_memory_mib != null ? var.nitro_enclaves_override_memory_mib : floor(data.aws_ec2_instance_type.this[0].memory_size * 0.75)
5151
private_bucket_name = "${var.bucket_prefix}-private-${random_id.mpc_party_suffix.hex}"
5252
public_bucket_name = "${var.bucket_prefix}-public-${random_id.mpc_party_suffix.hex}"
53+
54+
# Transform EKS node group taints into Kubernetes tolerations
55+
node_group_tolerations = var.create_nodegroup ? [
56+
for taint_key, taint_config in module.eks_managed_node_group[0].node_group_taints : {
57+
key = taint_config.key
58+
operator = "Equal"
59+
value = taint_config.value
60+
effect = taint_config.effect == "NO_SCHEDULE" ? "NoSchedule" : taint_config.effect == "NO_EXECUTE" ? "NoExecute" : "PreferNoSchedule"
61+
}
62+
] : []
5363
}
5464

5565
# Create Kubernetes namespace (optional)
@@ -447,18 +457,18 @@ module "eks_managed_node_group" {
447457
source_security_group_ids = var.nodegroup_source_security_group_ids
448458
} : null
449459

450-
# Labels and Taints
460+
# Labels
451461
labels = merge(var.nodegroup_labels, local.node_group_nitro_enclaves_enabled ? {
452462
"node.kubernetes.io/enclave-enabled" = "true"
453463
} : {})
454464

455-
taints = merge(var.nodegroup_taints, local.node_group_nitro_enclaves_enabled ? {
465+
taints = local.node_group_nitro_enclaves_enabled ? {
456466
"aws-nitro-enclaves" = {
457467
key = "node.kubernetes.io/enclave-enabled"
458468
value = "true"
459469
effect = "NO_SCHEDULE"
460470
}
461-
} : {})
471+
} : {}
462472

463473
# Tags
464474
tags = var.tags
@@ -559,13 +569,15 @@ resource "kubernetes_daemon_set_v1" "aws_nitro_enclaves_device_plugin" {
559569
host_path { path = "/sys" }
560570
}
561571

562-
toleration {
563-
key = "node.kubernetes.io/enclave-enabled"
564-
operator = "Equal"
565-
value = "true"
566-
effect = "NoSchedule"
572+
dynamic "toleration" {
573+
for_each = local.node_group_tolerations
574+
content {
575+
key = toleration.value.key
576+
operator = toleration.value.operator
577+
value = toleration.value.value
578+
effect = toleration.value.effect
579+
}
567580
}
568-
569581
}
570582
}
571583
}

modules/mpc-party/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,10 @@ output "rds_summary" {
8888
password = null
8989
enabled = false
9090
}
91+
}
92+
93+
# Node Group Tolerations
94+
output "node_group_tolerations" {
95+
description = "Kubernetes tolerations derived from EKS node group taints"
96+
value = local.node_group_tolerations
9197
}

modules/mpc-party/variables.tf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,13 @@ variable "nodegroup_additional_security_group_ids" {
257257
default = []
258258
}
259259

260-
# Labels and Taints
260+
# Labels
261261
variable "nodegroup_labels" {
262262
type = map(string)
263263
description = "Key-value map of Kubernetes labels applied to the node group"
264264
default = {}
265265
}
266266

267-
variable "nodegroup_taints" {
268-
type = map(object({
269-
key = string
270-
value = string
271-
effect = string
272-
}))
273-
description = "Map of Kubernetes taints to apply to the node group"
274-
default = {}
275-
}
276-
277267
# Nitro Enclaves Configuration
278268
variable "nitro_enclaves_override_cpu_count" {
279269
type = number

0 commit comments

Comments
 (0)