Skip to content

Commit ed048f3

Browse files
authored
feat: Added support for client.authentication.k8s.io/v1beta1 (#1550)
1 parent 949bebe commit ed048f3

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
225225
| <a name="input_fargate_profiles"></a> [fargate\_profiles](#input\_fargate\_profiles) | Fargate profiles to create. See `fargate_profile` keys section in fargate submodule's README.md for more details | `any` | `{}` | no |
226226
| <a name="input_fargate_subnets"></a> [fargate\_subnets](#input\_fargate\_subnets) | A list of subnets to place fargate workers within (if different from subnets). | `list(string)` | `[]` | no |
227227
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | If provided, all IAM roles will be created on this path. | `string` | `"/"` | no |
228+
| <a name="input_kubeconfig_api_version"></a> [kubeconfig\_api\_version](#input\_kubeconfig\_api\_version) | KubeConfig API version. Defaults to client.authentication.k8s.io/v1alpha1 | `string` | `"client.authentication.k8s.io/v1alpha1"` | no |
228229
| <a name="input_kubeconfig_aws_authenticator_additional_args"></a> [kubeconfig\_aws\_authenticator\_additional\_args](#input\_kubeconfig\_aws\_authenticator\_additional\_args) | Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. | `list(string)` | `[]` | no |
229230
| <a name="input_kubeconfig_aws_authenticator_command"></a> [kubeconfig\_aws\_authenticator\_command](#input\_kubeconfig\_aws\_authenticator\_command) | Command to use to fetch AWS EKS credentials. | `string` | `"aws-iam-authenticator"` | no |
230231
| <a name="input_kubeconfig_aws_authenticator_command_args"></a> [kubeconfig\_aws\_authenticator\_command\_args](#input\_kubeconfig\_aws\_authenticator\_command\_args) | Default arguments passed to the authenticator command. Defaults to [token -i $cluster\_name]. | `list(string)` | `[]` | no |

locals.tf

+8-7
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,14 @@ locals {
163163
]
164164

165165
kubeconfig = var.create_eks ? templatefile("${path.module}/templates/kubeconfig.tpl", {
166-
kubeconfig_name = coalesce(var.kubeconfig_name, "eks_${var.cluster_name}")
167-
endpoint = local.cluster_endpoint
168-
cluster_auth_base64 = local.cluster_auth_base64
169-
aws_authenticator_command = var.kubeconfig_aws_authenticator_command
170-
aws_authenticator_command_args = coalescelist(var.kubeconfig_aws_authenticator_command_args, ["token", "-i", local.cluster_name])
171-
aws_authenticator_additional_args = var.kubeconfig_aws_authenticator_additional_args
172-
aws_authenticator_env_variables = var.kubeconfig_aws_authenticator_env_variables
166+
kubeconfig_name = coalesce(var.kubeconfig_name, "eks_${var.cluster_name}")
167+
endpoint = local.cluster_endpoint
168+
cluster_auth_base64 = local.cluster_auth_base64
169+
aws_authenticator_kubeconfig_apiversion = var.kubeconfig_api_version
170+
aws_authenticator_command = var.kubeconfig_aws_authenticator_command
171+
aws_authenticator_command_args = coalescelist(var.kubeconfig_aws_authenticator_command_args, ["token", "-i", local.cluster_name])
172+
aws_authenticator_additional_args = var.kubeconfig_aws_authenticator_additional_args
173+
aws_authenticator_env_variables = var.kubeconfig_aws_authenticator_env_variables
173174
}) : ""
174175

175176
launch_configuration_userdata_rendered = [

templates/kubeconfig.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ users:
2020
- name: ${kubeconfig_name}
2121
user:
2222
exec:
23-
apiVersion: client.authentication.k8s.io/v1alpha1
23+
apiVersion: ${aws_authenticator_kubeconfig_apiversion}
2424
command: ${aws_authenticator_command}
2525
args:
2626
%{~ for i in aws_authenticator_command_args }

variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,12 @@ variable "workers_additional_policies" {
191191
type = list(string)
192192
default = []
193193
}
194+
variable "kubeconfig_api_version" {
195+
description = "KubeConfig API version. Defaults to client.authentication.k8s.io/v1alpha1"
196+
type = string
197+
default = "client.authentication.k8s.io/v1alpha1"
194198

199+
}
195200
variable "kubeconfig_aws_authenticator_command" {
196201
description = "Command to use to fetch AWS EKS credentials."
197202
type = string

0 commit comments

Comments
 (0)