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

Remove extra quotes in tracing tags #172

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/authorino_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (r *AuthorinoReconciler) buildAuthorinoArgs(authorino *api.Authorino) []str
if tracingServiceEndpoint := authorino.Spec.Tracing.Endpoint; tracingServiceEndpoint != "" {
args = append(args, fmt.Sprintf("--%s=%s", flagTracingServiceEndpoint, tracingServiceEndpoint))
for key, value := range authorino.Spec.Tracing.Tags {
args = append(args, fmt.Sprintf(`--%s="%s=%s"`, flagTracingServiceTag, key, value))
args = append(args, fmt.Sprintf(`--%s=%s=%s`, flagTracingServiceTag, key, value))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you tested with tag values containing white spaces?

spec:
  tracing:
    tags:
      tag-with-white-space: value with spaces

Maybe also a key containing white spaces:

spec:
  tracing:
    tags:
      "tag key with spaces": some-value

I wonder if it could break the deployment.

Copy link
Member Author

@adam-cattermole adam-cattermole Feb 15, 2024

Choose a reason for hiding this comment

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

Yep tested now:

tracing:
  endpoint: rpc://jaeger-collector.istio-system.svc.cluster.local:4317
  insecure: true
  tags:
    key with spaces: value with spaces
    test-key: test-value
spec:
  containers:
  - args:
    - --allow-superseding-host-subsets
    - --tracing-service-endpoint=rpc://jaeger-collector.istio-system.svc.cluster.local:4317
    - --tracing-service-insecure
    - --tracing-service-tag=key with spaces=value with spaces
    - --tracing-service-tag=test-key=test-value

image

}
if authorino.Spec.Tracing.Insecure {
args = append(args, fmt.Sprintf(`--%s`, flagTracingServiceInsecure))
Expand Down
2 changes: 1 addition & 1 deletion controllers/authorino_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func checkAuthorinoArgs(authorinoInstance *api.Authorino, args []string) {
case flagTracingServiceEndpoint:
Expect(value).Should(Equal(authorinoInstance.Spec.Tracing.Endpoint))
case flagTracingServiceTag:
kv := strings.Split(strings.TrimPrefix(strings.TrimSuffix(value, `"`), `"`), "=")
kv := strings.Split(value, "=")
Expect(len(kv)).Should(Equal(2))
Expect(kv[1]).Should(Equal(authorinoInstance.Spec.Tracing.Tags[kv[0]]))
case flagTracingServiceInsecure:
Expand Down
Loading