Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for managing aws-auth configmap using new kubernetes_config_map_v1_data resource #1999

Merged

Conversation

bryantbiggs
Copy link
Member

@bryantbiggs bryantbiggs commented Apr 8, 2022

Description

  • Add support for managing aws-auth configmap using new kubernetes_config_map_v1_data resource
    • New variables have been added to support enabling/disabling the configmap management by the module, to add additional IAM role ARNs, roles, users, and accounts to the configmap
    • A kubernetes_config_map is added with a variable var.create_aws_auth_configmap for scenarios where the configmap does not exist and will need to be created (i.e. - using self managed node groups only)

Motivation and Context

Breaking Changes

  • No

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@bryantbiggs bryantbiggs force-pushed the feat/aws-auth-configmap branch from 485efeb to 55d1c19 Compare April 8, 2022 20:11
@bryantbiggs bryantbiggs requested a review from antonbabenko April 8, 2022 20:13
@bryantbiggs bryantbiggs marked this pull request as draft April 8, 2022 20:18
@bryantbiggs bryantbiggs removed the request for review from antonbabenko April 8, 2022 20:19
@bryantbiggs
Copy link
Member Author

eh, need to take a deeper look at this again

@bryantbiggs bryantbiggs marked this pull request as ready for review April 8, 2022 21:53
@bryantbiggs bryantbiggs force-pushed the feat/aws-auth-configmap branch from 8f09a8b to 39a75a3 Compare April 8, 2022 22:06
@bryantbiggs bryantbiggs requested a review from antonbabenko April 8, 2022 22:47
@bryantbiggs
Copy link
Member Author

ok good to go - had to add in a kubernetes_config_map to create a configmap when one doesn't exist

@antonbabenko antonbabenko merged commit da3d54c into terraform-aws-modules:master Apr 9, 2022
antonbabenko pushed a commit that referenced this pull request Apr 9, 2022
## [18.20.0](v18.19.0...v18.20.0) (2022-04-09)

### Features

* Add support for managing `aws-auth` configmap using new `kubernetes_config_map_v1_data` resource ([#1999](#1999)) ([da3d54c](da3d54c))
@antonbabenko
Copy link
Member

This PR is included in version 18.20.0 🎉

@bryantbiggs bryantbiggs deleted the feat/aws-auth-configmap branch April 9, 2022 11:36
@james-callahan
Copy link

What was the reason to rely on the aws cli instead of the aws_eks_cluster_auth data source?

e.g.

data "aws_eks_cluster_auth" "cluster" {
  name = module.eks.cluster_id
}

provider "kubernetes" {
  host                   = module.eks.cluster_endpoint
  cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)  
  token                  = data.aws_eks_cluster_auth.cluster.token
  load_config_file       = false
}

@bryantbiggs
Copy link
Member Author

its up to users to choose when they are using the module, but in the examples we are using exec because that is what is recommended https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#exec-plugins

@FernandoMiguel
Copy link
Contributor

if you have a fargate only cluster, you will also have to create the map , just like the self managed groups

@bryantbiggs
Copy link
Member Author

bryantbiggs commented Apr 12, 2022

if you have a fargate only cluster, you will also have to create the map , just like the self managed groups

No, when using Fargate profiles and EKS managed node groups, the EKS service will automatically update the configmap to ensure the roles are added. Self-managed node groups are the only ones who do not update the configmap automatically

@FernandoMiguel
Copy link
Contributor

thanks for clarifying that. was about to spin up a cluster to test this.

@tanvp112
Copy link

if you have a fargate only cluster, you will also have to create the map , just like the self managed groups

No, when using Fargate profiles and EKS self managed node groups, the EKS service will automatically update the configmap to ensure the roles are added. Self-managed node groups are the only ones who do not update the configmap automatically

@bryantbiggs , you meant to say "when using Fargate profiles and EKS managed node groups..."?

lawliet89 added a commit to SPHTech-Platform/terraform-aws-eks that referenced this pull request Apr 14, 2022
@FernandoMiguel
Copy link
Contributor

Ehe, nice catch.
Anyway, I tested this yesterday with a fargate only cluster and worked as expected.
Was only hit with another annoying issue about the kubernets provider not being able to use data sources, so I had to change it to exec aws instead. Very annoying.

@bryantbiggs
Copy link
Member Author

@tanvp112 thanks for the catch - yes EKS managed node groups. updated the comment above so as to not confuse anyone who lands here

lawliet89 added a commit to SPHTech-Platform/terraform-aws-eks that referenced this pull request Apr 15, 2022
* Use K8S Provider to manage AWS Auth ConfirMap

`kubernetes_config_map_v1_data`
See terraform-aws-modules/terraform-aws-eks#1999

* Loosen versions
spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request Apr 26, 2022
spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request Apr 26, 2022
## [18.20.0](terraform-aws-modules/terraform-aws-eks@v18.19.0...v18.20.0) (2022-04-09)

### Features

* Add support for managing `aws-auth` configmap using new `kubernetes_config_map_v1_data` resource ([terraform-aws-modules#1999](terraform-aws-modules#1999)) ([da3d54c](terraform-aws-modules@da3d54c))
@jallen-frb
Copy link

How does this new method work for multiple EKS clusters?

@FernandoMiguel
Copy link
Contributor

How does this new method work for multiple EKS clusters?

Each cluster has its own configmap

it-without-politics pushed a commit to it-without-politics/terraform-aws-eks that referenced this pull request May 23, 2022
it-without-politics pushed a commit to it-without-politics/terraform-aws-eks that referenced this pull request May 23, 2022
## [18.20.0](terraform-aws-modules/terraform-aws-eks@v18.19.0...v18.20.0) (2022-04-09)

### Features

* Add support for managing `aws-auth` configmap using new `kubernetes_config_map_v1_data` resource ([terraform-aws-modules#1999](terraform-aws-modules#1999)) ([da3d54c](terraform-aws-modules@da3d54c))
@stevo-f3
Copy link

Would it make sense to update https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-18.0.md? It currently has:

Support for managing aws-auth configmap has been removed.

@tomer-ds
Copy link

@stevo-f3 your comment is spot on!! Super confusing having the central documentation for the upgrade give essentially false misleading information. Wasted a large portion of my day attempting to figure out what the variables I see do and why they are supposedly unsupported even though they're not really

@stevo-f3
Copy link

stevo-f3 commented Jul 1, 2022

@bryantbiggs thanks for reintroducing management of aws-auth ConfigMap. Would it make sense to also re-introduce same labels as before in v17 https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v17.24.0/aws_auth.tf#L69-L75 ?

baibailiha added a commit to baibailiha/terraform-aws-eks that referenced this pull request Sep 13, 2022
## [18.20.0](terraform-aws-modules/terraform-aws-eks@v18.19.0...v18.20.0) (2022-04-09)

### Features

* Add support for managing `aws-auth` configmap using new `kubernetes_config_map_v1_data` resource ([#1999](terraform-aws-modules/terraform-aws-eks#1999)) ([cf3b2e4](terraform-aws-modules/terraform-aws-eks@cf3b2e4))
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Would you mind clarifying how to add additional Roles/Users to the AWS AUTH during EKS provisioning
8 participants