Skip to content

Commit 31d8d5a

Browse files
authored
feat: add otel collector uri flag (#513)
Signed-off-by: Leopold Jacquot <[email protected]>
1 parent e740068 commit 31d8d5a

16 files changed

+172
-17
lines changed

apis/core/v1alpha1/flagsourceconfiguration_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ type FlagSourceConfigurationSpec struct {
128128
// DebugLogging defines whether to enable --debug flag of flagd sidecar. Default false (disabled).
129129
// +optional
130130
DebugLogging *bool `json:"debugLogging"`
131+
132+
// OtelCollectorUri defines whether to enable --otel-collector-uri flag of flagd sidecar. Default false (disabled).
133+
// +optional
134+
OtelCollectorUri string `json:"otelCollectorUri"`
131135
}
132136

133137
type Source struct {
@@ -204,6 +208,7 @@ func NewFlagSourceConfigurationSpec() (*FlagSourceConfigurationSpec, error) {
204208
LogFormat: defaultLogFormat,
205209
RolloutOnChange: nil,
206210
DebugLogging: utils.FalseVal(),
211+
OtelCollectorUri: "",
207212
}
208213

209214
// set default value derived from constant default
@@ -318,6 +323,9 @@ func (fc *FlagSourceConfigurationSpec) Merge(new *FlagSourceConfigurationSpec) {
318323
if new.DebugLogging != nil {
319324
fc.DebugLogging = new.DebugLogging
320325
}
326+
if new.OtelCollectorUri != "" {
327+
fc.OtelCollectorUri = new.OtelCollectorUri
328+
}
321329
}
322330

323331
func (fc *FlagSourceConfigurationSpec) ToEnvVars() []corev1.EnvVar {

apis/core/v1alpha1/flagsourceconfiguration_types_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func Test_FLagSourceConfiguration_Merge(t *testing.T) {
119119
RolloutOnChange: utils.TrueVal(),
120120
ProbesEnabled: utils.TrueVal(),
121121
DebugLogging: utils.TrueVal(),
122+
OtelCollectorUri: "",
122123
},
123124
}
124125

@@ -159,6 +160,7 @@ func Test_FLagSourceConfiguration_Merge(t *testing.T) {
159160
RolloutOnChange: utils.TrueVal(),
160161
ProbesEnabled: utils.TrueVal(),
161162
DebugLogging: utils.TrueVal(),
163+
OtelCollectorUri: "",
162164
},
163165
}, ff_old)
164166

@@ -193,6 +195,7 @@ func Test_FLagSourceConfiguration_Merge(t *testing.T) {
193195
RolloutOnChange: utils.FalseVal(),
194196
ProbesEnabled: utils.FalseVal(),
195197
DebugLogging: utils.FalseVal(),
198+
OtelCollectorUri: "",
196199
},
197200
}
198201

@@ -245,6 +248,7 @@ func Test_FLagSourceConfiguration_Merge(t *testing.T) {
245248
RolloutOnChange: utils.FalseVal(),
246249
ProbesEnabled: utils.FalseVal(),
247250
DebugLogging: utils.FalseVal(),
251+
OtelCollectorUri: "",
248252
},
249253
}, ff_old)
250254
}
@@ -281,6 +285,7 @@ func Test_FLagSourceConfiguration_NewFlagSourceConfigurationSpec(t *testing.T) {
281285
LogFormat: "val5",
282286
ProbesEnabled: utils.TrueVal(),
283287
DebugLogging: utils.FalseVal(),
288+
OtelCollectorUri: "",
284289
}, fs)
285290

286291
//error paths

apis/core/v1alpha2/flagsourceconfiguration_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (src *FlagSourceConfiguration) ConvertTo(dstRaw conversion.Hub) error {
4949
DefaultSyncProvider: v1alpha1.SyncProviderType(src.Spec.DefaultSyncProvider),
5050
ProbesEnabled: src.Spec.ProbesEnabled,
5151
DebugLogging: utils.FalseVal(),
52+
OtelCollectorUri: src.Spec.OtelCollectorUri,
5253
}
5354
return nil
5455
}

apis/core/v1alpha2/flagsourceconfiguration_conversion_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func TestFlagSourceConfiguration_ConvertFrom(t *testing.T) {
6565
RolloutOnChange: &tt,
6666
SyncProviderArgs: []string{"provider", "arg"},
6767
DebugLogging: utils.FalseVal(),
68+
OtelCollectorUri: "",
6869
},
6970
},
7071
wantErr: false,
@@ -155,6 +156,7 @@ func TestFlagSourceConfiguration_ConvertTo(t *testing.T) {
155156
RolloutOnChange: nil,
156157
SyncProviderArgs: []string{"provider", "arg"},
157158
DebugLogging: utils.FalseVal(),
159+
OtelCollectorUri: "",
158160
},
159161
},
160162
},

apis/core/v1alpha2/flagsourceconfiguration_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ type FlagSourceConfigurationSpec struct {
6767
// ProbesEnabled defines whether to enable liveness and readiness probes of flagd sidecar. Default true (enabled).
6868
// +optional
6969
ProbesEnabled *bool `json:"probesEnabled"`
70+
71+
// OtelCollectorUri defines whether to enable --otel-collector-uri flag of flagd sidecar. Default false (disabled).
72+
// +optional
73+
OtelCollectorUri string `json:"otelCollectorUri"`
7074
}
7175

