Skip to content

Commit 16417b0

Browse files
committed
Fix
1 parent bb4e06c commit 16417b0

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

.github/workflows/karpenter.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,6 @@ jobs:
6363
- name: Update kubeconfig
6464
run: aws eks update-kubeconfig --name ${{ inputs.cluster_name }} --region us-east-1
6565

66-
- name: Tag Resources for Karpenter Discovery
67-
run: |
68-
CLUSTER_NAME=${{ inputs.cluster_name }}
69-
70-
# Tag cluster security groups
71-
SECURITY_GROUP_IDS=$(aws eks describe-cluster --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.securityGroupIds' --output text)
72-
for sg_id in $SECURITY_GROUP_IDS; do
73-
aws ec2 create-tags --resources $sg_id --tags Key=karpenter.sh/discovery,Value=$CLUSTER_NAME
74-
done
75-
76-
# Tag additional security groups with cluster name
77-
ADDITIONAL_SG_IDS=$(aws ec2 describe-security-groups --filters "Name=group-name,Values=*$CLUSTER_NAME*" --query 'SecurityGroups[*].GroupId' --output text)
78-
for sg_id in $ADDITIONAL_SG_IDS; do
79-
aws ec2 create-tags --resources $sg_id --tags Key=karpenter.sh/discovery,Value=$CLUSTER_NAME
80-
done
81-
82-
# Tag subnets
83-
SUBNET_IDS=$(aws eks describe-cluster --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.subnetIds' --output text)
84-
for subnet_id in $SUBNET_IDS; do
85-
aws ec2 create-tags --resources $subnet_id --tags Key=karpenter.sh/discovery,Value=$CLUSTER_NAME
86-
done
87-
8866
- name: Install Helm
8967
uses: azure/[email protected]
9068
with:

Terraform/modules/eks/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ resource "aws_eks_cluster" "main" {
2222
}
2323
}
2424

25+
resource "aws_ec2_tag" "cluster_sg_karpenter" {
26+
resource_id = aws_eks_cluster.main.vpc_config[0].cluster_security_group_id
27+
key = "karpenter.sh/discovery"
28+
value = var.cluster_name
29+
}
2530
# EKS OIDC Identity Provider
2631
resource "aws_iam_openid_connect_provider" "eks" {
2732
client_id_list = ["sts.amazonaws.com"]

0 commit comments

Comments
 (0)