From ac6dd3f22658e9b6edca8e9e4ef2535072347fca Mon Sep 17 00:00:00 2001 From: Adam Cattermole Date: Thu, 1 Feb 2024 13:16:59 +0000 Subject: [PATCH] Add support for tracing-service-insecure --- README.md | 9 +++++---- api/v1beta1/authorino_types.go | 1 + api/v1beta1/zz_generated.deepcopy.go | 2 +- .../operator.authorino.kuadrant.io_authorinos.yaml | 2 ++ .../bases/operator.authorino.kuadrant.io_authorinos.yaml | 2 ++ config/deploy/manifests.yaml | 2 ++ config/install/manifests.yaml | 2 ++ controllers/authorino_controller.go | 5 ++++- controllers/authorino_controller_test.go | 3 +++ controllers/constants.go | 1 + 10 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c1ea3cc6..b5995311 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/api/v1beta1/authorino_types.go b/api/v1beta1/authorino_types.go index ba489f91..e327fc3d 100644 --- a/api/v1beta1/authorino_types.go +++ b/api/v1beta1/authorino_types.go @@ -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 { diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index d908165e..e2a39751 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* -Copyright 2020 Red Hat, Inc. +Copyright 2021. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/bundle/manifests/operator.authorino.kuadrant.io_authorinos.yaml b/bundle/manifests/operator.authorino.kuadrant.io_authorinos.yaml index 29ce2b4b..fef6b0fc 100644 --- a/bundle/manifests/operator.authorino.kuadrant.io_authorinos.yaml +++ b/bundle/manifests/operator.authorino.kuadrant.io_authorinos.yaml @@ -144,6 +144,8 @@ spec: properties: endpoint: type: string + insecure: + type: boolean tags: additionalProperties: type: string diff --git a/config/crd/bases/operator.authorino.kuadrant.io_authorinos.yaml b/config/crd/bases/operator.authorino.kuadrant.io_authorinos.yaml index d40437c1..e5a9071d 100644 --- a/config/crd/bases/operator.authorino.kuadrant.io_authorinos.yaml +++ b/config/crd/bases/operator.authorino.kuadrant.io_authorinos.yaml @@ -146,6 +146,8 @@ spec: properties: endpoint: type: string + insecure: + type: boolean tags: additionalProperties: type: string diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index 9c262bba..577605dc 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -5545,6 +5545,8 @@ spec: properties: endpoint: type: string + insecure: + type: boolean tags: additionalProperties: type: string diff --git a/config/install/manifests.yaml b/config/install/manifests.yaml index 0bbcb490..0171bd94 100644 --- a/config/install/manifests.yaml +++ b/config/install/manifests.yaml @@ -144,6 +144,8 @@ spec: properties: endpoint: type: string + insecure: + type: boolean tags: additionalProperties: type: string diff --git a/controllers/authorino_controller.go b/controllers/authorino_controller.go index dad555a1..3f6a8233 100644 --- a/controllers/authorino_controller.go +++ b/controllers/authorino_controller.go @@ -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 diff --git a/controllers/authorino_controller_test.go b/controllers/authorino_controller_test.go index 7feeb4b3..0caca238 100644 --- a/controllers/authorino_controller_test.go +++ b/controllers/authorino_controller_test.go @@ -302,6 +302,7 @@ func newFullAuthorinoInstance() *api.Authorino { "env": "test", "version": "1.0.0", }, + Insecure: true, }, }, } @@ -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()) diff --git a/controllers/constants.go b/controllers/constants.go index 020e5b96..147922c3 100644 --- a/controllers/constants.go +++ b/controllers/constants.go @@ -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"