From 7cae04c033bb6b13ffe69406aced93674c07925a Mon Sep 17 00:00:00 2001
From: Neil Alberg
Date: Tue, 28 Oct 2025 15:38:37 -0700
Subject: [PATCH] feat(cloudrun): update sample service for cloud run readiness
probe to have grpc support
---
run/service-health/go.mod | 2 +-
run/service-health/layout.html | 16 +++++--
run/service-health/main.go | 45 ++++++++++++++++++-
run/testing/service_health.e2e_test.go | 62 +++++++++++++++++++++++++-
4 files changed, 118 insertions(+), 7 deletions(-)
diff --git a/run/service-health/go.mod b/run/service-health/go.mod
index dc45bad154..5b0775ae35 100644
--- a/run/service-health/go.mod
+++ b/run/service-health/go.mod
@@ -5,6 +5,7 @@ go 1.23.0
require (
cloud.google.com/go/storage v1.55.0
google.golang.org/api v0.235.0
+ google.golang.org/grpc v1.72.1
)
require (
@@ -52,6 +53,5 @@ require (
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250512202823-5a2f75b736a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250512202823-5a2f75b736a9 // indirect
- google.golang.org/grpc v1.72.1 // indirect
google.golang.org/protobuf v1.36.6 // indirect
)
diff --git a/run/service-health/layout.html b/run/service-health/layout.html
index b0b02e72c3..bfc4c860a5 100644
--- a/run/service-health/layout.html
+++ b/run/service-health/layout.html
@@ -69,8 +69,18 @@ Readiness probe is {{.HealthStr}} on this instance!
period seconds: {{.ReadinessProbeConfig.PeriodSeconds}},
success threshold: {{.ReadinessProbeConfig.SuccessThreshold}},
failure threshold: {{.ReadinessProbeConfig.FailureThreshold}},
- http path: {{.ReadinessProbeConfig.HttpGetAction.Path}},
- http port: {{.ReadinessProbeConfig.HttpGetAction.Port}}.
+ {{if .ReadinessProbeConfig.HttpGetAction.Path}}
+ http path: {{.ReadinessProbeConfig.HttpGetAction.Path}},
+ {{end}}
+ {{if .ReadinessProbeConfig.HttpGetAction.Port}}
+ http port: {{.ReadinessProbeConfig.HttpGetAction.Port}}.
+ {{end}}
+ {{if .ReadinessProbeConfig.GrpcAction.Service}}
+ grpc path: {{.ReadinessProbeConfig.GrpcAction.Service}},
+ {{end}}
+ {{if .ReadinessProbeConfig.GrpcAction.Port}}
+ grpc port: {{.ReadinessProbeConfig.GrpcAction.Port}}.
+ {{end}}
{{end}}
@@ -217,4 +227,4 @@ Serving instances for this service: