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 additionalSecurityGroups support for NLB #10162

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/model/awsmodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchConfigurationTask(c *fi.ModelB
if b.APILoadBalancerClass() == kops.LoadBalancerClassNetwork {
for _, id := range b.Cluster.Spec.API.LoadBalancer.AdditionalSecurityGroups {
sgTask := &awstasks.SecurityGroup{
ID: fi.String("nlb-" + id),
ID: fi.String(id),
Lifecycle: b.SecurityLifecycle,
Name: fi.String("nlb-" + id),
Shared: fi.Bool(true),
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/update_cluster/complex/cloudformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@
{
"Ref": "AWSEC2SecurityGroupmasterscomplexexamplecom"
},
"nlb-sg-exampleid3",
"nlb-sg-exampleid4"
"sg-exampleid3",
"sg-exampleid4"
]
}
],
Expand Down Expand Up @@ -404,9 +404,9 @@
{
"Ref": "AWSEC2SecurityGroupnodescomplexexamplecom"
},
"nlb-sg-exampleid3",
"nlb-sg-exampleid4",
"sg-exampleid3",
"sg-exampleid3",
"sg-exampleid4",
"sg-exampleid4"
]
}
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/update_cluster/complex/kubernetes.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
locals {
cluster_name = "complex.example.com"
master_autoscaling_group_ids = [aws_autoscaling_group.master-us-test-1a-masters-complex-example-com.id]
master_security_group_ids = [aws_security_group.masters-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4"]
master_security_group_ids = [aws_security_group.masters-complex-example-com.id, "sg-exampleid3", "sg-exampleid4"]
masters_role_arn = aws_iam_role.masters-complex-example-com.arn
masters_role_name = aws_iam_role.masters-complex-example-com.name
node_autoscaling_group_ids = [aws_autoscaling_group.nodes-complex-example-com.id]
node_security_group_ids = [aws_security_group.nodes-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4", "sg-exampleid3", "sg-exampleid4"]
node_security_group_ids = [aws_security_group.nodes-complex-example-com.id, "sg-exampleid3", "sg-exampleid3", "sg-exampleid4", "sg-exampleid4"]
node_subnet_ids = [aws_subnet.us-test-1a-complex-example-com.id]
nodes_role_arn = aws_iam_role.nodes-complex-example-com.arn
nodes_role_name = aws_iam_role.nodes-complex-example-com.name
Expand All @@ -25,7 +25,7 @@ output "master_autoscaling_group_ids" {
}

output "master_security_group_ids" {
value = [aws_security_group.masters-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4"]
value = [aws_security_group.masters-complex-example-com.id, "sg-exampleid3", "sg-exampleid4"]
}

output "masters_role_arn" {
Expand All @@ -41,7 +41,7 @@ output "node_autoscaling_group_ids" {
}

output "node_security_group_ids" {
value = [aws_security_group.nodes-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4", "sg-exampleid3", "sg-exampleid4"]
value = [aws_security_group.nodes-complex-example-com.id, "sg-exampleid3", "sg-exampleid3", "sg-exampleid4", "sg-exampleid4"]
}

output "node_subnet_ids" {
Expand Down Expand Up @@ -301,7 +301,7 @@ resource "aws_launch_template" "master-us-test-1a-masters-complex-example-com" {
network_interfaces {
associate_public_ip_address = true
delete_on_termination = true
security_groups = [aws_security_group.masters-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4"]
security_groups = [aws_security_group.masters-complex-example-com.id, "sg-exampleid3", "sg-exampleid4"]
}
tag_specifications {
resource_type = "instance"
Expand Down Expand Up @@ -375,7 +375,7 @@ resource "aws_launch_template" "nodes-complex-example-com" {
network_interfaces {
associate_public_ip_address = true
delete_on_termination = true
security_groups = [aws_security_group.nodes-complex-example-com.id, "nlb-sg-exampleid3", "nlb-sg-exampleid4", "sg-exampleid3", "sg-exampleid4"]
security_groups = [aws_security_group.nodes-complex-example-com.id, "sg-exampleid3", "sg-exampleid3", "sg-exampleid4", "sg-exampleid4"]
}
tag_specifications {
resource_type = "instance"
Expand Down