Skip to content

Commit 7f98af0

Browse files
Support for configure grpc client to send logs to Loki
1 parent 9078cbe commit 7f98af0

File tree

21 files changed

+290
-80
lines changed

21 files changed

+290
-80
lines changed

api/flowcollector/v1beta2/helper.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,12 @@ func (spec *FlowCollectorSpec) HasExperimentalAlertsHealth() bool {
192192
}
193193
return false
194194
}
195+
196+
func (spec *FlowCollectorFLP) HasExperimentalLokiGRPCClientProtocol() bool {
197+
if spec.Advanced != nil {
198+
env := spec.Advanced.Env["LOKI_USE_GRPC_CLIENT_PROTOCOL"]
199+
useGRPC, err := strconv.ParseBool(env)
200+
return err == nil && useGRPC
201+
}
202+
return false
203+
}

bundle/manifests/netobserv-operator.clusterserviceversion.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,12 @@ spec:
480480
x-descriptors:
481481
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true
482482
- urn:alm:descriptor:com.tectonic.ui:advanced
483+
- displayName: Keep alive
484+
path: loki.grpcConfig.keepAlive
485+
- displayName: Keep alive timeout
486+
path: loki.grpcConfig.keepAliveTimeout
487+
- displayName: Read timeout
488+
path: loki.readTimeout
483489
- path: loki.advanced
484490
x-descriptors:
485491
- urn:alm:descriptor:com.tectonic.ui:hidden
@@ -596,8 +602,6 @@ spec:
596602
path: loki.monolithic.tenantID
597603
- displayName: Url
598604
path: loki.monolithic.url
599-
- displayName: Read timeout
600-
path: loki.readTimeout
601605
- displayName: Namespace
602606
path: namespace
603607
- displayName: Network policy
@@ -708,7 +712,7 @@ spec:
708712
709713
## Configuration
710714
711-
The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/config/samples/flows_v1beta2_flowcollector.yaml).
715+
The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/main/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/main/config/samples/flows_v1beta2_flowcollector.yaml).
712716
713717
To edit configuration in cluster, run:
714718
@@ -724,7 +728,7 @@ spec:
724728
725729
- Loki (`spec.loki`): configure here how to reach Loki. The default values match the Loki quick install paths mentioned above, but you might have to configure differently if you used another installation method. Make sure to disable it (`spec.loki.enable`) if you don't want to use Loki.
726730
727-
- Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/QuickFilters.md).
731+
- Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/main/docs/QuickFilters.md).
728732
729733
- Kafka (`spec.deploymentModel: KAFKA` and `spec.kafka`): when enabled, integrates the flow collection pipeline with Kafka, by splitting ingestion from transformation (kube enrichment, derived metrics, ...). Kafka can provide better scalability, resiliency and high availability ([view more details](https://www.redhat.com/en/topics/integration/what-is-apache-kafka)). Assumes Kafka is already deployed and a topic is created.
730734
@@ -760,7 +764,7 @@ spec:
760764
This documentation includes:
761765
762766
- An [overview](https://github.com/netobserv/network-observability-operator#openshift-console) of the features, with screenshots
763-
- More information on [configuring metrics](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/Metrics.md).
767+
- More information on [configuring metrics](https://github.com/netobserv/network-observability-operator/blob/main/docs/Metrics.md).
764768
- A [performance](https://github.com/netobserv/network-observability-operator#performance-fine-tuning) section, for fine-tuning
765769
- A [security](https://github.com/netobserv/network-observability-operator#securing-data-and-communications) section
766770
- An [F.A.Q.](https://github.com/netobserv/network-observability-operator#faq--troubleshooting) section
@@ -1072,15 +1076,15 @@ spec:
10721076
- name: RELATED_IMAGE_CONSOLE_PLUGIN
10731077
value: quay.io/netobserv/network-observability-console-plugin:v1.9.2-community
10741078
- name: RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT
1075-
value: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
1079+
value: quay.io/netobserv/network-observability-console-plugin:v1.9.2-community
10761080
- name: DOWNSTREAM_DEPLOYMENT
10771081
value: "false"
10781082
- name: PROFILING_BIND_ADDRESS
10791083
- name: NAMESPACE
10801084
valueFrom:
10811085
fieldRef:
10821086
fieldPath: metadata.namespace
1083-
image: quay.io/netobserv/network-observability-operator:1.9.2-community
1087+
image: quay.io/lberetta/network-observability-operator:main
10841088
imagePullPolicy: Always
10851089
livenessProbe:
10861090
httpGet:
@@ -1217,9 +1221,7 @@ spec:
12171221
- image: quay.io/netobserv/flowlogs-pipeline:v1.9.2-community
12181222
name: flowlogs-pipeline
12191223
- image: quay.io/netobserv/network-observability-console-plugin:v1.9.2-community
1220-
name: console-plugin
1221-
- image: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
1222-
name: console-plugin-compat
1224+
name: ""
12231225
version: 1.9.2-community
12241226
webhookdefinitions:
12251227
- admissionReviewVersions:

config/csv/bases/netobserv-operator.clusterserviceversion.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ spec:
216216
x-descriptors:
217217
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:loki.enable:true
218218
- urn:alm:descriptor:com.tectonic.ui:advanced
219+
- displayName: Keep alive
220+
path: loki.grpcConfig.keepAlive
221+
- displayName: Keep alive timeout
222+
path: loki.grpcConfig.keepAliveTimeout
223+
- displayName: Read timeout
224+
path: loki.readTimeout
219225
- path: loki.advanced
220226
x-descriptors:
221227
- urn:alm:descriptor:com.tectonic.ui:hidden

config/descriptions/upstream.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ In that case, you can still get the Prometheus metrics or export raw flows to a
4242

4343
## Configuration
4444

45-
The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/config/samples/flows_v1beta2_flowcollector.yaml).
45+
The `FlowCollector` resource is used to configure the operator and its managed components. A comprehensive documentation is [available here](https://github.com/netobserv/network-observability-operator/blob/main/docs/FlowCollector.md), and a full sample file [there](https://github.com/netobserv/network-observability-operator/blob/main/config/samples/flows_v1beta2_flowcollector.yaml).
4646

4747
To edit configuration in cluster, run:
4848

@@ -58,7 +58,7 @@ A couple of settings deserve special attention:
5858

5959
- Loki (`spec.loki`): configure here how to reach Loki. The default values match the Loki quick install paths mentioned above, but you might have to configure differently if you used another installation method. Make sure to disable it (`spec.loki.enable`) if you don't want to use Loki.
6060

61-
- Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/QuickFilters.md).
61+
- Quick filters (`spec.consolePlugin.quickFilters`): configure preset filters to be displayed in the Console plugin. They offer a way to quickly switch from filters to others, such as showing / hiding pods network, or infrastructure network, or application network, etc. They can be tuned to reflect the different workloads running on your cluster. For a list of available filters, [check this page](https://github.com/netobserv/network-observability-operator/blob/main/docs/QuickFilters.md).
6262

6363
- Kafka (`spec.deploymentModel: KAFKA` and `spec.kafka`): when enabled, integrates the flow collection pipeline with Kafka, by splitting ingestion from transformation (kube enrichment, derived metrics, ...). Kafka can provide better scalability, resiliency and high availability ([view more details](https://www.redhat.com/en/topics/integration/what-is-apache-kafka)). Assumes Kafka is already deployed and a topic is created.
6464

@@ -94,7 +94,7 @@ Please refer to the documentation on GitHub for more information.
9494
This documentation includes:
9595

9696
- An [overview](https://github.com/netobserv/network-observability-operator#openshift-console) of the features, with screenshots
97-
- More information on [configuring metrics](https://github.com/netobserv/network-observability-operator/blob/1.9.2-community/docs/Metrics.md).
97+
- More information on [configuring metrics](https://github.com/netobserv/network-observability-operator/blob/main/docs/Metrics.md).
9898
- A [performance](https://github.com/netobserv/network-observability-operator#performance-fine-tuning) section, for fine-tuning
9999
- A [security](https://github.com/netobserv/network-observability-operator#securing-data-and-communications) section
100100
- An [F.A.Q.](https://github.com/netobserv/network-observability-operator#faq--troubleshooting) section

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ patches:
1313
- path: manager_webhook_patch.yaml
1414
images:
1515
- name: controller
16-
newName: quay.io/netobserv/network-observability-operator
17-
newTag: 1.9.2-community
16+
newName: quay.io/lberetta/network-observability-operator
17+
newTag: main
1818
labels:
1919
- includeSelectors: true
2020
pairs:

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
- name: RELATED_IMAGE_CONSOLE_PLUGIN
4040
value: quay.io/netobserv/network-observability-console-plugin:v1.9.2-community
4141
- name: RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT
42-
value: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
42+
value: quay.io/netobserv/network-observability-console-plugin:v1.9.2-community
4343
- name: DOWNSTREAM_DEPLOYMENT
4444
value: "false"
4545
- name: PROFILING_BIND_ADDRESS

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ require (
7575
github.com/prometheus/client_model v0.6.2 // indirect
7676
github.com/prometheus/procfs v0.17.0 // indirect
7777
github.com/spf13/cobra v1.9.1 // indirect
78-
github.com/spf13/pflag v1.0.9 // indirect
78+
github.com/spf13/pflag v1.0.10 // indirect
7979
github.com/stoewer/go-strcase v1.3.1 // indirect
8080
github.com/stretchr/objx v0.5.2 // indirect
8181
github.com/x448/float16 v0.8.4 // indirect
@@ -118,3 +118,5 @@ require (
118118
sigs.k8s.io/randfill v1.0.0 // indirect
119119
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
120120
)
121+
122+
replace github.com/netobserv/flowlogs-pipeline => github.com/leandroberetta/flowlogs-pipeline v0.0.0-20250924153053-50bf1fe9ddc0

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
9191
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
9292
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
9393
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
94+
github.com/leandroberetta/flowlogs-pipeline v0.0.0-20250924153053-50bf1fe9ddc0 h1:pJPh9PD7LWA6z/zgL9tKh6VyaIGEqvjoCnY30/lg/Sc=
95+
github.com/leandroberetta/flowlogs-pipeline v0.0.0-20250924153053-50bf1fe9ddc0/go.mod h1:0qYnaRptAfhKZkZslWQ7zJd3KkmwYJMJ5RK1/BlR1N8=
9496
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
9597
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
9698
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -150,8 +152,8 @@ github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cA
150152
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
151153
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
152154
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
153-
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
154-
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
155+
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
156+
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
155157
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
156158
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
157159
github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs=

helm/crds/flows.netobserv.io_flowcollectors.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ spec:
34983498
such as getting per-pod information or viewing raw flows.
34993499
If both Prometheus and Loki are enabled, Prometheus takes precedence and Loki is used as a fallback for queries that Prometheus cannot handle.
35003500
If they are both disabled, the Console plugin is not deployed.
3501-
type: boolean
3501+
type: boolean
35023502
lokiStack:
35033503
description: |-
35043504
Loki configuration for `LokiStack` mode. This is useful for an easy Loki Operator configuration.

internal/controller/consoleplugin/consoleplugin_objects.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,27 @@ func (b *builder) getLokiConfig() (cfg.LokiConfig, error) {
347347
if b.desired.Loki.ReadTimeout != nil {
348348
lconf.Timeout = api.Duration{Duration: b.desired.Loki.ReadTimeout.Duration}
349349
}
350-
if lk.TLS.Enable {
351-
if lk.TLS.InsecureSkipVerify {
350+
// Console plugin should always use HTTP/gateway TLS config for LokiStack mode
351+
// regardless of clientType, since console plugin never uses gRPC
352+
tlsConfig := &lk.TLS
353+
if b.desired.Loki.Mode == flowslatest.LokiModeLokiStack && b.desired.Processor.HasExperimentalLokiGRPCClientProtocol() {
354+
// Create HTTP/gateway TLS config for console plugin
355+
tlsConfig = &flowslatest.ClientTLS{
356+
Enable: true,
357+
CACert: flowslatest.CertificateReference{
358+
Type: flowslatest.RefTypeConfigMap,
359+
Name: fmt.Sprintf("%s-gateway-ca-bundle", b.desired.Loki.LokiStack.Name),
360+
Namespace: b.desired.Loki.LokiStack.Namespace,
361+
CertFile: "service-ca.crt",
362+
},
363+
}
364+
}
365+
366+
if tlsConfig.Enable {
367+
if tlsConfig.InsecureSkipVerify {
352368
lconf.SkipTLS = true
353369
} else {
354-
caPath := b.volumes.AddCACertificate(&lk.TLS, "loki-certs")
370+
caPath := b.volumes.AddCACertificate(tlsConfig, "loki-certs")
355371
if caPath != "" {
356372
lconf.CAPath = caPath
357373
}

0 commit comments

Comments
 (0)