Skip to content

Commit

Permalink
feat: Expose initial_metadata in GrpcHealthCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
David Jumani authored and David Jumani committed Jul 28, 2023
1 parent 9be86ed commit 009db75
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: NEW_FEATURE
issueLink: https://github.com/solo-io/gloo/issues/8490
resolvesIssue: true
description: >-
Adds the ability to pass `initial_metadata` while configuring a GrpcHealthCheck. It specifies a list of key-value pairs that should be added to the metadata of each GRPC call that is sent to the health checked cluster.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,28 @@ spec:
properties:
authority:
type: string
initialMetadata:
items:
properties:
append:
nullable: true
type: boolean
header:
properties:
key:
type: string
value:
type: string
type: object
headerSecretRef:
properties:
name:
type: string
namespace:
type: string
type: object
type: object
type: array
serviceName:
type: string
type: object
Expand Down
14 changes: 10 additions & 4 deletions pkg/utils/api_conversion/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ func ToEnvoyHealthCheck(check *envoycore_gloo.HealthCheck, secrets *v1.SecretLis
}

case *envoycore_gloo.HealthCheck_GrpcHealthCheck_:
var initialMetadata, err = ToEnvoyHeaderValueOptionList(typed.GrpcHealthCheck.GetInitialMetadata(), secrets, secretOptions)
if err != nil {
return nil, err
}
hc.HealthChecker = &envoy_config_core_v3.HealthCheck_GrpcHealthCheck_{
GrpcHealthCheck: &envoy_config_core_v3.HealthCheck_GrpcHealthCheck{
ServiceName: typed.GrpcHealthCheck.GetServiceName(),
Authority: typed.GrpcHealthCheck.GetAuthority(),
ServiceName: typed.GrpcHealthCheck.GetServiceName(),
Authority: typed.GrpcHealthCheck.GetAuthority(),
InitialMetadata: initialMetadata,
},
}
case *envoycore_gloo.HealthCheck_CustomHealthCheck_:
Expand Down Expand Up @@ -253,8 +258,9 @@ func ToGlooHealthCheck(check *envoy_config_core_v3.HealthCheck) (*envoycore_gloo
case *envoy_config_core_v3.HealthCheck_GrpcHealthCheck_:
hc.HealthChecker = &envoycore_gloo.HealthCheck_GrpcHealthCheck_{
GrpcHealthCheck: &envoycore_gloo.HealthCheck_GrpcHealthCheck{
ServiceName: typed.GrpcHealthCheck.GetServiceName(),
Authority: typed.GrpcHealthCheck.GetAuthority(),
ServiceName: typed.GrpcHealthCheck.GetServiceName(),
Authority: typed.GrpcHealthCheck.GetAuthority(),
InitialMetadata: ToGlooHeaderValueOptionList(typed.GrpcHealthCheck.GetInitialMetadata()),
},
}
case *envoy_config_core_v3.HealthCheck_CustomHealthCheck_:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ message HealthCheck {
// left empty (default value), the name of the cluster this health check is associated
// with will be used.
string authority = 2;

// Specifies a list of key-value pairs that should be added to the metadata of each GRPC call
// that is sent to the health checked cluster.
repeated .solo.io.envoy.api.v2.core.HeaderValueOption initial_metadata = 3
[(validate.rules).repeated .max_items = 1000];
}


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 62 additions & 45 deletions projects/gloo/pkg/api/external/envoy/api/v2/core/health_check.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 009db75

Please sign in to comment.