From 9f4eb609011d48d58d39439e51004ef6ca98bc04 Mon Sep 17 00:00:00 2001 From: Renjith Purushothaman Nair Date: Thu, 24 Oct 2024 17:55:06 +0200 Subject: [PATCH 1/3] kube-proxy implementation --- CHANGELOG.md | 1 + k8s.tf | 1 - modules/k8s_eks_addons/kube-proxy.tf | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 modules/k8s_eks_addons/kube-proxy.tf diff --git a/CHANGELOG.md b/CHANGELOG.md index f8aacf5..d009c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - replaced terraform-aws-eks-blueprint addon ingress-nginx with module `modules/k8s_eks_addons/ingress-nginx.tf` - replaced terraform-aws-eks-blueprint addon cluster-autoscaler with module `modules/k8s_eks_addons/cluster-autoscaler.tf` - replaced terraform-aws-eks-blueprint addon coredns with module `modules/k8s_eks_addons/coredns.tf` +- replaced terraform-aws-eks-blueprint addon kube_proxy with module `modules/k8s_eks_addons/kube-proxy.tf` ## v0.2.0 diff --git a/k8s.tf b/k8s.tf index d3164ee..8d66797 100644 --- a/k8s.tf +++ b/k8s.tf @@ -19,7 +19,6 @@ module "eks-addons" { source = "git::https://github.com/aws-ia/terraform-aws-eks-blueprints.git//modules/kubernetes-addons?ref=v4.32.1" eks_cluster_id = module.eks.eks_cluster_id enable_amazon_eks_vpc_cni = true - enable_amazon_eks_kube_proxy = true enable_aws_efs_csi_driver = true enable_amazon_eks_aws_ebs_csi_driver = true enable_aws_load_balancer_controller = false diff --git a/modules/k8s_eks_addons/kube-proxy.tf b/modules/k8s_eks_addons/kube-proxy.tf new file mode 100644 index 0000000..34b87a1 --- /dev/null +++ b/modules/k8s_eks_addons/kube-proxy.tf @@ -0,0 +1,18 @@ +locals { + kube_proxy_addon_name = "kube-proxy" +} + +data "aws_eks_addon_version" "kube-proxy" { + addon_name = local.kube_proxy_addon_name + kubernetes_version = var.addon_context.eks_cluster_version +} + +resource "aws_eks_addon" "kube-proxy" { + cluster_name = var.addon_context.eks_cluster_id + addon_name = local.kube_proxy_addon_name + addon_version = data.aws_eks_addon_version.kube-proxy.version + preserve = true + resolve_conflicts_on_create = "OVERWRITE" + resolve_conflicts_on_update = "OVERWRITE" + tags = var.addon_context.tags +} From 75fb888adc414d46712d0eb4e625211966667866 Mon Sep 17 00:00:00 2001 From: Renjith Purushothaman Nair Date: Fri, 25 Oct 2024 12:53:02 +0200 Subject: [PATCH 2/3] updated maintenance.md --- MAINTENANCE.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 23badc6..b8a88e8 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -128,3 +128,25 @@ moved { terraform apply ``` 4. Remove `move.tf` file + +# Migrate kube_proxy addon to the module +To migrate from terraform-aws-eks-blueprint addon kube_proxy to custom module `modules/k8s_eks_addons/kube-proxy.tf` follow steps: + +1. create 'move.tf' in repository root +2. Add following code: +``` +moved { + from = module.eks-addons.module.aws_kube_proxy[0].data.aws_eks_addon_version.this + to = module.k8s_eks_addons.data.aws_eks_addon_version.kube-proxy +} +moved { + from = module.eks-addons.module.aws_kube_proxy[0].aws_eks_addon.kube_proxy + to = module.k8s_eks_addons.aws_eks_addon.kube-proxy +} +``` +3. Run command: +``` +terraform apply +``` +4. Remove `move.tf` file + From e4cb52f3039389d8332e3d7472381d71ca8f00af Mon Sep 17 00:00:00 2001 From: Renjith Purushothaman Nair Date: Mon, 28 Oct 2024 11:04:03 +0100 Subject: [PATCH 3/3] review comments - renamed to kube_proxy --- MAINTENANCE.md | 4 ++-- modules/k8s_eks_addons/kube-proxy.tf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MAINTENANCE.md b/MAINTENANCE.md index b8a88e8..57d2246 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -137,11 +137,11 @@ To migrate from terraform-aws-eks-blueprint addon kube_proxy to custom module `m ``` moved { from = module.eks-addons.module.aws_kube_proxy[0].data.aws_eks_addon_version.this - to = module.k8s_eks_addons.data.aws_eks_addon_version.kube-proxy + to = module.k8s_eks_addons.data.aws_eks_addon_version.kube_proxy } moved { from = module.eks-addons.module.aws_kube_proxy[0].aws_eks_addon.kube_proxy - to = module.k8s_eks_addons.aws_eks_addon.kube-proxy + to = module.k8s_eks_addons.aws_eks_addon.kube_proxy } ``` 3. Run command: diff --git a/modules/k8s_eks_addons/kube-proxy.tf b/modules/k8s_eks_addons/kube-proxy.tf index 34b87a1..bdd850f 100644 --- a/modules/k8s_eks_addons/kube-proxy.tf +++ b/modules/k8s_eks_addons/kube-proxy.tf @@ -2,15 +2,15 @@ locals { kube_proxy_addon_name = "kube-proxy" } -data "aws_eks_addon_version" "kube-proxy" { +data "aws_eks_addon_version" "kube_proxy" { addon_name = local.kube_proxy_addon_name kubernetes_version = var.addon_context.eks_cluster_version } -resource "aws_eks_addon" "kube-proxy" { +resource "aws_eks_addon" "kube_proxy" { cluster_name = var.addon_context.eks_cluster_id addon_name = local.kube_proxy_addon_name - addon_version = data.aws_eks_addon_version.kube-proxy.version + addon_version = data.aws_eks_addon_version.kube_proxy.version preserve = true resolve_conflicts_on_create = "OVERWRITE" resolve_conflicts_on_update = "OVERWRITE"