Skip to content

Feature node tags #6

Merged
merged 2 commits into from
Sep 13, 2024
Merged
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
3 changes: 3 additions & 0 deletions ec2_node_class.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ spec:

# Optional, configures detailed monitoring for the instance
detailedMonitoring: true

# Add finops tags to karpenter provisioned nodes
tags: ${tags}
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ resource "aws_iam_service_linked_role" "ec2_spot" {
aws_service_name = "spot.amazonaws.com"
}

# Get the default tags from the provider
data "aws_default_tags" "default_tags" {}

# SHOULD PROBABLY PUT THESE OBJECTS INTO A HELM CHART
# Create karpenter default
resource "kubectl_manifest" "karpenter_ec2_node_class" {
Expand All @@ -200,6 +203,7 @@ resource "kubectl_manifest" "karpenter_ec2_node_class" {
]
yaml_body = templatefile("${path.module}/ec2_node_class.yaml.tpl", {
cluster_name = var.cluster_name
tags = jsonencode(data.aws_default_tags.default_tags.tags)
amd_ami_family = "Bottlerocket"
amd_ami_alias = "bottlerocket"
})
Expand Down