Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
gitlab-com
gitlab-com-infrastructure
Commits
2242436f
Commit
2242436f
authored
Apr 04, 2018
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pages and altssh load balancers.
parent
6cbe5f5e
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
22 deletions
+144
-22
environments/gprd/main.tf
environments/gprd/main.tf
+88
-0
environments/gprd/variables.tf
environments/gprd/variables.tf
+49
-17
modules/google/tcp-lb/loadbalancing.tf
modules/google/tcp-lb/loadbalancing.tf
+5
-5
modules/google/tcp-lb/variables.tf
modules/google/tcp-lb/variables.tf
+2
-0
No files found.
environments/gprd/main.tf
View file @
2242436f
...
...
@@ -511,13 +511,67 @@ module "fe-lb" {
vpc
=
"
${module
.
network
.
self_link
}
"
}
##################################
#
# External LoadBalancer Pages
#
##################################
module
"fe-lb-pages"
{
bootstrap_version
=
3
chef_provision
=
"
${
var
.
chef_provision
}
"
chef_run_list
=
"
\"
role[
${
var
.
environment
}
-base-lb-pages]
\"
"
dns_zone_name
=
"
${
var
.
dns_zone_name
}
"
environment
=
"
${
var
.
environment
}
"
ip_cidr_range
=
"
${
var
.
subnetworks
[
"fe-lb-pages"
]
}
"
machine_type
=
"
${
var
.
machine_types
[
"fe-lb"
]
}
"
name
=
"fe-pages"
node_count
=
"
${
var
.
node_count
[
"fe-lb-pages"
]
}
"
project
=
"
${
var
.
project
}
"
public_ports
=
"
${
var
.
public_ports
[
"fe-lb"
]
}
"
region
=
"
${
var
.
region
}
"
source
=
"../../modules/google/generic-sv-with-group"
health_check
=
"http"
service_port
=
7331
tier
=
"lb"
vpc
=
"
${module
.
network
.
self_link
}
"
}
##################################
#
# External LoadBalancer AltSSH
#
##################################
module
"fe-lb-altssh"
{
bootstrap_version
=
3
chef_provision
=
"
${
var
.
chef_provision
}
"
chef_run_list
=
"
\"
role[
${
var
.
environment
}
-base-lb-altssh]
\"
"
dns_zone_name
=
"
${
var
.
dns_zone_name
}
"
environment
=
"
${
var
.
environment
}
"
ip_cidr_range
=
"
${
var
.
subnetworks
[
"fe-lb-altssh"
]
}
"
machine_type
=
"
${
var
.
machine_types
[
"fe-lb"
]
}
"
name
=
"fe-altssh"
node_count
=
"
${
var
.
node_count
[
"fe-lb-altssh"
]
}
"
project
=
"
${
var
.
project
}
"
public_ports
=
"
${
var
.
public_ports
[
"fe-lb"
]
}
"
region
=
"
${
var
.
region
}
"
source
=
"../../modules/google/generic-sv-with-group"
health_check
=
"http"
service_port
=
7331
tier
=
"lb"
vpc
=
"
${module
.
network
.
self_link
}
"
}
##################################
#
# GCP TCP LoadBalancers
#
##################################
#### Load balancer for the main site
module
"gcp-tcp-lb"
{
name
=
"gcp-tcp-lb"
lb_count
=
"
${
length
(
var
.
tcp_lbs
[
"names"
])
}
"
names
=
"
${
var
.
tcp_lbs
[
"names"
]
}
"
fqdn
=
"
${
var
.
lb_fqdn
}
"
...
...
@@ -532,6 +586,40 @@ module "gcp-tcp-lb" {
instances
=
[
"
${module
.
fe-lb
.
instances_self_link
}
"
]
}
#### Load balancer for pages
module
"gcp-tcp-lb-pages"
{
name
=
"gcp-tcp-lb-pages"
lb_count
=
"
${
length
(
var
.
tcp_lbs_pages
[
"names"
])
}
"
names
=
"
${
var
.
tcp_lbs_pages
[
"names"
]
}
"
fqdn
=
"
${
var
.
lb_fqdn_pages
}
"
gitlab_com_zone_id
=
"
${
var
.
gitlab_com_zone_id
}
"
environment
=
"
${
var
.
environment
}
"
region
=
"
${
var
.
region
}
"
project
=
"
${
var
.
project
}
"
source
=
"../../modules/google/tcp-lb"
targets
=
[
"fe-pages"
]
forwarding_port_ranges
=
"
${
var
.
tcp_lbs_pages
[
"forwarding_port_ranges"
]
}
"
health_check_ports
=
"
${
var
.
tcp_lbs_pages
[
"health_check_ports"
]
}
"
instances
=
[
"
${module
.
fe-lb-pages
.
instances_self_link
}
"
]
}
#### Load balancer for altssh
module
"gcp-tcp-lb-altssh"
{
name
=
"gcp-tcp-lb-altssh"
lb_count
=
"
${
length
(
var
.
tcp_lbs_altssh
[
"names"
])
}
"
names
=
"
${
var
.
tcp_lbs_altssh
[
"names"
]
}
"
fqdn
=
"
${
var
.
lb_fqdn_altssh
}
"
gitlab_com_zone_id
=
"
${
var
.
gitlab_com_zone_id
}
"
environment
=
"
${
var
.
environment
}
"
region
=
"
${
var
.
region
}
"
project
=
"
${
var
.
project
}
"
source
=
"../../modules/google/tcp-lb"
targets
=
[
"fe-altssh"
]
forwarding_port_ranges
=
"
${
var
.
tcp_lbs_altssh
[
"forwarding_port_ranges"
]
}
"
health_check_ports
=
"
${
var
.
tcp_lbs_altssh
[
"health_check_ports"
]
}
"
instances
=
[
"
${module
.
fe-lb-altssh
.
instances_self_link
}
"
]
}
##################################
#
# Consul
...
...
environments/gprd/variables.tf
View file @
2242436f
...
...
@@ -25,6 +25,14 @@ variable "lb_fqdn" {
default
=
"lb-test.gprd.gitlab.com"
}
variable
"lb_fqdn_altssh"
{
default
=
"lb-test-altssh.gprd.gitlab.com"
}
variable
"lb_fqdn_pages"
{
default
=
"lb-test-pages.gprd.gitlab.com"
}
#
# For every name there must be a corresponding
# forwarding port range and health check port
...
...
@@ -40,6 +48,26 @@ variable "tcp_lbs" {
}
}
variable
"tcp_lbs_pages"
{
type
=
"map"
default
=
{
"names"
=
[
"http"
,
"https"
]
"forwarding_port_ranges"
=
[
"80"
,
"443"
]
"health_check_ports"
=
[
"8001"
,
"8002"
]
}
}
variable
"tcp_lbs_altssh"
{
type
=
"map"
default
=
{
"names"
=
[
"ssh"
]
"forwarding_port_ranges"
=
[
"22"
]
"health_check_ports"
=
[
"8003"
]
}
}
#######################
variable
"base_chef_run_list"
{
...
...
@@ -166,6 +194,8 @@ variable "node_count" {
"consul"
=
3
"db"
=
1
"fe-lb"
=
2
"fe-lb-altssh"
=
2
"fe-lb-pages"
=
2
"geodb"
=
1
"git"
=
2
"lfs"
=
1
...
...
@@ -193,23 +223,25 @@ variable "subnetworks" {
type
=
"map"
default
=
{
"api"
=
"10.220.2.0/23"
"deploy"
=
"10.218.3.0/24"
"runner"
=
"10.218.4.0/24"
"consul"
=
"10.218.1.0/24"
"db"
=
"10.217.1.0/24"
"fe-lb"
=
"10.216.1.0/24"
"geodb"
=
"10.217.6.0/24"
"monitoring"
=
"10.219.1.0/24"
"git"
=
"10.220.4.0/23"
"mailroom"
=
"10.220.14.0/23"
"pgb"
=
"10.217.4.0/24"
"redis"
=
"10.217.2.0/24"
"redis-cache"
=
"10.217.5.0/24"
"registry"
=
"10.220.10.0/23"
"sidekiq"
=
"10.220.6.0/23"
"stor"
=
"10.221.2.0/23"
"web"
=
"10.220.8.0/23"
"api"
=
"10.220.2.0/23"
"deploy"
=
"10.218.3.0/24"
"runner"
=
"10.218.4.0/24"
"consul"
=
"10.218.1.0/24"
"db"
=
"10.217.1.0/24"
"fe-lb"
=
"10.216.1.0/24"
"fe-lb-pages"
=
"10.216.2.0/24"
"fe-lb-altssh"
=
"10.216.3.0/24"
"geodb"
=
"10.217.6.0/24"
"monitoring"
=
"10.219.1.0/24"
"git"
=
"10.220.4.0/23"
"mailroom"
=
"10.220.14.0/23"
"pgb"
=
"10.217.4.0/24"
"redis"
=
"10.217.2.0/24"
"redis-cache"
=
"10.217.5.0/24"
"registry"
=
"10.220.10.0/23"
"sidekiq"
=
"10.220.6.0/23"
"stor"
=
"10.221.2.0/23"
"web"
=
"10.220.8.0/23"
###############################
# These will eventually (tm) be
...
...
modules/google/tcp-lb/loadbalancing.tf
View file @
2242436f
...
...
@@ -9,14 +9,14 @@ resource "aws_route53_record" "default" {
}
resource
"google_compute_address"
"default"
{
name
=
"
http
"
name
=
"
${
format
(
"%v-%v"
,
var
.
environment
,
var
.
name
)
}
"
project
=
"
${
var
.
project
}
"
region
=
"
${
var
.
region
}
"
address_type
=
"EXTERNAL"
}
resource
"google_compute_firewall"
"default"
{
name
=
"
${
format
(
"%v-
tcp-lb
"
,
var
.
environment
)
}
"
name
=
"
${
format
(
"%v-
%v
"
,
var
.
environment
,
var
.
name
)
}
"
network
=
"
${
var
.
environment
}
"
allow
{
...
...
@@ -30,7 +30,7 @@ resource "google_compute_firewall" "default" {
resource
"google_compute_forwarding_rule"
"default"
{
count
=
"
${
var
.
lb_count
}
"
name
=
"
${
format
(
"%v-
tcp-lb
-%v"
,
var
.
environment
,
var
.
names
[
count
.
index
])
}
"
name
=
"
${
format
(
"%v-
%v
-%v"
,
var
.
environment
,
var
.
name
,
var
.
names
[
count
.
index
])
}
"
project
=
"
${
var
.
project
}
"
region
=
"
${
var
.
region
}
"
target
=
"
${
google_compute_target_pool
.
default
.
*
.
self_link
[
count
.
index
]
}
"
...
...
@@ -41,7 +41,7 @@ resource "google_compute_forwarding_rule" "default" {
resource
"google_compute_target_pool"
"default"
{
count
=
"
${
var
.
lb_count
}
"
name
=
"
${
format
(
"%v-
tcp-lb
-%v"
,
var
.
environment
,
var
.
names
[
count
.
index
])
}
"
name
=
"
${
format
(
"%v-
%v
-%v"
,
var
.
environment
,
var
.
name
,
var
.
names
[
count
.
index
])
}
"
project
=
"
${
var
.
project
}
"
region
=
"
${
var
.
region
}
"
session_affinity
=
"NONE"
...
...
@@ -54,7 +54,7 @@ resource "google_compute_target_pool" "default" {
resource
"google_compute_http_health_check"
"default"
{
count
=
"
${
var
.
lb_count
}
"
name
=
"
${
format
(
"%v-
tcp-lb
-%v"
,
var
.
environment
,
var
.
names
[
count
.
index
])
}
"
name
=
"
${
format
(
"%v-
%v
-%v"
,
var
.
environment
,
var
.
name
,
var
.
names
[
count
.
index
])
}
"
project
=
"
${
var
.
project
}
"
port
=
"
${
var
.
health_check_ports
[
count
.
index
]
}
"
request_path
=
"/-/available-
${
var
.
names
[
count
.
index
]
}
"
...
...
modules/google/tcp-lb/variables.tf
View file @
2242436f
...
...
@@ -25,6 +25,8 @@ variable "environment" {
description
=
"The environment name"
}
variable
"name"
{}
variable
"names"
{
type
=
"list"
description
=
"Names for the lbs"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment