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

Avoid spurious changes for ASG InstanceProtection and LT InstanceMonitoring #11873

Merged
merged 1 commit into from
Jun 28, 2021
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
12 changes: 10 additions & 2 deletions pkg/model/awsmodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
IAMInstanceProfile: link,
ImageID: fi.String(ig.Spec.Image),
InstanceInterruptionBehavior: ig.Spec.InstanceInterruptionBehavior,
InstanceMonitoring: ig.Spec.DetailedInstanceMonitoring,
InstanceMonitoring: fi.Bool(false),
InstanceType: fi.String(strings.Split(ig.Spec.MachineType, ",")[0]),
IPv6AddressCount: fi.Int64(0),
RootVolumeIops: fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops))),
Expand Down Expand Up @@ -267,6 +267,10 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
})
}

if ig.Spec.DetailedInstanceMonitoring != nil {
lt.InstanceMonitoring = ig.Spec.DetailedInstanceMonitoring
}

if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit != nil {
lt.HTTPPutResponseHopLimit = ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit
}
Expand Down Expand Up @@ -384,6 +388,8 @@ func (b *AutoscalingGroupModelBuilder) buildAutoScalingGroupTask(c *fi.ModelBuil
"GroupTerminatingInstances",
"GroupTotalInstances",
},

InstanceProtection: fi.Bool(false),
}

minSize := fi.Int64(1)
Expand Down Expand Up @@ -423,7 +429,9 @@ func (b *AutoscalingGroupModelBuilder) buildAutoScalingGroupTask(c *fi.ModelBuil
processes = append(processes, ig.Spec.SuspendProcesses...)
t.SuspendProcesses = &processes

t.InstanceProtection = ig.Spec.InstanceProtection
if ig.Spec.InstanceProtection != nil {
t.InstanceProtection = ig.Spec.InstanceProtection
}

t.LoadBalancers = []*awstasks.ClassicLoadBalancer{}
t.TargetGroups = []*awstasks.TargetGroup{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down Expand Up @@ -439,6 +442,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down Expand Up @@ -586,6 +592,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down
24 changes: 16 additions & 8 deletions tests/integration/update_cluster/aws-lb-controller/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-example-com"
id = aws_launch_template.master-us-test-1a-masters-minimal-example-com.id
version = aws_launch_template.master-us-test-1a-masters-minimal-example-com.latest_version
}
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.minimal.example.com"
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.minimal.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -169,10 +170,11 @@ resource "aws_autoscaling_group" "nodes-minimal-example-com" {
id = aws_launch_template.nodes-minimal-example-com.id
version = aws_launch_template.nodes-minimal-example-com.latest_version
}
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.minimal.example.com"
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.minimal.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -387,6 +389,9 @@ resource "aws_launch_template" "master-us-test-1a-masters-minimal-example-com" {
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "master-us-test-1a.masters.minimal.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down Expand Up @@ -465,6 +470,9 @@ resource "aws_launch_template" "nodes-minimal-example-com" {
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "nodes.minimal.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ resource "aws_autoscaling_group" "bastion-bastionuserdata-example-com" {
id = aws_launch_template.bastion-bastionuserdata-example-com.id
version = aws_launch_template.bastion-bastionuserdata-example-com.latest_version
}
load_balancers = [aws_elb.bastion-bastionuserdata-example-com.id]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "bastion.bastionuserdata.example.com"
load_balancers = [aws_elb.bastion-bastionuserdata-example-com.id]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "bastion.bastionuserdata.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -165,11 +166,12 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-bastionuserdata-exam
id = aws_launch_template.master-us-test-1a-masters-bastionuserdata-example-com.id
version = aws_launch_template.master-us-test-1a-masters-bastionuserdata-example-com.latest_version
}
load_balancers = [aws_elb.api-bastionuserdata-example-com.id]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.bastionuserdata.example.com"
load_balancers = [aws_elb.api-bastionuserdata-example-com.id]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.bastionuserdata.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -229,10 +231,11 @@ resource "aws_autoscaling_group" "nodes-bastionuserdata-example-com" {
id = aws_launch_template.nodes-bastionuserdata-example-com.id
version = aws_launch_template.nodes-bastionuserdata-example-com.latest_version
}
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.bastionuserdata.example.com"
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.bastionuserdata.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -486,6 +489,9 @@ resource "aws_launch_template" "bastion-bastionuserdata-example-com" {
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "bastion.bastionuserdata.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down Expand Up @@ -559,6 +565,9 @@ resource "aws_launch_template" "master-us-test-1a-masters-bastionuserdata-exampl
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "master-us-test-1a.masters.bastionuserdata.example.com"
network_interfaces {
associate_public_ip_address = false
Expand Down Expand Up @@ -637,6 +646,9 @@ resource "aws_launch_template" "nodes-bastionuserdata-example-com" {
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "nodes.bastionuserdata.example.com"
network_interfaces {
associate_public_ip_address = false
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/update_cluster/complex/cloudformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "required"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down
27 changes: 16 additions & 11 deletions tests/integration/update_cluster/complex/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-complex-example-com"
id = aws_launch_template.master-us-test-1a-masters-complex-example-com.id
version = aws_launch_template.master-us-test-1a-masters-complex-example-com.latest_version
}
load_balancers = ["my-external-lb-1"]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.complex.example.com"
load_balancers = ["my-external-lb-1"]
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.complex.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -176,12 +177,13 @@ resource "aws_autoscaling_group" "nodes-complex-example-com" {
id = aws_launch_template.nodes-complex-example-com.id
version = aws_launch_template.nodes-complex-example-com.latest_version
}
load_balancers = ["my-external-lb-1"]
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.complex.example.com"
suspended_processes = ["AZRebalance"]
load_balancers = ["my-external-lb-1"]
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.complex.example.com"
protect_from_scale_in = false
suspended_processes = ["AZRebalance"]
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -369,6 +371,9 @@ resource "aws_launch_template" "master-us-test-1a-masters-complex-example-com" {
http_put_response_hop_limit = 1
http_tokens = "required"
}
monitoring {
enabled = false
}
name = "master-us-test-1a.masters.complex.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down
24 changes: 16 additions & 8 deletions tests/integration/update_cluster/compress/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-compress-example-com
id = aws_launch_template.master-us-test-1a-masters-compress-example-com.id
version = aws_launch_template.master-us-test-1a-masters-compress-example-com.latest_version
}
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.compress.example.com"
max_size = 1
metrics_granularity = "1Minute"
min_size = 1
name = "master-us-test-1a.masters.compress.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -149,10 +150,11 @@ resource "aws_autoscaling_group" "nodes-compress-example-com" {
id = aws_launch_template.nodes-compress-example-com.id
version = aws_launch_template.nodes-compress-example-com.latest_version
}
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.compress.example.com"
max_size = 2
metrics_granularity = "1Minute"
min_size = 2
name = "nodes.compress.example.com"
protect_from_scale_in = false
tag {
key = "KubernetesCluster"
propagate_at_launch = true
Expand Down Expand Up @@ -313,6 +315,9 @@ resource "aws_launch_template" "master-us-test-1a-masters-compress-example-com"
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "master-us-test-1a.masters.compress.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down Expand Up @@ -390,6 +395,9 @@ resource "aws_launch_template" "nodes-compress-example-com" {
http_put_response_hop_limit = 1
http_tokens = "optional"
}
monitoring {
enabled = false
}
name = "nodes.compress.example.com"
network_interfaces {
associate_public_ip_address = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down Expand Up @@ -382,6 +385,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down Expand Up @@ -382,6 +385,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down Expand Up @@ -382,6 +385,9 @@
"HttpPutResponseHopLimit": 1,
"HttpTokens": "optional"
},
"Monitoring": {
"Enabled": false
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": true,
Expand Down
Loading