-
Notifications
You must be signed in to change notification settings - Fork 854
fix: validate tracing provider completeness after EnvoyProxy merge instead of at admission #9641
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
Open
kadircanyildirm-crypto
wants to merge
7
commits into
envoyproxy:main
Choose a base branch
from
kadircanyildirm-crypto:fix/tracing-cel-strategic-merge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5969bef
fix: validate tracing provider completeness after EnvoyProxy merge
kadircanyildirm-crypto edb169c
docs: regenerate API reference for TracingProvider comment change
kadircanyildirm-crypto 03392a3
Regenerate gateway-crds-helm template snapshots
kadircanyildirm-crypto a784c40
Skip tracing with a log message instead of failing the Gateway
kadircanyildirm-crypto b64b761
fix: stop defaulting the tracing provider type and port at admission
kadircanyildirm-crypto 65fea69
chore: use new() instead of ptr.To in the tracing changes
kadircanyildirm-crypto 6fdac97
fix: resolve inherited telemetry backendRefs in the namespace they we…
kadircanyildirm-crypto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,19 +34,39 @@ const ( | |
| TracingProviderTypeDatadog TracingProviderType = "Datadog" | ||
| ) | ||
|
|
||
| const ( | ||
| // DefaultTracingProviderType is the provider type applied during translation | ||
| // when TracingProvider.Type is unset. | ||
| DefaultTracingProviderType = TracingProviderTypeOpenTelemetry | ||
| // DefaultTracingProviderPort is the provider port applied during translation | ||
| // when TracingProvider.Port is unset. | ||
| DefaultTracingProviderPort int32 = 4317 | ||
| ) | ||
|
|
||
| // TracingProvider defines the tracing provider configuration. | ||
| // | ||
| // +kubebuilder:validation:XValidation:message="host or backendRefs needs to be set",rule="has(self.host) || self.backendRefs.size() > 0" | ||
| // A provider is only required to set host or backendRefs after the | ||
| // GatewayClass-level and Gateway-level EnvoyProxy configs are merged | ||
| // (see EnvoyProxySpec.MergeType), so completeness is checked during | ||
| // translation instead of by a CEL rule here. A provider that is still | ||
| // incomplete after the merge turns tracing off for that Gateway. | ||
| // | ||
| // +kubebuilder:validation:XValidation:message="BackendRefs must be used, backendRef is not supported.",rule="!has(self.backendRef)" | ||
| // +kubebuilder:validation:XValidation:message="BackendRefs only support Service and Backend kind.",rule="has(self.backendRefs) ? self.backendRefs.all(f, f.kind == 'Service' || f.kind == 'Backend') : true" | ||
| // +kubebuilder:validation:XValidation:message="BackendRefs only support Core and gateway.envoyproxy.io group.",rule="has(self.backendRefs) ? (self.backendRefs.all(f, f.group == \"\" || f.group == 'gateway.envoyproxy.io')) : true" | ||
| // +kubebuilder:validation:XValidation:message="openTelemetry can only be used with type OpenTelemetry",rule="has(self.openTelemetry) ? self.type == 'OpenTelemetry' : true" | ||
| // +kubebuilder:validation:XValidation:message="openTelemetry can only be used with type OpenTelemetry",rule="has(self.openTelemetry) ? (!has(self.type) || self.type == 'OpenTelemetry') : true" | ||
| type TracingProvider struct { | ||
| BackendCluster `json:",inline"` | ||
| // Type defines the tracing provider type. | ||
| // | ||
| // Defaults to OpenTelemetry. The default is applied during translation rather | ||
| // than by admission, so that a Gateway-level EnvoyProxy overriding only part of | ||
| // the provider does not replace the type inherited from the GatewayClass level | ||
| // (see EnvoyProxySpec.MergeType). | ||
| // | ||
| // +kubebuilder:validation:Enum=OpenTelemetry;Zipkin;Datadog | ||
| // +kubebuilder:default=OpenTelemetry | ||
| Type TracingProviderType `json:"type"` | ||
| // +optional | ||
| Type *TracingProviderType `json:"type,omitempty"` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's do this first in a seperated PR, WDYT? |
||
| // Host define the provider service hostname. | ||
| // | ||
| // Deprecated: Use BackendRefs instead. | ||
|
|
@@ -55,12 +75,14 @@ type TracingProvider struct { | |
| Host *string `json:"host,omitempty"` | ||
| // Port defines the port the provider service is exposed on. | ||
| // | ||
| // Defaults to 4317. The default is applied during translation rather than by | ||
| // admission, for the same reason as Type. | ||
| // | ||
| // Deprecated: Use BackendRefs instead. | ||
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0 | ||
| // +kubebuilder:default=4317 | ||
| Port int32 `json:"port,omitempty"` | ||
| Port *int32 `json:"port,omitempty"` | ||
| // ServiceName defines the service name to use in tracing configuration. | ||
| // If not set, Envoy Gateway will use a default service name set as | ||
| // "name.namespace" (e.g., "my-gateway.default"). | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a Gateway override supplies only
serviceName, admission also materializes the provider'sportdefault of 4317, so both StrategicMerge and JSONMerge treat that value as an explicit override. Consequently, a GatewayClass OpenTelemetry provider usinghostwith a custom port such as 4318 is completed by the merge but silently redirected to port 4317. The partial-provider path needs to distinguish the defaulted port from an intentional override, just as it must for other defaulted provider fields.Useful? React with 👍 / 👎.