Skip to content
Open
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
5 changes: 5 additions & 0 deletions api/flowcollector/v1beta2/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ type LokiMicroservicesParams struct {

// LokiMonolithParams is the configuration for monolithic Loki (https://grafana.com/docs/loki/latest/fundamentals/architecture/deployment-modes/#monolithic-mode)
type LokiMonolithParams struct {
// Set `zeroClick` to `true` to automatically create Loki deployment, service and storage.
// This is useful for development pureposes. Do not use it in production.
//+kubebuilder:default:=true
ZeroClick *bool `json:"zeroClick,omitempty"`

//+kubebuilder:default:="http://loki:3100/"
// `url` is the unique address of an existing Loki service that points to both the ingester and the querier.
URL string `json:"url,omitempty"`
Expand Down
7 changes: 6 additions & 1 deletion api/flowcollector/v1beta2/zz_generated.deepcopy.go

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

6 changes: 6 additions & 0 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4208,6 +4208,12 @@ spec:
description: '`url` is the unique address of an existing Loki
service that points to both the ingester and the querier.'
type: string
zeroClick:
default: true
description: |-
Set `zeroClick` to `true` to automatically create Loki deployment, service and storage.
This is useful for development pureposes. Do not use it in production.
type: boolean
type: object
readTimeout:
default: 30s
Expand Down
21 changes: 10 additions & 11 deletions bundle/manifests/netobserv-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,7 @@ metadata:
},
"mode": "Monolithic",
"monolithic": {
"tenantID": "netobserv",
"tls": {
"caCert": {
"certFile": "service-ca.crt",
"name": "loki-gateway-ca-bundle",
"type": "configmap"
},
"enable": false
},
"url": "http://loki.netobserv.svc:3100/"
"zeroClick": true
},
"readTimeout": "30s",
"writeBatchSize": 10485760,
Expand Down Expand Up @@ -253,7 +244,7 @@ metadata:
categories: Monitoring, Networking, Observability
console.openshift.io/plugins: '["netobserv-plugin"]'
containerImage: quay.io/netobserv/network-observability-operator:1.9.1-community
createdAt: "2025-07-21T09:56:28Z"
createdAt: "2025-08-05T12:24:29Z"
description: Network flows collector and monitoring solution
operatorframework.io/initialization-resource: '{"apiVersion":"flows.netobserv.io/v1beta2",
"kind":"FlowCollector","metadata":{"name":"cluster"},"spec": {}}'
Expand Down Expand Up @@ -596,6 +587,8 @@ spec:
path: loki.monolithic.tenantID
- displayName: Url
path: loki.monolithic.url
- displayName: Zero click
path: loki.monolithic.zeroClick
- displayName: Read timeout
path: loki.readTimeout
- displayName: Namespace
Expand Down Expand Up @@ -775,6 +768,7 @@ spec:
resources:
- configmaps
- namespaces
- persistentvolumeclaims
- secrets
- serviceaccounts
- services
Expand Down Expand Up @@ -1055,6 +1049,7 @@ spec:
- --flowlogs-pipeline-image=$(RELATED_IMAGE_FLOWLOGS_PIPELINE)
- --console-plugin-image=$(RELATED_IMAGE_CONSOLE_PLUGIN)
- --console-plugin-compat-image=$(RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT)
- --zero-click-loki-image=$(RELATED_IMAGE_ZERO_CLICK_LOKI)
- --namespace=$(NAMESPACE)
- --downstream-deployment=$(DOWNSTREAM_DEPLOYMENT)
- --profiling-bind-address=$(PROFILING_BIND_ADDRESS)
Expand All @@ -1071,6 +1066,8 @@ spec:
value: quay.io/netobserv/network-observability-console-plugin:v1.9.1-community
- name: RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT
value: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
- name: RELATED_IMAGE_ZERO_CLICK_LOKI
value: grafana/loki:3.5.0
- name: DOWNSTREAM_DEPLOYMENT
value: "false"
- name: PROFILING_BIND_ADDRESS
Expand Down Expand Up @@ -1218,6 +1215,8 @@ spec:
name: console-plugin
- image: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
name: console-plugin-compat
- image: grafana/loki:3.5.0
name: zero-click-loki
version: 1.9.1-community
webhookdefinitions:
- admissionReviewVersions:
Expand Down
2 changes: 2 additions & 0 deletions catalog/unreleased/downstream-test-fbc/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ properties:
path: loki.microservices.querierUrl
- displayName: Tenant id
path: loki.microservices.tenantID
- displayName: Zero click
path: loki.monolithic.zeroClick
- displayName: Tenant id
path: loki.monolithic.tenantID
- displayName: Url
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3861,6 +3861,12 @@ spec:
default: http://loki:3100/
description: '`url` is the unique address of an existing Loki service that points to both the ingester and the querier.'
type: string
zeroClick:
default: true
description: |-
Set `zeroClick` to `true` to automatically create Loki deployment, service and storage.
This is useful for development pureposes. Do not use it in production.
type: boolean
type: object
readTimeout:
default: 30s
Expand Down
3 changes: 3 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
- --flowlogs-pipeline-image=$(RELATED_IMAGE_FLOWLOGS_PIPELINE)
- --console-plugin-image=$(RELATED_IMAGE_CONSOLE_PLUGIN)
- --console-plugin-compat-image=$(RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT)
- --zero-click-loki-image=$(RELATED_IMAGE_ZERO_CLICK_LOKI)
- --namespace=$(NAMESPACE)
- --downstream-deployment=$(DOWNSTREAM_DEPLOYMENT)
- --profiling-bind-address=$(PROFILING_BIND_ADDRESS)
Expand All @@ -40,6 +41,8 @@ spec:
value: quay.io/netobserv/network-observability-console-plugin:v1.9.1-community
- name: RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT
value: quay.io/netobserv/network-observability-console-plugin-pf4:v1.8.2-community
- name: RELATED_IMAGE_ZERO_CLICK_LOKI
value: grafana/loki:3.5.0
- name: DOWNSTREAM_DEPLOYMENT
value: "false"
- name: PROFILING_BIND_ADDRESS
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rules:
resources:
- configmaps
- namespaces
- persistentvolumeclaims
- secrets
- serviceaccounts
- services
Expand Down
9 changes: 1 addition & 8 deletions config/samples/flows_v1beta2_flowcollector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,7 @@ spec:
# Change mode to "LokiStack" to use with the loki operator
mode: Monolithic
monolithic:
url: 'http://loki.netobserv.svc:3100/'
tenantID: netobserv
tls:
enable: false
caCert:
type: configmap
name: loki-gateway-ca-bundle
certFile: service-ca.crt
zeroClick: true
lokiStack:
name: loki
# Change loki operator instance namespace
Expand Down
10 changes: 10 additions & 0 deletions docs/FlowCollector.md
Original file line number Diff line number Diff line change
Expand Up @@ -8143,6 +8143,16 @@ It is ignored for other modes.
<i>Default</i>: http://loki:3100/<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>zeroClick</b></td>
<td>boolean</td>
<td>
Set `zeroClick` to `true` to automatically create Loki deployment, service and storage.
This is useful for development pureposes. Do not use it in production.<br/>
<br/>
<i>Default</i>: true<br/>
</td>
<td>false</td>
</tr></tbody>
</table>

