Skip to content

Commit

Permalink
Merge pull request #6 from SCT-Engineering/feature-node-tags
Browse files Browse the repository at this point in the history
Feature node tags
  • Loading branch information
morga471 committed Sep 13, 2024
2 parents c19fdab + 0b9b0ad commit 24fe465
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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

0 comments on commit 24fe465

Please sign in to comment.