Skip to content

Commit 89ac986

Browse files
authored
[Part 3/3] Use latest OS image and use new metadata format (#60)
* [Part 3/3] Use latest OS image and use new metadata format - Removes the hardcoded OS image so that terraform will build a template with the latest os image - Previously, the metadata was hardcoded to ensure there were no diffs upon upgrading to the latest version of terraform. This change now uses the new format for metadata for containers. (Which would have caused a diff in part 1) * Update the cert-renewers update policy & README The cert-renewers had a different update policy. As a result, it needs more steps to deploy it after the terraform apply. This change makes it the same as the wpt live server. Also update the README for process wise what to do. The terraform changes should be approved before you do the deploy (which changes the state file). Create a PR with the terraform change, get it approved. Then do the deployment and create a separate PR with the state file changes
1 parent 145fee7 commit 89ac986

File tree

4 files changed

+6
-55
lines changed

4 files changed

+6
-55
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,6 @@ Cloud Platform with the state described by the configuration files in this
173173
repository:
174174

175175
terraform apply
176+
177+
Create a separate PR with the changes to the terraform.tfstate file after the
178+
deployment is successful.

infrastructure/web-platform-tests/compute.tf

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,7 @@ resource "google_compute_instance_template" "wpt_server" {
141141
# startup-script and tf_depends_id comes from the module previously used for wpt-server. (see link at top)
142142
# TODO: evaluate if those two should be removed.
143143
metadata = {
144-
# "${module.wpt-server-container.metadata_key}" = module.wpt-server-container.metadata_value
145-
# The value for ${module.wpt-server-container.metadata_key} is temporary. During the upgrade, the metadata rendering changes.
146-
# More info: https://github.com/terraform-google-modules/terraform-google-container-vm/blob/master/docs/upgrading_to_v2.0.md
147-
# Clarification to the linked docs, metadata changes will destroy the old template and create a new one.
148-
# In order to make this as smooth as possible, we will hardcode this.
149-
# When ready, remove this temporary metadata and the one on cert-renewer. And uncomment the line above.
150-
"${module.wpt-server-container.metadata_key}" = <<-EOT
151-
---
152-
spec:
153-
containers:
154-
- env:
155-
- name: WPT_HOST
156-
value: wpt.live
157-
- name: WPT_ALT_HOST
158-
value: not-wpt.live
159-
- name: WPT_BUCKET
160-
value: wpt-tot-certificates
161-
image: gcr.io/wpt-live/wpt-live-wpt-server-tot@sha256:5d7a3d7a5ca0ba4ca7f6e56ad62aa6342c9ab92d41eea24cc6ce4a9b1e2a6afe
162-
restartPolicy: Always
163-
volumes: []
164-
EOT
144+
"${module.wpt-server-container.metadata_key}" = module.wpt-server-container.metadata_value
165145
"startup-script" = ""
166146
"tf_depends_id" = ""
167147
"google-logging-enabled" = "true"
@@ -219,27 +199,7 @@ resource "google_compute_instance_template" "cert_renewers" {
219199
# startup-script and tf_depends_id comes from the module previously used for cert renewer. (see link at top)
220200
# TODO: evaluate if those two should be removed.
221201
metadata = {
222-
# "${module.cert-renewer-container.metadata_key}" = module.cert-renewer-container.metadata_value
223-
# The value for ${module.cert-renewer-container.metadata_key} is temporary. During the upgrade, the metadata rendering changes.
224-
# More info: https://github.com/terraform-google-modules/terraform-google-container-vm/blob/master/docs/upgrading_to_v2.0.md
225-
# Clarification to the linked docs, metadata changes will destroy the old template and create a new one.
226-
# In order to make this as smooth as possible, we will hardcode this.
227-
# When ready, remove this temporary metadata and the one on wpt-server. And uncomment the line above.
228-
"${module.cert-renewer-container.metadata_key}" = <<-EOT
229-
---
230-
spec:
231-
containers:
232-
- env:
233-
- name: WPT_HOST
234-
value: wpt.live
235-
- name: WPT_ALT_HOST
236-
value: not-wpt.live
237-
- name: WPT_BUCKET
238-
value: wpt-tot-certificates
239-
image: gcr.io/wpt-live/wpt-live-cert-renewer@sha256:5b3c0a3a2b0d7e2a0e1c0303874d09bb3214aa93dec55ac245cf1c81e7d117d5
240-
restartPolicy: Always
241-
volumes: []
242-
EOT
202+
"${module.cert-renewer-container.metadata_key}" = module.cert-renewer-container.metadata_value
243203
"startup-script" = ""
244204
"tf_depends_id" = ""
245205
"google-logging-enabled" = "true"
@@ -270,9 +230,7 @@ resource "google_compute_instance_group_manager" "cert_renewers" {
270230
zone = var.zone
271231

272232
update_policy {
273-
# The type is different from wpt servers's update policy.
274-
# TODO: Evaluate why
275-
type = "OPPORTUNISTIC"
233+
type = local.update_policy.type
276234
minimal_action = local.update_policy.minimal_action
277235
max_unavailable_fixed = local.update_policy.max_unavailable_fixed
278236
}

infrastructure/web-platform-tests/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ module "wpt-server-container" {
1515
source = "terraform-google-modules/container-vm/google"
1616
version = "3.0.0"
1717

18-
# Temporary variable
19-
cos_image_name = var.cos_image_name
2018
container = {
2119
image = var.wpt_server_image
2220
env = [
@@ -42,8 +40,6 @@ module "cert-renewer-container" {
4240
source = "terraform-google-modules/container-vm/google"
4341
version = "3.0.0"
4442

45-
# Temporary variable
46-
cos_image_name = var.cos_image_name
4743
container = {
4844
image = var.cert_renewer_image
4945
env = [

infrastructure/web-platform-tests/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,3 @@ variable "cert_renewer_ports" {
103103
}
104104
]
105105
}
106-
107-
variable "cos_image_name" {
108-
description = "Name of specific COS image. Temporary variable. Will remove here and in main.tf once ready to upgrade. More info: https://github.com/terraform-google-modules/terraform-google-container-vm/blob/5e69eafaaaa8302c5732799e32d1da5c17b7b285/variables.tf#L46"
109-
type = string
110-
default = "cos-stable-85-13310-1209-17"
111-
}

0 commit comments

Comments
 (0)