Skip to content

Commit

Permalink
chore: follow-up on ffe changes
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
  • Loading branch information
csatib02 committed Dec 11, 2024
1 parent c354f63 commit 0018b84
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 32 deletions.
54 changes: 33 additions & 21 deletions api/telemetry/v1alpha1/output_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,35 +99,26 @@ type OTLPHTTP struct {
HTTPClientConfig `json:",inline"`
}

// Configuration for the fluentforward exporter.
type Fluentforward struct {
TCPClientSettings `json:",inline"`

// RequireAck enables the acknowledgement feature.
RequireAck *bool `json:"require_ack,omitempty"`

// The Fluent tag parameter used for routing
Tag *string `json:"tag,omitempty"`

// CompressGzip enables gzip compression for the payload.
CompressGzip *bool `json:"compress_gzip,omitempty"`

// DefaultLabelsEnabled is a map of default attributes to be added to each log record.
DefaultLabelsEnabled *map[string]bool `json:"default_labels_enabled,omitempty"`

QueueConfig *QueueSettings `json:"sending_queue,omitempty"`
RetryConfig *BackOffConfig `json:"retry_on_failure,omitempty"`
Kubernetes *KubernetesMetadata `json:"kubernetes_metadata,omitempty"`
type Endpoint struct {
// TCPAddr is the address of the server to connect to.
TCPAddr *string `json:"tcp_addr"`
// Controls whether to validate the tcp address.
// Turning this ON may result in the collector failing to start if it came up faster then the endpoint.
// default is false.
ValidateTCPResolution bool `json:"validate_tcp_resolution"`
}

type KubernetesMetadata struct {
Key string `json:"key"`
IncludePodLabels bool `json:"include_pod_labels"`
}

// TCPClientSettings defines common settings for a TCP client.
type TCPClientSettings struct {
// The target endpoint URI to send data to (e.g.: some.url:24224).
Endpoint *string `json:"endpoint,omitempty"`
// +kubebuilder:validation:Required

// Endpoint to send logs to.
*Endpoint `json:"endpoint"`

// +kubebuilder:validation:Format=duration

Expand All @@ -141,6 +132,27 @@ type TCPClientSettings struct {
SharedKey *string `json:"shared_key,omitempty"`
}

// Configuration for the fluentforward exporter.
type Fluentforward struct {
TCPClientSettings `json:",inline"`

// RequireAck enables the acknowledgement feature.
RequireAck *bool `json:"require_ack,omitempty"`

// The Fluent tag parameter used for routing
Tag *string `json:"tag,omitempty"`

// CompressGzip enables gzip compression for the payload.
CompressGzip *bool `json:"compress_gzip,omitempty"`

// DefaultLabelsEnabled is a map of default attributes to be added to each log record.
DefaultLabelsEnabled *map[string]bool `json:"default_labels_enabled,omitempty"`

QueueConfig *QueueSettings `json:"sending_queue,omitempty"`
RetryConfig *BackOffConfig `json:"retry_on_failure,omitempty"`
Kubernetes *KubernetesMetadata `json:"kubernetes_metadata,omitempty"`
}

// OutputStatus defines the observed state of Output
type OutputStatus struct {
}
Expand Down
24 changes: 22 additions & 2 deletions api/telemetry/v1alpha1/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 @@ -150,8 +150,22 @@ spec:
to be added to each log record.
type: object
endpoint:
description: 'The target endpoint URI to send data to (e.g.: some.url:24224).'
type: string
description: Endpoint to send logs to.
properties:
tcp_addr:
description: TCPAddr is the address of the server to connect
to.
type: string
validate_tcp_resolution:
description: |-
Controls whether to validate the tcp address.
Turning this ON may result in the collector failing to start if it came up faster then the endpoint.
default is false.
type: boolean
required:
- tcp_addr
- validate_tcp_resolution
type: object
kubernetes_metadata:
properties:
include_pod_labels:
Expand Down Expand Up @@ -283,6 +297,8 @@ spec:
https://godoc.org/crypto/tls#Config for more information. (optional)
type: string
type: object
required:
- endpoint
type: object
otlp:
description: |-
Expand Down
20 changes: 18 additions & 2 deletions config/crd/bases/telemetry.kube-logging.dev_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,22 @@ spec:
to be added to each log record.
type: object
endpoint:
description: 'The target endpoint URI to send data to (e.g.: some.url:24224).'
type: string
description: Endpoint to send logs to.
properties:
tcp_addr:
description: TCPAddr is the address of the server to connect
to.
type: string
validate_tcp_resolution:
description: |-
Controls whether to validate the tcp address.
Turning this ON may result in the collector failing to start if it came up faster then the endpoint.
default is false.
type: boolean
required:
- tcp_addr
- validate_tcp_resolution
type: object
kubernetes_metadata:
properties:
include_pod_labels:
Expand Down Expand Up @@ -283,6 +297,8 @@ spec:
https://godoc.org/crypto/tls#Config for more information. (optional)
type: string
type: object
required:
- endpoint
type: object
otlp:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ func TestOtelColConfComplex(t *testing.T) {
Spec: v1alpha1.OutputSpec{
Fluentforward: &v1alpha1.Fluentforward{
TCPClientSettings: v1alpha1.TCPClientSettings{
Endpoint: utils.ToPtr("fluentd.example-tenant-b-ns.svc.cluster.local:24224"),
Endpoint: &v1alpha1.Endpoint{
TCPAddr: utils.ToPtr("fluentd.example-tenant-b-ns.svc.cluster.local:24224"),
},
TLSSetting: &v1alpha1.TLSClientSetting{
Insecure: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ func TestGenerateFluentforwardExporters(t *testing.T) {
Spec: v1alpha1.OutputSpec{
Fluentforward: &v1alpha1.Fluentforward{
TCPClientSettings: v1alpha1.TCPClientSettings{
Endpoint: utils.ToPtr("http://example.com"),
Endpoint: &v1alpha1.Endpoint{
TCPAddr: utils.ToPtr("http://example.com"),
},
},
},
},
Expand Down Expand Up @@ -108,7 +110,10 @@ func TestGenerateFluentforwardExporters(t *testing.T) {
},
expectedResult: map[string]any{
"fluentforwardexporter/default_output1": map[string]any{
"endpoint": "http://example.com",
"endpoint": map[string]any{
"tcp_addr": "http://example.com",
"validate_tcp_resolution": false,
},
"sending_queue": map[string]any{
"enabled": true,
"queue_size": float64(100),
Expand Down Expand Up @@ -165,7 +170,9 @@ func TestGenerateFluentforwardExporters(t *testing.T) {
Spec: v1alpha1.OutputSpec{
Fluentforward: &v1alpha1.Fluentforward{
TCPClientSettings: v1alpha1.TCPClientSettings{
Endpoint: utils.ToPtr("http://example.com"),
Endpoint: &v1alpha1.Endpoint{
TCPAddr: utils.ToPtr("http://example.com"),
},
ConnectionTimeout: utils.ToPtr("30s"),
SharedKey: utils.ToPtr("shared-key"),
},
Expand Down Expand Up @@ -203,7 +210,10 @@ func TestGenerateFluentforwardExporters(t *testing.T) {
},
expectedResult: map[string]any{
"fluentforwardexporter/default_output2": map[string]any{
"endpoint": "http://example.com",
"endpoint": map[string]any{
"tcp_addr": "http://example.com",
"validate_tcp_resolution": false,
},
"connection_timeout": "30s",
"shared_key": "shared-key",
"require_ack": true,
Expand Down

0 comments on commit 0018b84

Please sign in to comment.