-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: Allow EKS cluster security group to be included in node group launch template #1911
feat: Allow EKS cluster security group to be included in node group launch template #1911
Conversation
@@ -175,6 +175,12 @@ variable "cluster_security_group_tags" { | |||
default = {} | |||
} | |||
|
|||
variable "include_cluster_security_group" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: open to suggestions on naming here. was trying to come up with something that wasn't overly verbose
c38015f
to
7eac59f
Compare
I've opened #1934 which seems to be necessary and I've validated that it is required in some instances. However, I don't follow the "node group" security groups. Is this for EKS managed node groups, self managed node groups, or both? Are you creating a launch template or no? |
I just tried this in the examples and the node gets the EKS supplied security group module "eks" {
source = "../.."
cluster_name = local.name
cluster_version = local.cluster_version
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
enable_irsa = false
# https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html#launch-template-security-groups
create_cluster_security_group = false
create_node_security_group = false
eks_managed_node_groups = {
# Default node group - as provided by AWS EKS
default_node_group = {
# By default, the module creates a launch template to ensure tags are propagated to instances, etc.,
# so we need to disable it to use the default template provided by the AWS EKS managed node group service
create_launch_template = false
launch_template_name = ""
create_security_group = false
}
}
tags = local.tags
} |
@bryantbiggs thanks for the feedback... there are more or less three scenarios in EKS today:
I think the example you described is I personally intend to use this with Managed Node Groups but it seemed to make sense to extend this optionality to Self-Managed Node groups as well for consistency. Let me know if this makes sense/if you have any other questions (re: bug fix, yes this is required. if #1934 gets merged before this, i will rebase on top of that) |
@bryantbiggs just wanted to follow up to see if you could take another look at this when you have some time? currently i'm blocked from using this module with a custom node SG and cluster SG |
I'll be honest, I don't quite follow what you are trying to achieve here. either way, we'll have to update one of the examples to demonstrate and verify the changes so if you could start there then maybe that will shed some light on what you are trying to do |
Makes sense-- Let me take a pass at updating/adding an example to this PR to clarify the intended use case |
…group launch template The behavior of EKS's launch template support today is that if any node security groups are specified in the launch template configuration, EKS will not automatically add the cluster security group. If no security groups are specified, the cluster security group is added by default. (ref: https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html) For users that want to preserve similar behavior, when including additional node security groups, optionally allow the cluster security group to be added to the launch template generated by the EKS Cluster terraform module
00cf258
to
c262635
Compare
@bryantbiggs hopefully this helps. i think i found the right place to put in the examples... but let me also explain pre/post behavior a little more: Pre my change (or with change, variable set to
Post change:
let me know if that helps clarify/if you have any follow up questions |
I've opened #1952 which should satisfy this - there are a few differences I've made so that we continue the patterns established in terms of the flexibility users have in how they managed their node groups |
thanks @bryantbiggs that change looks perfectly reasonable to me. much appreciated for helping to bring this over the line! |
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. |
Description
Allow including EKS cluster security group in module created launch templates
In order to effectively use this feature, additional cluster security groups may not be specified at cluster creationRebased on top of #1934which does not work right now. Fix is added for that (Fixes #1892)
Motivation and Context
The behavior of EKS's launch template support today is that if any node security groups are
specified in the launch template configuration, EKS will not automatically add the cluster security group.
If no security groups are specified, the cluster security group is added by default.
(ref: https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html)
For users that want to preserve similar behavior, when including additional node security groups,
optionally allow the cluster security group to be added to the launch template generated
by the EKS Cluster terraform module
Breaking Changes
include_cluster_security_group = false
)How Has This Been Tested?
examples/*
projects