Skip to content

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

Merged
antonbabenko merged 4 commits into
terraform-aws-modules:masterfrom
bryantbiggs:feat/aws-auth-configmap
Apr 9, 2022
Merged

feat: Add support for managing aws-auth configmap using new kubernetes_config_map_v1_data resource#1999
antonbabenko merged 4 commits into
terraform-aws-modules:masterfrom
bryantbiggs:feat/aws-auth-configmap

Conversation

@bryantbiggs

@bryantbiggs bryantbiggs commented Apr 8, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor

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

@bryantbiggs

bryantbiggs commented Apr 12, 2022

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Contributor

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

@tanvp112

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
astech-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request Apr 26, 2022
astech-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
Copy Markdown

How does this new method work for multiple EKS clusters?

@FernandoMiguel

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

@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

stevo-f3 commented Jul 1, 2022

Copy link
Copy Markdown

@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

github-actions Bot commented Nov 8, 2022

Copy link
Copy Markdown

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