Skip to content
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

fix: Karpenter eventbridge naming #1483

Closed
wants to merge 6 commits into from
Closed
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: 2 additions & 0 deletions docs/add-ons/karpenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ You can optionally customize the Helm chart that deploys `Karpenter` via the fol
enable_karpenter = true
# Queue optional for native handling of instance termination events
karpenter_sqs_queue_arn = "arn:aws:sqs:us-west-2:444455556666:queue1"
# Optional to add name prefix for Karpenter's event bridge rules
karpenter_event_rule_name_prefix = "Karpenter"
# Optional karpenter_helm_config
karpenter_helm_config = {
name = "karpenter"
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
| <a name="input_irsa_iam_permissions_boundary"></a> [irsa\_iam\_permissions\_boundary](#input\_irsa\_iam\_permissions\_boundary) | IAM permissions boundary for IRSA roles | `string` | `""` | no |
| <a name="input_irsa_iam_role_path"></a> [irsa\_iam\_role\_path](#input\_irsa\_iam\_role\_path) | IAM role path for IRSA roles | `string` | `"/"` | no |
| <a name="input_karpenter_enable_spot_termination_handling"></a> [karpenter\_enable\_spot\_termination\_handling](#input\_karpenter\_enable\_spot\_termination\_handling) | Determines whether to enable native spot termination handling | `bool` | `false` | no |
| <a name="input_karpenter_event_rule_name_prefix"></a> [karpenter\_event\_rule\_name\_prefix](#input\_karpenter\_event\_rule\_name\_prefix) | Prefix used for karpenter event bridge rules | `string` | `"Karpenter"` | no |
| <a name="input_karpenter_helm_config"></a> [karpenter\_helm\_config](#input\_karpenter\_helm\_config) | Karpenter autoscaler add-on config | `any` | `{}` | no |
| <a name="input_karpenter_irsa_policies"></a> [karpenter\_irsa\_policies](#input\_karpenter\_irsa\_policies) | Additional IAM policies for a IAM role for service accounts | `list(string)` | `[]` | no |
| <a name="input_karpenter_node_iam_instance_profile"></a> [karpenter\_node\_iam\_instance\_profile](#input\_karpenter\_node\_iam\_instance\_profile) | Karpenter Node IAM Instance profile id | `string` | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/karpenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ For more details checkout [Karpenter](https://karpenter.sh/docs/getting-started/
| <a name="input_manage_via_gitops"></a> [manage\_via\_gitops](#input\_manage\_via\_gitops) | Determines if the add-on should be managed via GitOps. | `bool` | `false` | no |
| <a name="input_node_iam_instance_profile"></a> [node\_iam\_instance\_profile](#input\_node\_iam\_instance\_profile) | Karpenter Node IAM Instance profile id | `string` | `""` | no |
| <a name="input_path"></a> [path](#input\_path) | Path in which to create the Karpenter policy | `string` | `"/"` | no |
| <a name="input_rule_name_prefix"></a> [rule\_name\_prefix](#input\_rule\_name\_prefix) | Prefix used for all event bridge rules | `string` | `"Karpenter"` | no |
| <a name="input_sqs_queue_kms_data_key_reuse_period_seconds"></a> [sqs\_queue\_kms\_data\_key\_reuse\_period\_seconds](#input\_sqs\_queue\_kms\_data\_key\_reuse\_period\_seconds) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again | `number` | `null` | no |
| <a name="input_sqs_queue_kms_master_key_id"></a> [sqs\_queue\_kms\_master\_key\_id](#input\_sqs\_queue\_kms\_master\_key\_id) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK | `string` | `null` | no |
| <a name="input_sqs_queue_managed_sse_enabled"></a> [sqs\_queue\_managed\_sse\_enabled](#input\_sqs\_queue\_managed\_sse\_enabled) | Enable server-side encryption (SSE) for a SQS queue | `bool` | `true` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/karpenter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "aws_sqs_queue_policy" "this" {
resource "aws_cloudwatch_event_rule" "this" {
for_each = { for k, v in local.event_rules : k => v if var.enable_spot_termination }

name = each.value.name
name_prefix = "${var.rule_name_prefix}-${each.value.name}-"
description = each.value.description
event_pattern = jsonencode(each.value.event_pattern)
tags = merge(
Expand Down
6 changes: 6 additions & 0 deletions modules/kubernetes-addons/karpenter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ variable "sqs_queue_kms_data_key_reuse_period_seconds" {
type = number
default = null
}

variable "rule_name_prefix" {
description = "Prefix used for all event bridge rules"
type = string
default = "Karpenter"
}
1 change: 1 addition & 0 deletions modules/kubernetes-addons/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ module "karpenter" {
irsa_policies = var.karpenter_irsa_policies
node_iam_instance_profile = var.karpenter_node_iam_instance_profile
enable_spot_termination = var.karpenter_enable_spot_termination_handling
rule_name_prefix = var.karpenter_event_rule_name_prefix
manage_via_gitops = var.argocd_manage_add_ons
addon_context = local.addon_context
sqs_queue_managed_sse_enabled = var.sqs_queue_managed_sse_enabled
Expand Down
6 changes: 6 additions & 0 deletions modules/kubernetes-addons/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,12 @@ variable "karpenter_enable_spot_termination_handling" {
default = false
}

variable "karpenter_event_rule_name_prefix" {
description = "Prefix used for karpenter event bridge rules"
type = string
default = "Karpenter"
}

variable "sqs_queue_managed_sse_enabled" {
description = "Enable server-side encryption (SSE) for a SQS queue"
type = bool
Expand Down