summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/infra.gentoo.org/main.tf2
-rw-r--r--src/infra.gentoo.org/rsync.tf38
2 files changed, 25 insertions, 15 deletions
diff --git a/src/infra.gentoo.org/main.tf b/src/infra.gentoo.org/main.tf
index 65b542c..5f3fb32 100644
--- a/src/infra.gentoo.org/main.tf
+++ b/src/infra.gentoo.org/main.tf
@@ -2,7 +2,7 @@ provider "google" {
# credentials are default
project = "gentoo-infra-dev"
region = "us-central1"
- zone = "us-central1a"
+ # zone = "us-central1-a"
}
diff --git a/src/infra.gentoo.org/rsync.tf b/src/infra.gentoo.org/rsync.tf
index 9709dde..bc7897d 100644
--- a/src/infra.gentoo.org/rsync.tf
+++ b/src/infra.gentoo.org/rsync.tf
@@ -1,16 +1,3 @@
-//resource "google_compute_region_instance_group_manager" "rsync-node-mig" {
-// name = "rsync-node-mig"
-
- //base_instance_name = "rsync-node"
-// instance_template = "${google_compute_instance_template.rsync-node-template.self_link}"
- // Terraform will not restart the VMs on deploy.
-// update_strategy = "NONE"
-// zone = "us-central1-a"
-
-// target_pools = ["${google_compute_target_pool.appserver.self_link}"]
-// target_size = 1
-//}
-
resource "google_compute_instance_template" "rsync-node-template" {
name = "rsync-node-template"
description = "This template is used to create rsync node instances."
@@ -46,7 +33,7 @@ resource "google_compute_instance_template" "rsync-node-template" {
metadata {
google-logging-enabled = "true"
- gcs-container-declaration = "spec:\n containers:\n - name: rsync-4\n image: us.gcr.io/gentoo-infra-dev/rsync-node:prod\n volumeMounts:\n - name: tmpfs-0\n mountPath: /srv/gentoo\n securityContext:\n privileged: true\n stdin: false\n tty: false\n restartPolicy: Always\n volumes:\n - name: tmpfs-0\n emptyDir:\n medium: Memory\n\n# This container declaration format is not public API and may change without notice. Please\n# use gcloud command-line tool or Google Cloud Console to run Containers on Google Compute Engine."
+ gcs-container-declaration = "spec:\n containers:\n - name: rsync-4\n image: us.gcr.io/gentoo-infra-dev/rsync-node:prod\n securityContext:\n privileged: true\n stdin: false\n tty: false\n restartPolicy: Always\n\n# This container declaration format is not public API and may change without notice. Please\n# use gcloud command-line tool or Google Cloud Console to run Containers on Google Compute Engine."
}
service_account {
@@ -60,3 +47,26 @@ resource "google_compute_instance_template" "rsync-node-template" {
]
}
}
+
+resource "google_compute_region_instance_group_manager" "rsync-node-mig" {
+ name = "rsync-node-mig"
+
+ base_instance_name = "rsync-node"
+ instance_template = "${google_compute_instance_template.rsync-node-template.self_link}"
+ update_strategy = "NONE"
+ region = "us-central1"
+ target_size = 1
+}
+
+resource "google_compute_region_autoscaler" "rsync-autoscaler" {
+ name = "rsync-autoscaler"
+ target = "${google_compute_region_instance_group_manager.rsync-node-mig.self_link}"
+ autoscaling_policy {
+ min_replicas = 1
+ max_replicas = 3
+ cooldown_period = 60
+ cpu_utilization {
+ target = 0.90
+ }
+ }
+}