Skip to content

Commit cbbd216

Browse files
cloudrunv2: add support to startupProbe and livenessProbe to worker pool (#15156)
1 parent b8e703b commit cbbd216

File tree

2 files changed

+220
-1
lines changed

2 files changed

+220
-1
lines changed

mmv1/products/cloudrunv2/WorkerPool.yaml

Lines changed: 159 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ examples:
114114
cloud_run_worker_pool_name: 'cloudrun-worker-pool'
115115
ignore_read_extra:
116116
- 'deletion_protection'
117-
# Currently failing
117+
# Currently failing
118118
skip_vcr: true
119119
- name: 'cloudrunv2_worker_pool_mount_nfs'
120120
primary_resource_id: 'default'
@@ -132,6 +132,16 @@ examples:
132132
cloud_run_worker_pool_name: 'cloudrun-worker-pool'
133133
ignore_read_extra:
134134
- 'deletion_protection'
135+
- name: 'cloudrunv2_worker_pool_startup_liveness_probe'
136+
primary_resource_id: 'default'
137+
primary_resource_name: 'fmt.Sprintf("tf-test-cloudrun-wp%s", context["random_suffix"])'
138+
vars:
139+
cloud_run_worker_pool_name: 'cloudrun-worker-pool'
140+
vpc_access_connector_name: 'wp-connector'
141+
compute_network_name: 'wp-net'
142+
vpc_compute_subnetwork_name: 'wp-subnet'
143+
ignore_read_extra:
144+
- 'deletion_protection'
135145
virtual_fields:
136146
- name: 'deletion_protection'
137147
description: |
@@ -486,6 +496,154 @@ properties:
486496
type: String
487497
description: |-
488498
Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.
499+
- name: 'livenessProbe'
500+
type: NestedObject
501+
description: |-
502+
Periodic probe of container liveness. Container will be restarted if the probe fails.
503+
properties:
504+
- name: 'initialDelaySeconds'
505+
default_value: 0
506+
description: |-
507+
Optional. Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240.
508+
type: Integer
509+
- name: 'timeoutSeconds'
510+
default_value: 1
511+
description: |-
512+
Optional. Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than period_seconds.
513+
type: Integer
514+
- name: 'periodSeconds'
515+
default_value: 10
516+
description: |-
517+
Optional. How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeout_seconds.
518+
type: Integer
519+
- name: 'failureThreshold'
520+
default_value: 3
521+
description: |-
522+
Optional. Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.
523+
type: Integer
524+
- name: 'httpGet'
525+
description: |-
526+
Optional. HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must be specified.
527+
type: NestedObject
528+
properties:
529+
- name: 'path'
530+
description: |-
531+
Optional. Path to access on the HTTP server. Defaults to '/'.
532+
type: String
533+
- name: 'port'
534+
description: |-
535+
Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
536+
type: Integer
537+
- name: 'httpHeaders'
538+
description: |-
539+
Optional. Custom headers to set in the request. HTTP allows repeated headers.
540+
type: NestedObject
541+
properties:
542+
- name: 'port'
543+
required: true
544+
description: |-
545+
Required. The header field name
546+
type: Integer
547+
- name: 'value'
548+
description: |-
549+
Optional. The header field value
550+
type: String
551+
- name: 'tcpSocket'
552+
description: |-
553+
Optional. TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
554+
type: NestedObject
555+
properties:
556+
- name: 'port'
557+
description: |-
558+
Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
559+
type: Integer
560+
- name: 'grpc'
561+
description: |-
562+
Optional. GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
563+
type: NestedObject
564+
properties:
565+
- name: 'port'
566+
description: |-
567+
Optional. Port number of the gRPC service. Number must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
568+
type: Integer
569+
- name: 'service'
570+
description: |-
571+
Optional. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If this is not specified, the default behavior is defined by gRPC
572+
type: String
573+
- name: 'startupProbe'
574+
type: NestedObject
575+
description: |-
576+
Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails.
577+
properties:
578+
- name: 'initialDelaySeconds'
579+
default_value: 0
580+
description: |-
581+
Optional. Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240.
582+
type: Integer
583+
- name: 'timeoutSeconds'
584+
default_value: 1
585+
description: |-
586+
Optional. Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than period_seconds.
587+
type: Integer
588+
- name: 'periodSeconds'
589+
default_value: 10
590+
description: |-
591+
Optional. How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeout_seconds.
592+
type: Integer
593+
- name: 'failureThreshold'
594+
default_value: 3
595+
description: |-
596+
Optional. Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.
597+
type: Integer
598+
- name: 'httpGet'
599+
description: |-
600+
Optional. HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must be specified.
601+
type: NestedObject
602+
properties:
603+
- name: 'path'
604+
description: |-
605+
Optional. Path to access on the HTTP server. Defaults to '/'.
606+
type: String
607+
- name: 'port'
608+
description: |-
609+
Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
610+
type: Integer
611+
- name: 'httpHeaders'
612+
description: |-
613+
Optional. Custom headers to set in the request. HTTP allows repeated headers.
614+
type: NestedObject
615+
properties:
616+
- name: 'port'
617+
required: true
618+
description: |-
619+
Required. The header field name
620+
type: Integer
621+
- name: 'value'
622+
description: |-
623+
Optional. The header field value
624+
type: String
625+
- name: 'tcpSocket'
626+
description: |-
627+
Optional. TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
628+
type: NestedObject
629+
properties:
630+
- name: 'port'
631+
description: |-
632+
Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
633+
type: Integer
634+
- name: 'grpc'
635+
description: |-
636+
Optional. GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
637+
type: NestedObject
638+
properties:
639+
- name: 'port'
640+
description: |-
641+
Optional. Port number of the gRPC service. Number must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
642+
type: Integer
643+
- name: 'service'
644+
description: |-
645+
Optional. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If this is not specified, the default behavior is defined by gRPC
646+
type: String
489647
- name: 'volumes'
490648
type: Array
491649
description: |-
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
resource "google_compute_network" "custom_test" {
2+
name = "{{index $.Vars "compute_network_name"}}"
3+
auto_create_subnetworks = false
4+
}
5+
6+
resource "google_compute_subnetwork" "custom_test" {
7+
name = "{{index $.Vars "vpc_compute_subnetwork_name"}}"
8+
ip_cidr_range = "10.2.0.0/28"
9+
region = "us-central1"
10+
network = google_compute_network.custom_test.id
11+
}
12+
13+
resource "google_cloud_run_v2_worker_pool" "default" {
14+
name = "{{index $.Vars "cloud_run_worker_pool_name"}}"
15+
location = "us-central1"
16+
launch_stage = "BETA"
17+
deletion_protection = false
18+
19+
template {
20+
annotations = {}
21+
labels = {}
22+
23+
containers {
24+
image = "us-docker.pkg.dev/cloudrun/container/hello"
25+
26+
command = []
27+
args = []
28+
29+
startup_probe {
30+
initial_delay_seconds = 0
31+
timeout_seconds = 1
32+
period_seconds = 3
33+
failure_threshold = 3
34+
35+
tcp_socket {
36+
port = 8080
37+
}
38+
}
39+
40+
liveness_probe {
41+
initial_delay_seconds = 0
42+
timeout_seconds = 1
43+
period_seconds = 10
44+
failure_threshold = 3
45+
46+
http_get {
47+
path = "/"
48+
port = 8080
49+
}
50+
}
51+
}
52+
53+
vpc_access {
54+
network_interfaces {
55+
network = google_compute_network.custom_test.id
56+
subnetwork = google_compute_subnetwork.custom_test.id
57+
tags = []
58+
}
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)