upgrade google.golang.org/grpc/health/grpc_health_v1 (#5605)

## Summary
Upgrade `google.golang.org/grpc/health/grpc_health_v1` which has a new
`List` method, so use the `UnimplementedHealthServer`.

## Related issues
- https://github.com/pomerium/ingress-controller/pull/1152

## User Explanation

<!-- How would you explain this change to the user? If this
change doesn't create any user-facing changes, you can leave
this blank. If filled out, add the `docs` label -->

## Checklist

- [ ] reference any related issues
- [ ] updated unit tests
- [ ] add appropriate label (`enhancement`, `bug`, `breaking`,
`dependencies`, `ci`)
- [x] ready for review
This commit is contained in:
Caleb Doxsey 2025-05-02 14:32:04 -06:00 committed by GitHub
parent 6caf65a117
commit d1559eaa86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 23 deletions

View file

@ -3,31 +3,25 @@ package grpc
import (
"context"
"google.golang.org/grpc/codes"
grpc_health "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/status"
"google.golang.org/grpc/health/grpc_health_v1"
"github.com/pomerium/pomerium/internal/log"
)
type healthCheckSrv struct{}
type healthCheckSrv struct {
grpc_health_v1.UnimplementedHealthServer
}
// NewHealthCheckServer returns a basic health checker
func NewHealthCheckServer() grpc_health.HealthServer {
func NewHealthCheckServer() grpc_health_v1.HealthServer {
return &healthCheckSrv{}
}
// Check confirms service is reachable, and assumes any service is operational
// an outlier detection should be used to detect runtime malfunction based on consequitive 5xx
func (h *healthCheckSrv) Check(ctx context.Context, req *grpc_health.HealthCheckRequest) (*grpc_health.HealthCheckResponse, error) {
func (h *healthCheckSrv) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {
log.Ctx(ctx).Debug().Str("service", req.Service).Msg("health check")
return &grpc_health.HealthCheckResponse{
Status: grpc_health.HealthCheckResponse_SERVING,
return &grpc_health_v1.HealthCheckResponse{
Status: grpc_health_v1.HealthCheckResponse_SERVING,
}, nil
}
// Watch is not implemented as is not used by Envoy
func (h *healthCheckSrv) Watch(req *grpc_health.HealthCheckRequest, _ grpc_health.Health_WatchServer) error {
log.Error().Str("service", req.Service).Msg("health check watch")
return status.Errorf(codes.Unimplemented, "method Watch not implemented")
}