-
Notifications
You must be signed in to change notification settings - Fork 1.5k
*: clean up AWS ELBs #242
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
*: clean up AWS ELBs #242
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,3 @@ | ||
| resource "aws_elb" "tnc" { | ||
| count = "${var.private_master_endpoints ? 1 : 0}" | ||
| name = "${var.cluster_name}-tnc" | ||
| subnets = ["${local.master_subnet_ids}"] | ||
| internal = true | ||
| security_groups = ["${aws_security_group.tnc.id}"] | ||
|
|
||
| idle_timeout = 3600 | ||
| connection_draining = true | ||
| connection_draining_timeout = 300 | ||
|
|
||
| listener { | ||
| instance_port = 49500 | ||
| instance_protocol = "tcp" | ||
| lb_port = 80 | ||
| lb_protocol = "tcp" | ||
| } | ||
|
|
||
| health_check { | ||
| healthy_threshold = 2 | ||
| unhealthy_threshold = 2 | ||
| timeout = 3 | ||
| target = "TCP:49500" | ||
| interval = 5 | ||
| } | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}-int", | ||
| "kubernetes.io/cluster/${var.cluster_name}", "owned", | ||
| "tectonicClusterID", "${var.cluster_id}" | ||
| ), var.extra_tags)}" | ||
| } | ||
|
|
||
| resource "aws_elb" "api_internal" { | ||
| count = "${var.private_master_endpoints ? 1 : 0}" | ||
| name = "${var.cluster_name}-int" | ||
|
|
@@ -49,6 +16,13 @@ resource "aws_elb" "api_internal" { | |
| lb_protocol = "tcp" | ||
| } | ||
|
|
||
| listener { | ||
| instance_port = 49500 | ||
| instance_protocol = "tcp" | ||
| lb_port = 49500 | ||
| lb_protocol = "tcp" | ||
| } | ||
|
|
||
| health_check { | ||
| healthy_threshold = 2 | ||
| unhealthy_threshold = 2 | ||
|
|
@@ -57,6 +31,15 @@ resource "aws_elb" "api_internal" { | |
| interval = 5 | ||
| } | ||
|
|
||
| # TODO: we only have on health_check per ELB but need to check the following too | ||
| # health_check { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these disabled?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An ELB can only have one health_check. We'll need to come up with a different solution for these.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So drop the commented-out code and file an issue? Do we need to continue to health-check 49500 independently?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add this as comment above.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we like TODOs in the code? If not I'll opt for removing the code altogether
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 49500 doesn't need a health check because Ignition uses a random resolver. If the endpoint is down, Ignition will try another IP address.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if all are down?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they are all down, Ignition keeps retrying. |
||
| # healthy_threshold = 2 | ||
| # unhealthy_threshold = 2 | ||
| # timeout = 3 | ||
| # target = "TCP:49500" | ||
| # interval = 5 | ||
| # } | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}-int", | ||
| "kubernetes.io/cluster/${var.cluster_name}", "owned", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,23 +42,19 @@ output "aws_elb_console_id" { | |
| value = "${aws_elb.console.id}" | ||
| } | ||
|
|
||
| output "aws_elb_tnc_id" { | ||
| value = "${aws_elb.tnc.0.id}" | ||
| } | ||
|
|
||
| output "aws_lbs" { | ||
| value = ["${compact(concat(aws_elb.api_internal.*.id, list(aws_elb.console.id), aws_elb.api_external.*.id, aws_elb.tnc.*.id))}"] | ||
| value = ["${compact(concat(aws_elb.api_internal.*.id, list(aws_elb.console.id), aws_elb.api_external.*.id))}"] | ||
| } | ||
|
|
||
| output "aws_api_external_dns_name" { | ||
| output "aws_elb_api_external_dns_name" { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I don't know if we want to handle this incrementally or not, but But it's also nice to keep this diff small and the variables consistent, and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That was my intention. Now it's consistent within the current scheme, which can be refactored followiing up to this change. |
||
| value = "${element(concat(aws_elb.api_external.*.dns_name, list("")), 0)}" | ||
| } | ||
|
|
||
| output "aws_elb_api_external_zone_id" { | ||
| value = "${element(concat(aws_elb.api_external.*.zone_id, list("")), 0)}" | ||
| } | ||
|
|
||
| output "aws_api_internal_dns_name" { | ||
| output "aws_elb_api_internal_dns_name" { | ||
| value = "${element(concat(aws_elb.api_internal.*.dns_name, list("")), 0)}" | ||
| } | ||
|
|
||
|
|
@@ -73,11 +69,3 @@ output "aws_console_dns_name" { | |
| output "aws_elb_console_zone_id" { | ||
| value = "${aws_elb.console.zone_id}" | ||
| } | ||
|
|
||
| output "aws_elb_tnc_dns_name" { | ||
| value = "${element(concat(aws_elb.tnc.*.dns_name, list("")), 0)}" | ||
| } | ||
|
|
||
| output "aws_elb_tnc_zone_id" { | ||
| value = "${element(concat(aws_elb.tnc.*.zone_id, list("")), 0)}" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,3 @@ | ||
| resource "aws_security_group" "tnc" { | ||
| vpc_id = "${data.aws_vpc.cluster_vpc.id}" | ||
|
|
||
| tags = "${merge(map( | ||
| "Name", "${var.cluster_name}_tnc_sg", | ||
| "kubernetes.io/cluster/${var.cluster_name}", "owned", | ||
| "tectonicClusterID", "${var.cluster_id}" | ||
| ), var.extra_tags)}" | ||
| } | ||
|
|
||
| resource "aws_security_group_rule" "tnc_egress" { | ||
| type = "egress" | ||
| security_group_id = "${aws_security_group.tnc.id}" | ||
|
|
||
| from_port = 0 | ||
| to_port = 0 | ||
| protocol = "-1" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| } | ||
|
|
||
| resource "aws_security_group_rule" "tnc_ingress_http" { | ||
| type = "ingress" | ||
| security_group_id = "${aws_security_group.tnc.id}" | ||
|
|
||
| protocol = "tcp" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| from_port = 80 | ||
| to_port = 80 | ||
| } | ||
|
|
||
| resource "aws_security_group_rule" "tnc_ingress_https" { | ||
| type = "ingress" | ||
| security_group_id = "${aws_security_group.tnc.id}" | ||
|
|
||
| protocol = "tcp" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| from_port = 443 | ||
| to_port = 443 | ||
| } | ||
|
|
||
| resource "aws_security_group" "api" { | ||
| vpc_id = "${data.aws_vpc.cluster_vpc.id}" | ||
|
|
||
|
|
@@ -68,6 +28,16 @@ resource "aws_security_group_rule" "api_ingress_console" { | |
| to_port = 6443 | ||
| } | ||
|
|
||
| resource "aws_security_group_rule" "tnc_ingress" { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to keep the rename out of scope here see #242 (comment).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can put it in a different commit, but it belongs in this PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it the rename is not related to the logic of this PR which is to consolidate ELBs and not rename stuff, I added the commit anyway so y'all are happy ;-) |
||
| type = "ingress" | ||
| security_group_id = "${aws_security_group.api.id}" | ||
|
|
||
| protocol = "tcp" | ||
| cidr_blocks = ["0.0.0.0/0"] | ||
| from_port = 49500 | ||
| to_port = 49500 | ||
| } | ||
|
|
||
| resource "aws_security_group" "console" { | ||
| vpc_id = "${data.aws_vpc.cluster_vpc.id}" | ||
|
|
||
|
|
||
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.
No longer TNC
getMCSURL?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.
I'm in favor of writing out anything project-specific. Folks likely have seen URL before, which would make this
getMachineConfigServerURL.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.
I'd like to keep the rename out of scope here see #242 (comment).
(I know I'm repeating myself here :-D)