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

Add support for --tracing-service-insecure #169

Merged
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ Port numbers of the authorization server.

Configuration of the OpenTelemetry tracing exporter.

| Field | Type | Description | Required/Default |
|----------|:------:|-----------------------------------------------------------------------------------------------------|------------------|
| endpoint | String | Full endpoint of the OpenTelemetry tracing collector service (e.g. http://jaeger:14268/api/traces). | Required |
| tags | Map | Key-value map of fixed tags to add to all OpenTelemetry traces emitted by Authorino. | Optional |
| Field | Type | Description | Required/Default |
|----------|:-------:|-----------------------------------------------------------------------------------------------------|------------------|
| endpoint | String | Full endpoint of the OpenTelemetry tracing collector service (e.g. http://jaeger:14268/api/traces). | Required |
| tags | Map | Key-value map of fixed tags to add to all OpenTelemetry traces emitted by Authorino. | Optional |
| insecure | Boolean | Enable/disable insecure connection to the tracing endpoint | Default: `false` |

#### Metrics

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/authorino_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type Ports struct {
type Tracing struct {
Endpoint string `json:"endpoint"`
Tags map[string]string `json:"tags,omitempty"`
Insecure bool `json:"insecure,omitempty"`
}

type Metrics struct {
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ spec:
properties:
endpoint:
type: string
insecure:
type: boolean
tags:
additionalProperties:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ spec:
properties:
endpoint:
type: string
insecure:
type: boolean
tags:
additionalProperties:
type: string
Expand Down
2 changes: 2 additions & 0 deletions config/deploy/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5545,6 +5545,8 @@ spec:
properties:
endpoint:
type: string
insecure:
type: boolean
tags:
additionalProperties:
type: string
Expand Down
2 changes: 2 additions & 0 deletions config/install/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ spec:
properties:
endpoint:
type: string
insecure:
type: boolean
tags:
additionalProperties:
type: string
Expand Down
5 changes: 4 additions & 1 deletion controllers/authorino_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,15 @@ func (r *AuthorinoReconciler) buildAuthorinoArgs(authorino *api.Authorino) []str
args = append(args, fmt.Sprintf("--%s=%d", flagEvaluatorCacheSize, *evaluatorCacheSize))
}

// tracing-service-endpoint and tracing-service-tag
// tracing-service-endpoint, tracing-service-tag, and tracing-service-insecure
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))
}
if authorino.Spec.Tracing.Insecure {
args = append(args, fmt.Sprintf(`--%s`, flagTracingServiceInsecure))
}
}

// deep-metrics-enabled
Expand Down
3 changes: 3 additions & 0 deletions controllers/authorino_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func newFullAuthorinoInstance() *api.Authorino {
"env": "test",
"version": "1.0.0",
},
Insecure: true,
},
},
}
Expand Down Expand Up @@ -354,6 +355,8 @@ func checkAuthorinoArgs(authorinoInstance *api.Authorino, args []string) {
kv := strings.Split(strings.TrimPrefix(strings.TrimSuffix(value, `"`), `"`), "=")
Expect(len(kv)).Should(Equal(2))
Expect(kv[1]).Should(Equal(authorinoInstance.Spec.Tracing.Tags[kv[0]]))
case flagTracingServiceInsecure:
Expect(authorinoInstance.Spec.Tracing.Insecure).Should(BeTrue())
case flagDeepMetricsEnabled:
Expect(authorinoInstance.Spec.Metrics.DeepMetricsEnabled).ShouldNot(BeNil())
Expect(*authorinoInstance.Spec.Metrics.DeepMetricsEnabled).Should(BeTrue())
Expand Down
1 change: 1 addition & 0 deletions controllers/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
flagEvaluatorCacheSize string = "evaluator-cache-size"
flagTracingServiceEndpoint string = "tracing-service-endpoint"
flagTracingServiceTag string = "tracing-service-tag"
flagTracingServiceInsecure string = "tracing-service-insecure"
flagDeepMetricsEnabled string = "deep-metrics-enabled"
flagMetricsAddr string = "metrics-addr"
flagHealthProbeAddr string = "health-probe-addr"
Expand Down
Loading