Skip to content

Commit

Permalink
Fix Karpenter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
svennam92 committed Nov 17, 2023
1 parent 0dae87c commit e8aacee
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
provider "aws" {
region = "us-east-1"
alias = "virginia"
}

data "aws_ecrpublic_authorization_token" "token" {
provider = aws.virginia
}

module "eks_blueprints_addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "1.12.0"
Expand All @@ -6,6 +15,10 @@ module "eks_blueprints_addons" {

karpenter_enable_spot_termination = true
karpenter_enable_instance_profile_creation = true
karpenter = {
repository_username = data.aws_ecrpublic_authorization_token.token.user_name
repository_password = data.aws_ecrpublic_authorization_token.token.password
}

cluster_name = local.eks_cluster_id
cluster_endpoint = local.eks_cluster_endpoint
Expand All @@ -15,7 +28,7 @@ module "eks_blueprints_addons" {

output "environment" {
value = <<EOF
export KARPENTER_NODE_ROLE="${module.eks_blueprints_addons.karpenter.node_iam_role_name}"
export KARPENTER_NODE_ROLE_ARN="${module.eks_blueprints_addons.karpenter.node_iam_role_arn}"
export KARPENTER_ROLE="${module.eks_blueprints_addons.karpenter.node_iam_role_name}"
export KARPENTER_ARN="${module.eks_blueprints_addons.karpenter.node_iam_role_arn}"
EOF
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ metadata:
name: default
spec:
amiFamily: AL2 # Amazon Linux 2
role: "${KARPENTER_NODE_ROLE}"
role: "${KARPENTER_ROLE}"
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: ${EKS_CLUSTER_NAME}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/autoscaling/compute/karpenter/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The only setup that we will need to do is to update our EKS IAM mappings to allo

```bash
$ eksctl create iamidentitymapping --cluster $EKS_CLUSTER_NAME \
--region=$AWS_REGION --arn $KARPENTER_NODE_ROLE_ARN \
--region $AWS_REGION --arn $KARPENTER_ARN \
--group system:bootstrappers --group system:nodes \
--username system:node:{{EC2PrivateDNSName}}
```
2 changes: 1 addition & 1 deletion website/docs/autoscaling/compute/karpenter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_custom_props: {"module": true}
:::tip Before you start
Prepare your environment for this section:

```bash timeout=300 wait=30
```bash timeout=900 wait=30
$ prepare-environment autoscaling/compute/karpenter
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before() {
}

after() {
sleep 10
sleep 30

num_nodes=$(kubectl get nodes --selector=type=karpenter -o json | jq -r '.items | length')

Expand Down

0 comments on commit e8aacee

Please # to comment.