Skip to content

add Cluster Autoscaler IRSA role and policy#313

Open
EmmanuelNwa247 wants to merge 2 commits into
mainfrom
Nuel/cluster-autoscaler-irsa-DEV-549
Open

add Cluster Autoscaler IRSA role and policy#313
EmmanuelNwa247 wants to merge 2 commits into
mainfrom
Nuel/cluster-autoscaler-irsa-DEV-549

Conversation

@EmmanuelNwa247

@EmmanuelNwa247 EmmanuelNwa247 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Add IRSA (IAM Role for Service Accounts) support for the Cluster Autoscaler in the eks-nbs module. The autoscaler Helm chart was previously deployed on dev71 without IAM permissions — the ServiceAccount had no role annotation, so it couldn't call AWS APIs to scale nodes.

Changes

  • irsa.tf — New cluster_autoscaler_irsa_role module and cluster_autoscaler_irsa_policy IAM policy with tag-scoped autoscaling permissions
  • variables.tf — New create_cluster_autoscaler_irsa (bool) and cluster_autoscaler_cluster_name (string) variables, both defaulting to off so existing environments are unaffected
  • outputs.tf — New cluster_autoscaler_irsa_role_arn output

IAM Policy Details

  • Describe actions (DescribeAutoScalingGroups, DescribeTags, DescribeInstanceTypes, eks:DescribeNodegroup, etc.) use Resource: "*" as these APIs don't support resource-level restrictions
  • Scale actions (SetDesiredCapacity, TerminateInstanceInAutoScalingGroup) are scoped via k8s.io/cluster-autoscaler tag-based IAM conditions per upstream Cluster Autoscaler best practices
  • SonarCloud Resource: "*" findings reviewed and safe to dismiss

Validation

  • Tested end-to-end on nbs7-dev2-eks
  • Applied Terraform — created IRSA role and policy
  • Deployed Cluster Autoscaler via helm install with --set for the SA annotation
  • Confirmed SA annotated with role ARN
  • Autoscaler logs show successful ASG discovery, no AccessDenied errors, scale-down evaluation running on all nodes
  • Chart version: cluster-autoscaler-9.58.0

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Comment thread terraform/aws/modules/2-nbs7/eks-nbs/irsa.tf Dismissed
Comment thread terraform/aws/modules/2-nbs7/eks-nbs/irsa.tf Dismissed
@EmmanuelNwa247
EmmanuelNwa247 marked this pull request as ready for review July 8, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants