2017-11-05 20:01:50 +01:00
|
|
|
# Static IPv4 address for the Network Load Balancer
|
2017-06-27 06:55:39 +02:00
|
|
|
resource "google_compute_address" "ingress-ip" {
|
2018-03-04 01:21:38 +01:00
|
|
|
name = "${var.name}-ingress-ip"
|
2017-06-27 06:55:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Network Load Balancer (i.e. forwarding rules)
|
|
|
|
resource "google_compute_forwarding_rule" "worker-http-lb" {
|
2018-03-04 01:21:38 +01:00
|
|
|
name = "${var.name}-worker-http-rule"
|
2017-06-27 06:55:39 +02:00
|
|
|
ip_address = "${google_compute_address.ingress-ip.address}"
|
|
|
|
port_range = "80"
|
|
|
|
target = "${google_compute_target_pool.workers.self_link}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_compute_forwarding_rule" "worker-https-lb" {
|
2018-03-04 01:21:38 +01:00
|
|
|
name = "${var.name}-worker-https-rule"
|
2017-06-27 06:55:39 +02:00
|
|
|
ip_address = "${google_compute_address.ingress-ip.address}"
|
|
|
|
port_range = "443"
|
|
|
|
target = "${google_compute_target_pool.workers.self_link}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Network Load Balancer target pool of instances.
|
|
|
|
resource "google_compute_target_pool" "workers" {
|
2018-03-04 01:21:38 +01:00
|
|
|
name = "${var.name}-worker-pool"
|
2017-06-27 06:55:39 +02:00
|
|
|
|
|
|
|
health_checks = [
|
|
|
|
"${google_compute_http_health_check.ingress.name}",
|
|
|
|
]
|
|
|
|
|
|
|
|
session_affinity = "NONE"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Ingress HTTP Health Check
|
|
|
|
resource "google_compute_http_health_check" "ingress" {
|
2018-03-04 01:21:38 +01:00
|
|
|
name = "${var.name}-ingress-health"
|
2017-06-27 06:55:39 +02:00
|
|
|
description = "Health check Ingress controller health host port"
|
|
|
|
|
|
|
|
timeout_sec = 5
|
|
|
|
check_interval_sec = 5
|
|
|
|
|
|
|
|
healthy_threshold = 2
|
|
|
|
unhealthy_threshold = 4
|
|
|
|
|
|
|
|
port = 10254
|
|
|
|
request_path = "/healthz"
|
|
|
|
}
|