Expand Down
6 changes: 6 additions & 0 deletions helm/crds/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3865,6 +3865,12 @@ spec:
default: http://loki:3100/
description: '`url` is the unique address of an existing Loki service that points to both the ingester and the querier.'
type: string
zeroClick:
default: true
description: |-
Set `zeroClick` to `true` to automatically create Loki deployment, service and storage.
This is useful for development pureposes. Do not use it in production.
type: boolean
type: object
readTimeout:
default: 30s
Expand Down
1 change: 1 addition & 0 deletions helm/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rules:
resources:
- configmaps
- namespaces
- persistentvolumeclaims
- secrets
- serviceaccounts
- services
Expand Down
3 changes: 3 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spec:
- --flowlogs-pipeline-image=$(RELATED_IMAGE_FLOWLOGS_PIPELINE)
- --console-plugin-image=$(RELATED_IMAGE_CONSOLE_PLUGIN)
- --console-plugin-compat-image=$(RELATED_IMAGE_CONSOLE_PLUGIN_COMPAT)
- --zero-click-loki-image=$(RELATED_IMAGE_ZERO_CLICK_LOKI)
- --namespace=$(NAMESPACE)
- --downstream-deployment=$(DOWNSTREAM_DEPLOYMENT)
- --profiling-bind-address=$(PROFILING_BIND_ADDRESS)
Expand All @@ -41,6 +42,8 @@ spec:
value: '{{ .Values.flowlogsPipeline.image }}:{{ .Values.flowlogsPipeline.version }}'
- name: RELATED_IMAGE_CONSOLE_PLUGIN
value: '{{ if .Values.standaloneConsole.enable }}{{ .Values.standaloneConsole.image }}:{{ .Values.standaloneConsole.version }}{{ else }}{{ .Values.consolePlugin.image }}:{{ .Values.consolePlugin.version }}{{ end }}'
- name: RELATED_IMAGE_ZERO_CLICK_LOKI
value: grafana/loki:3.5.0
- name: DOWNSTREAM_DEPLOYMENT
value: "false"
- name: PROFILING_BIND_ADDRESS
Expand Down
1 change: 1 addition & 0 deletions internal/controller/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (
PluginName = "netobserv-plugin"
StaticPluginName = "netobserv-plugin-static"
PluginShortName = "plugin"
LokiDev = "loki"

// EBPFAgentName and other constants for it
EBPFAgentName = "netobserv-ebpf-agent"
Expand Down
18 changes: 14 additions & 4 deletions internal/controller/flowcollector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
flowslatest "github.com/netobserv/network-observability-operator/api/flowcollector/v1beta2"
"github.com/netobserv/network-observability-operator/internal/controller/consoleplugin"
"github.com/netobserv/network-observability-operator/internal/controller/ebpf"
"github.com/netobserv/network-observability-operator/internal/controller/loki"
"github.com/netobserv/network-observability-operator/internal/controller/reconcilers"
"github.com/netobserv/network-observability-operator/internal/pkg/cleanup"
"github.com/netobserv/network-observability-operator/internal/pkg/helper"
Expand Down Expand Up @@ -120,8 +121,8 @@ func (r *FlowCollectorReconciler) Reconcile(ctx context.Context, _ ctrl.Request)
func (r *FlowCollectorReconciler) reconcile(ctx context.Context, clh *helper.Client, desired *flowslatest.FlowCollector) error {
ns := helper.GetNamespace(&desired.Spec)
previousNamespace := r.status.GetDeployedNamespace(desired)
loki := helper.NewLokiConfig(&desired.Spec.Loki, ns)
reconcilersInfo := r.newCommonInfo(clh, ns, &loki)
lokiConfig := helper.NewLokiConfig(&desired.Spec.Loki, ns)
reconcilersInfo := r.newCommonInfo(clh, ns, &lokiConfig)

if err := r.checkFinalizer(ctx, desired); err != nil {
return err
Expand Down Expand Up @@ -162,11 +163,20 @@ func (r *FlowCollectorReconciler) reconcile(ctx context.Context, clh *helper.Cli
}

// Console plugin
err := cpReconciler.Reconcile(ctx, desired)
if err != nil {
if err := cpReconciler.Reconcile(ctx, desired); err != nil {
return r.status.Error("ReconcileConsolePluginFailed", err)
}

lokiReconciler := loki.NewReconciler(reconcilersInfo.NewInstance(
map[reconcilers.ImageRef]string{
reconcilers.MainImage: r.mgr.Config.ZeroClickLokiImage,
},
r.status,
))
if err := lokiReconciler.Reconcile(ctx, desired); err != nil {
return r.status.Error("ReconcileLokiFailed", err)
}

return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func flowCollectorConsolePluginSpecs() {
})
It("Should update the Loki URL in the Console Plugin if it changes in the Spec", func() {
updateCR(crKey, func(fc *flowslatest.FlowCollector) {
fc.Spec.Loki.Monolithic.ZeroClick = ptr.To(false)
fc.Spec.Loki.Monolithic.URL = "http://loki.namespace:8888"
})
Eventually(getConfigMapData(configKey),
Expand Down
7 changes: 4 additions & 3 deletions internal/controller/flowcollector_controller_iso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ func flowCollectorIsoSpecs() {
TLS: defaultTLS,
},
Monolithic: flowslatest.LokiMonolithParams{
URL: "http://loki:3100/",
TenantID: "netobserv",
TLS: defaultTLS,
ZeroClick: ptr.To(false),
URL: "http://loki:3100/",
TenantID: "netobserv",
TLS: defaultTLS,
},
LokiStack: flowslatest.LokiStackRef{
Name: "loki",
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/flp/flp_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ func ControllerSpecs() {
updateCR(crKey, func(fc *flowslatest.FlowCollector) {
fc.Spec.Loki.Mode = flowslatest.LokiModeMonolithic
fc.Spec.Loki.Monolithic = flowslatest.LokiMonolithParams{
URL: "http://loki-mono:3100/",
ZeroClick: ptr.To(false),
URL: "http://loki-mono:3100/",
TLS: flowslatest.ClientTLS{
Enable: true,
CACert: flowslatest.CertificateReference{
Expand Down
12 changes: 12 additions & 0 deletions internal/controller/loki/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package config

import (
_ "embed"
)

//go:embed local-config.yaml
var rawLocalConfig []byte

func GetLokiConfigStr() string {
return string(rawLocalConfig)
}
Loading