7276
// FlagSourceConfigurationStatus defines the observed state of FlagSourceConfiguration

apis/core/v1alpha3/flagsourceconfiguration_conversion.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (src *FlagSourceConfiguration) ConvertTo(dstRaw conversion.Hub) error {
6363
RolloutOnChange: src.Spec.RolloutOnChange,
6464
ProbesEnabled: src.Spec.ProbesEnabled,
6565
DebugLogging: src.Spec.DebugLogging,
66+
OtelCollectorUri: src.Spec.OtelCollectorUri,
6667
}
6768
return nil
6869
}
@@ -106,6 +107,7 @@ func (dst *FlagSourceConfiguration) ConvertFrom(srcRaw conversion.Hub) error {
106107
RolloutOnChange: src.Spec.RolloutOnChange,
107108
ProbesEnabled: src.Spec.ProbesEnabled,
108109
DebugLogging: src.Spec.DebugLogging,
110+
OtelCollectorUri: src.Spec.OtelCollectorUri,
109111
}
110112
return nil
111113
}

apis/core/v1alpha3/flagsourceconfiguration_conversion_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func TestFlagSourceConfiguration_ConvertFrom(t *testing.T) {
6464
EnvVarPrefix: "pre",
6565
RolloutOnChange: &tt,
6666
DebugLogging: utils.FalseVal(),
67+
OtelCollectorUri: "",
6768
},
6869
},
6970
wantErr: false,
@@ -220,6 +221,7 @@ func TestFlagSourceConfiguration_ConvertTo(t *testing.T) {
220221
EnvVarPrefix: "pre",
221222
RolloutOnChange: &tt,
222223
DebugLogging: utils.FalseVal(),
224+
OtelCollectorUri: "",
223225
},
224226
},
225227
},

apis/core/v1alpha3/flagsourceconfiguration_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ type FlagSourceConfigurationSpec struct {
9292
// DebugLogging defines whether to enable --debug flag of flagd sidecar. Default false (disabled).
9393
// +optional
9494
DebugLogging *bool `json:"debugLogging"`
95+
96+
// OtelCollectorUri defines whether to enable --otel-collector-uri flag of flagd sidecar. Default false (disabled).
97+
// +optional
98+
OtelCollectorUri string `json:"otelCollectorUri"`
9599
}
96100

97101
type Source struct {

chart/open-feature-operator/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ helm uninstall open-feature-operator
8282

8383
The command removes all the Kubernetes components associated with the chart and deletes the release.
8484

85+
<!-- x-release-please-start-version -->
8586
## Configuration
8687

8788
### Global
@@ -106,6 +107,7 @@ The command removes all the Kubernetes components associated with the chart and
106107
| `sidecarConfiguration.logFormat` | Sets the value of the `XXX_LOG_FORMAT` environment variable for the injected sidecar container. There are 2 valid log formats: `json` and `console`. | `json` |
107108
| `sidecarConfiguration.probesEnabled` | Enable or Disable Liveness and Readiness probes of the flagd sidecar. When enabled, HTTP probes( paths - `/readyz`, `/healthz`) are set with an initial delay of 5 seconds. | `true` |
108109
| `sidecarConfiguration.debugLogging` | Controls the addition of the `--debug` flag to the container startup arguments. | `false` |
110+
| `sidecarConfiguration.otelCollectorUri` | Otel exporter uri. | `""` |
109111

110112
### Flagd-proxy configuration
111113

@@ -128,7 +130,7 @@ The command removes all the Kubernetes components associated with the chart and
128130
| `controllerManager.kubeRbacProxy.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `5m` |
129131
| `controllerManager.kubeRbacProxy.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `64Mi` |
130132
| `controllerManager.manager.image.repository` | Sets the image for the operator. | `ghcr.io/open-feature/open-feature-operator` |
131-
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.2.34` |
133+
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.2.35` |
132134
| `controllerManager.manager.resources.limits.cpu` | Sets cpu resource limits for operator. | `500m` |
133135
| `controllerManager.manager.resources.limits.memory` | Sets memory resource limits for operator. | `128Mi` |
134136
| `controllerManager.manager.resources.requests.cpu` | Sets cpu resource requests for operator. | `10m` |
@@ -137,3 +139,5 @@ The command removes all the Kubernetes components associated with the chart and
137139
| `managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | Sets the bind address for health probes. | `:8081` |
138140
| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1:8080` |
139141
| `managerConfig.controllerManagerConfigYaml.webhook.port` | Sets the bind address for webhook. | `9443` |
142+
143+
<!-- x-release-please-end -->

chart/open-feature-operator/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ sidecarConfiguration:
3131
probesEnabled: true
3232
## @param sidecarConfiguration.debugLogging Controls the addition of the `--debug` flag to the container startup arguments.
3333
debugLogging: false
34+
## @param sidecarConfiguration.otelCollectorUri Otel exporter uri.
35+
otelCollectorUri: ""
3436

3537
## @section Flagd-proxy configuration
3638
flagdProxyConfiguration:

0 commit comments

Comments
 (0)