Skip to content

Commit 8da5bd6

Browse files
committed
sandbox: update configuration to match production
- Specify the correct image in konlet.yaml. gvisor-playground-sandbox is the child-process container. - Correct interpolation in config identifiers, which is deprecated. - Set min_ready_sec for update policy to not cause an outage when updating - Use name_prefix for instance_template instead of name, which allows updates. Templates are immutable, so previously this was not possible to update. Updates golang/go#38530 Updates golang/go#25224 Change-Id: I3f7618b8e378eaa9714e571b90390b7052bf2855 Reviewed-on: https://go-review.googlesource.com/c/playground/+/229418 Run-TryBot: Alexander Rakoczy <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent b8c0e2b commit 8da5bd6

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

sandbox/konlet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
spec:
22
containers:
33
- name: playground
4-
image: 'gcr.io/PROJECT_NAME/gvisor-playground-sandbox:latest'
4+
image: 'gcr.io/PROJECT_NAME/playground-sandbox:latest'
55
volumeMounts:
66
- name: dockersock
77
mountPath: /var/run/docker.sock

sandbox/sandbox.tf

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ data "google_compute_image" "cos" {
3535
}
3636

3737
resource "google_compute_instance_template" "inst_tmpl" {
38-
name = "play-sandbox-tmpl"
38+
name_prefix = "play-sandbox-tmpl"
3939
machine_type = "n1-standard-8"
40-
metadata = {
40+
metadata = {
4141
"ssh-keys" = "bradfitz:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaRpEbckQ+harGnrKUjk3JziwYqvz2bRNn0ngpzROaeCwm1XetDby/fgmQruZE/OBpbeOaCOd/yyP89Oer9CJx41AFEfHbudePZti/y+fmZ05N+QoBSAG0JtYWVydIjAjCenKBbNrYmwcQ840uNdIv9Ztqu3lbO/syMgcajappzdqMlwVZuHTJUe1JQD355PiinFHPTa7l0MrZPfiSsBdiTGmO39iVa312yshu6dZAvDgRL+bgIzTL6udPL/cVq+zlkvoZbzC4ajuZs4w2in+kqXHQSxbKHlXOhPrej1fwhspm+0Y7hEZOaN5Juc5GseNCHImtJh1rei1Qa4U/nTjt bradfitz@bradfitz-dev"
4242
"gce-container-declaration" = data.local_file.konlet.content
4343
"user-data" = data.local_file.cloud_init.content
@@ -63,11 +63,11 @@ resource "google_compute_instance_template" "inst_tmpl" {
6363
}
6464

6565
resource "google_compute_region_autoscaler" "default" {
66-
provider = "google-beta"
66+
provider = google-beta
6767

6868
name = "play-sandbox-autoscaler"
6969
region = "us-central1"
70-
target = "${google_compute_region_instance_group_manager.rigm.self_link}"
70+
target = google_compute_region_instance_group_manager.rigm.self_link
7171

7272
autoscaling_policy {
7373
max_replicas = 10
@@ -81,24 +81,32 @@ resource "google_compute_region_autoscaler" "default" {
8181
}
8282

8383
resource "google_compute_region_instance_group_manager" "rigm" {
84-
provider = "google-beta"
84+
provider = google-beta
8585
name = "play-sandbox-rigm"
8686

8787
base_instance_name = "playsandbox"
8888
region = "us-central1"
8989

9090
version {
9191
name = "primary"
92-
instance_template = "${google_compute_instance_template.inst_tmpl.self_link}"
92+
instance_template = google_compute_instance_template.inst_tmpl.self_link
9393
}
9494

9595
named_port {
9696
name = "http"
9797
port = 80
9898
}
99+
update_policy {
100+
type = "PROACTIVE"
101+
instance_redistribution_type = "PROACTIVE"
102+
minimal_action = "REPLACE"
103+
max_surge_fixed = 10
104+
max_unavailable_fixed = 0
105+
min_ready_sec = 60
106+
}
99107
}
100108

101109
data "google_compute_region_instance_group" "rig" {
102-
provider = "google-beta"
103-
self_link = "${google_compute_region_instance_group_manager.rigm.instance_group}"
110+
provider = google-beta
111+
self_link = google_compute_region_instance_group_manager.rigm.instance_group
104112
}

0 commit comments

Comments
 (0)