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

fix: use aws eks get-token for kubectl auth #1590

Conversation

schollii
Copy link

PR o'clock

Description

Fixes #957

Use aws eks get-token instead of aws iam authenticator

Checklist

@schollii schollii changed the title fix: use aws eks get-token instead of aws iam authenticator ( fix: use aws eks get-token for kubectl auth Sep 17, 2021
@@ -219,7 +219,7 @@ variable "kubeconfig_aws_authenticator_env_variables" {
variable "kubeconfig_name" {
description = "Override the default name used for items kubeconfig."
type = string
default = ""
default = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify, please, why is it required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably because:

> coalescelist([""], ["c", "d"])
[
  "",
]
>  

from line

aws_authenticator_command_args = coalescelist(var.kubeconfig_aws_authenticator_command_args, local.default_kubeconfig_aws_auth_args)

Copy link
Author

@schollii schollii Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually coalesce works with both "" and null, BUT it is almost always preferable to use null than empty string to indicate "no value set".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually coalesce works with both "" and null

yes but it will give different results (from terraform console):

> coalescelist([""], ["c", "d"])
[
  "",
]
> coalescelist([], ["c", "d"])
[
  "c",
  "d",
]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, but here is just normal string

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the function being discussed is coalesce not coalescelist

@@ -219,7 +219,7 @@ variable "kubeconfig_aws_authenticator_env_variables" {
variable "kubeconfig_name" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you update kubeconfig_aws_authenticator_command default value as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@lisfo4ka
Copy link
Contributor

@antonbabenko @daroga0002 @schollii hi folks)
From my side, this change looks really good and useful. I suppose it shouldn't trigger more changes as kubeconfig file recreation which shouldn't be critical since terraform folder isn't the place to store it.

@schollii could you post terraform plan output, please. And if everyone is fine with it, let's merge this MR.

@schollii
Copy link
Author

@schollii could you post terraform plan output, please...

@lisfo4ka, in what folder should I run this?

@lisfo4ka
Copy link
Contributor

lisfo4ka commented Oct 26, 2021

@lisfo4ka, in what folder should I run this?

I assume it can be any, e.g. examples/launch_templates

type = string
default = "aws-iam-authenticator"
default = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default = null
default = "aws"

And remove coalesce() where this variable is used. Right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schollii do you will be able to change it and then I will make testing

@schollii
Copy link
Author

@lisfo4ka ok will report back asap

Copy link

@timblaktu timblaktu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. This will be a big improvement. All external examples of first steps configuring kubectl to auth/connect to an EKS cluster use the aws eks update-kubeconfig approach, which uses the get-token approach, so aligning this Terraform module will prevent new users from being confused why they're so different (and prevent them from having to install aws-iam-authenticator.)

@bryantbiggs
Copy link
Member

I think we should include this in a breaking change and drop all support for the legacy iam-authenticator approach - thoughts @daroga0002 ?

@daroga0002
Copy link
Contributor

I tried to search what are benefits of using aws-iam-authenticator and I dont see any, maybe somebody from community will be able to put some arguments here.

From my side I think we can:

  1. drop totally support for aws-iam-authenticator and remove any customization in our code
  2. provide in outputs (I believ most or all are arleady done) values which can be used to build any form of Kube config (so thne if somebody will have own requirements can pass a template and fill them by outputs)

@schollii
Copy link
Author

schollii commented Nov 7, 2021

It's a good idea but I think it's taking this ticket beyond original scope, a separate ticket would be better so we can close this asap.

@Yasumoto
Copy link

Yasumoto commented Nov 8, 2021

Getting this over the finish line would be rad. When I was first getting started, trying to find this extra tool (and figure out if aws-iam-authenticator was actively recommended) was a bit of a road bump.

@daroga0002
Copy link
Contributor

It's a good idea but I think it's taking this ticket beyond original scope, a separate ticket would be better so we can close this asap.

@schollii can you adjust comments #1590 (comment) and then we will merge it to v17.* version

Work about redesign we will cover in other PR for v18* milestone

@schollii
Copy link
Author

schollii commented Nov 8, 2021

@daroga0002 not sure what you mean, clicking that link in your post just gets me to the top of the PR

@daroga0002
Copy link
Contributor

open comments from antonbabenko

@antonbabenko
Copy link
Member

@daroga0002 I think we should have this one merged (after outstanding code changes got merged) and release a minor release in v17.

I am not knowledgeable enough to suggest dropping part of the functionality since it already works. I think we can reevaluate it as a part of the breaking changes we are going to have in v18 but not in this PR.

@daroga0002
Copy link
Contributor

I am not knowledgeable enough to suggest dropping part of the functionality since it already works. I think we can reevaluate it as a part of the breaking changes we are going to have in v18 but not in this PR.

Yes this is what I am suggesting, now we simply extend to allow feature in v17 and in v18 we will drop legacy approach (as that will be bigger breaking change release so migration will be not so fast probably).

I will duplicate this PR and make fixes on my branch, test and open PR as I cannot edit this.

@lisfo4ka
Copy link
Contributor

Folks, I'd really like to deliver this change to the v17, so I've created a new PR with proper testing. Please, take a look at #1699

@github-actions
Copy link

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Dec 24, 2021
@github-actions
Copy link

github-actions bot commented Jan 3, 2022

This PR was automatically closed because of stale in 10 days

@github-actions github-actions bot closed this Jan 3, 2022
@antonbabenko
Copy link
Member

This issue has been resolved in version 18.0.0 🎉

@github-actions
Copy link

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 11, 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.

Use "aws eks get-token" instead of "aws-iam-authenticator"
8 participants