Skip to content

Commit

Permalink
Tests and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrolds committed Jan 23, 2025
1 parent 435f15d commit d2a0130
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 4 deletions.
9 changes: 9 additions & 0 deletions changelog/v1.19.0-beta4/otel-tracing-grpc-authority.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
changelog:
- type: NEW_FEATURE
description: |
Add support for setting the authority field on gRPC requests made to OTEL Collectors during tracing.
When the authority field is set, the gRPC client will use the specified value as the :authority header
when making requests to the collector. This is useful when the collector is behind a reverse proxy that
requires a specific authority to be set on incoming requests.
issueLink: https://github.com/solo-io/solo-projects/issues/7740
resolvesIssue: true
25 changes: 21 additions & 4 deletions test/kubernetes/e2e/features/tracing/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,34 @@ func (s *testingSuite) TestGatewayWithoutOtelTracingGrpcAuthority() {
}

func (s *testingSuite) TestGatewayWithOtelTracingGrpcAuthority() {
// create new gateway with grpc authority set
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, gatewayAuthorityConfigManifest,
"-n", s.testInstallation.Metadata.InstallNamespace)
s.NoError(err, "can apply service/gateway-proxy-tracing")
s.NoError(err, "can create gateway and service")
s.testInstallation.Assertions.EventuallyResourceStatusMatchesState(
func() (resources.InputResource, error) {
return s.testInstallation.ResourceClients.GatewayClient().Read(
s.testInstallation.Metadata.InstallNamespace, "gateway-proxy-tracing-authority", clients.ReadOpts{Ctx: s.ctx})
},
core.Status_Accepted,
gloo_defaults.GlooReporter,
)

s.T().Cleanup(func() {
// cleanup the gateway
err = s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, gatewayAuthorityConfigManifest,
"-n", s.testInstallation.Metadata.InstallNamespace)
s.Assertions.NoError(err, "can delete gateway config")
})

s.testInstallation.Assertions.AssertEventuallyConsistentCurlResponse(s.ctx, testdefaults.CurlPodExecOpt,
[]curl.Option{
curl.WithHost(kubeutils.ServiceFQDN(metav1.ObjectMeta{
Name: gatewayProxyHost,
Name: gatewayAuthorityProxyHost,
Namespace: s.testInstallation.Metadata.InstallNamespace,
})),
curl.WithHostHeader("example.com"),
curl.WithPort(gatewayProxyPort),
curl.WithPort(gatewayAuthorityProxyPort),
curl.WithPath(pathWithRouteDescriptor),
curl.Silent(),
},
Expand All @@ -273,7 +289,8 @@ func (s *testingSuite) TestGatewayWithOtelTracingGrpcAuthority() {
)

s.EventuallyWithT(func(c *assert.CollectT) {
logs, err := s.testInstallation.Actions.Kubectl().GetContainerLogs(s.ctx, otelcolPod.ObjectMeta.GetNamespace(), otelcolPod.ObjectMeta.GetName())
logs, err := s.testInstallation.Actions.Kubectl().GetContainerLogs(s.ctx,
otelcolPod.ObjectMeta.GetNamespace(), otelcolPod.ObjectMeta.GetName())
assert.NoError(c, err, "can get otelcol logs")

fmt.Printf("logs: %s\n", logs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Avoid using the default gateway because we don't want to destroy it when this
# test is over - that will break other tests that depend on the default gateway
# existing.
apiVersion: gateway.solo.io/v1
kind: Gateway
metadata:
labels:
app: gloo
app.kubernetes.io/name: gateway-proxy-tracing-authority
name: gateway-proxy-tracing-authority
spec:
bindAddress: '::'
bindPort: 18082
proxyNames:
- gateway-proxy
httpGateway:
virtualServiceSelector:
gateway-type: tracing
options:
httpConnectionManagerSettings:
tracing:
openTelemetryConfig:
collectorUpstreamRef:
name: opentelemetry-collector
namespace: default
grpcService:
authority: test-authority
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,24 @@ spec:
selector:
gateway-proxy-id: gateway-proxy
gateway-proxy: live
---
apiVersion: v1
kind: Service
metadata:
name: gateway-proxy-tracing-authority
labels:
app.kubernetes.io/name: gateway-proxy-tracing-authority-service
spec:
type: LoadBalancer
ports:
# This service exposes the Port 18080, used by the Gateway defined in ./gateway.yaml
- name: gateway-proxy-tracing-authority
port: 18082
protocol: TCP
targetPort: 18082
# This selector is meant to match the Selector of the deployed gateway-proxy Service
# We intend to route traffic to the gateway-proxy pod(s) that are deployed at install time
selector:
gateway-proxy-id: gateway-proxy
gateway-proxy: live
---
2 changes: 2 additions & 0 deletions test/kubernetes/e2e/features/tracing/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const (
routeDescriptorSpanName = "THISISAROUTEDESCRIPTOR"
gatewayProxyHost = "gateway-proxy-tracing"
gatewayProxyPort = 18080
gatewayAuthorityProxyHost = "gateway-proxy-tracing-authority"
gatewayAuthorityProxyPort = 18082
)

var (
Expand Down

0 comments on commit d2a0130

Please sign in to comment.