jenkins-x/terraform-aws-eks-jx

Impossible to remove worker groups as described in readme.md

babadofar opened this issue · 4 comments

Summary

The documentation describes that you can disable worker groups. However, if you try to do that you will no longer have worker groups launch templates due to the logic.
The documentation states

Transitioning from Worker Groups to Worker Groups Launch Templates
In order to prevent any interruption to service, you'll first want to enable Worker Group Launch Templates.

Once you've verified that you are able to see the new Nodes created by the Launch Templates by running kubectl get nodes, then you can remove the older Worker Group.

To remove the older worker group, it's recommended to first scale down to zero nodes, one at a time, by adjusting the min/max node capacity. Once you've scaled down to zero nodes for the original worker group, and your workloads have been scheduled on nodes created by the launch templates you can set enable_worker_group to false.

module "eks-jx" { source = "jenkins-x/eks-jx/aws" enable_worker_group = false enable_worker_groups_launch_template = true allowed_spot_instance_types = ["m5.large", "m5a.large", "m5d.large", "m5ad.large", "t3.large", "t3a.large"] lt_desired_nodes_per_subnet = 2 lt_min_nodes_per_subnet = 2 lt_max_nodes_per_subnet = 3 }

However in the code there is a conditional that only allows worker groups launch templates if you also have enabled worker groups
https://github.com/jenkins-x/terraform-aws-eks-jx/blob/master/modules/cluster/main.tf#L99

worker_groups = var.enable_worker_group && !var.enable_worker_groups_launch_template ? [
I'm not quite sure what the correct approach here would be. But the documentation is misleading, and the config is confusing :)

Sorry I linked up the wrong conditional and didn't even read what I pasted in.
The correct, erroneous code is here https://github.com/jenkins-x/terraform-aws-eks-jx/blob/master/modules/cluster/main.tf#L71
worker_groups_launch_template = var.enable_worker_group && var.enable_worker_groups_launch_template ? [

Were u trying to switch between self managed eks worker nodes and eks managed nodes? Setting enable_worker_group to true will provision self managed nodes (https://docs.aws.amazon.com/eks/latest/userguide/worker.html) and setting it to false will provision eks managed node groups (https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html)
It has nothing to do with launch template.

Yes except launch templates will only be added if you set worker groups =true .
If you follow the conditionals you will see this. Are there tests for this by the way?

Are there tests for this by the way?

I started writing terragrunt tests for this, but we dont have EKS infrastructure to test this atm 😬 https://github.com/jenkins-x/terraform-aws-eks-jx/tree/master/test