Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose initial_metadata in GrpcHealthCheck #8511

Merged
merged 11 commits into from
Aug 1, 2023
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)
nfuden marked this conversation as resolved.
Show resolved Hide resolved
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];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}


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