-
Notifications
You must be signed in to change notification settings - Fork 47
NETOBSERV-2675: flp-informers deployment and wiring #2650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7694874
e9332d7
5960d2a
d926d6c
41fccae
29f8516
3d006ac
2d230f0
5b7d3e2
d1de54c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -5529,6 +5529,133 @@ spec: | |
| - Always | ||
| - Never | ||
| type: string | ||
| informers: | ||
| description: |- | ||
| `informers` configuration for centralized Kubernetes informers that push cache updates to flowlogs-pipeline processors. | ||
| This reduces load on the Kubernetes API server by having a single component (flp-informers) query the API instead of N FLP processors. | ||
| When enabled, a dedicated `flp-informers` deployment is created that watches Kubernetes resources and pushes updates via gRPC. | ||
| properties: | ||
| advanced: | ||
| description: '`advanced` allows setting some technical parameters | ||
| of the informers component.' | ||
| properties: | ||
| batchSize: | ||
| default: 100 | ||
| description: '`batchSize` defines the maximum number of | ||
| cache entries to send in a single update batch.' | ||
| minimum: 1 | ||
| type: integer | ||
| processorPort: | ||
| default: 9090 | ||
| description: '`processorPort` defines the gRPC port where | ||
| flowlogs-pipeline processors listen for k8s cache updates.' | ||
| format: int32 | ||
| maximum: 65535 | ||
| minimum: 1 | ||
| type: integer | ||
| resyncInterval: | ||
| default: 60 | ||
| description: '`resyncInterval` defines the interval in | ||
| seconds to rediscover processors and sync state.' | ||
| minimum: 1 | ||
| type: integer | ||
| sendTimeout: | ||
| default: 10 | ||
| description: '`sendTimeout` defines the timeout in seconds | ||
| for sending updates to processors.' | ||
| minimum: 1 | ||
| type: integer | ||
| updateBufferSize: | ||
| default: 100 | ||
| description: '`updateBufferSize` defines the size of the | ||
| internal update channel buffer.' | ||
| minimum: 1 | ||
| type: integer | ||
| type: object | ||
| enabled: | ||
| default: true | ||
| description: |- | ||
| `enabled` controls whether to deploy centralized Kubernetes informers. | ||
| When `true`, a dedicated `flp-informers` deployment watches K8s resources and pushes cache updates via gRPC to FLP processors. | ||
| When `false`, each FLP processor uses local informers (previous behavior). | ||
| type: boolean | ||
| replicas: | ||
| default: 2 | ||
| description: |- | ||
| `replicas` defines the number of replicas for the flp-informers deployment. | ||
| For high availability, a minimum of 2 replicas is required when `enabled` is `true`. | ||
| format: int32 | ||
| minimum: 1 | ||
| type: integer | ||
|
Comment on lines
+5582
to
+5589
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce the HA replica rule in schema (or relax the wording). Line 5556 says a minimum of 2 replicas is required when enabled, but the schema only enforces Suggested CRD fix informers:
@@
properties:
@@
replicas:
default: 2
description: |-
`replicas` defines the number of replicas for the flp-informers deployment.
For high availability, a minimum of 2 replicas is required when `enabled` is `true`.
format: int32
minimum: 1
type: integer
@@
- type: object
+ type: object
+ x-kubernetes-validations:
+ - message: replicas must be at least 2 when informers are enabled
+ rule: self.enabled != true || !has(self.replicas) || self.replicas >= 2#!/bin/bash
set -euo pipefail
# Verify whether webhook already enforces "enabled => replicas >= 2"
fd -i 'flowcollector_validation_webhook.go' -x sh -c '
echo "==> $1"
rg -n "informers|replicas|enabled|at least 2|>=\\s*2" "$1"
' sh {}
# Verify current CRD validation presence for informers replicas
fd -i 'flows.netobserv.io_flowcollectors.yaml' -x sh -c '
echo "==> $1"
rg -n "informers:|replicas:|x-kubernetes-validations|enabled:" "$1"
' sh {}Also applies to: 5628-5628 🤖 Prompt for AI Agents |
||
| resources: | ||
| default: | ||
| limits: | ||
| cpu: 200m | ||
| memory: 256Mi | ||
| requests: | ||
| cpu: 50m | ||
| memory: 128Mi | ||
| description: |- | ||
| `resources` are the compute resources required by the informers container. | ||
| For more information, see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | ||
| properties: | ||
| claims: | ||
| description: |- | ||
| Claims lists the names of resources, defined in spec.resourceClaims, | ||
| that are used by this container. | ||
|
|
||
| This field depends on the | ||
| DynamicResourceAllocation feature gate. | ||
|
|
||
| This field is immutable. It can only be set for containers. | ||
| items: | ||
| description: ResourceClaim references one entry in PodSpec.ResourceClaims. | ||
| properties: | ||
| name: | ||
| description: |- | ||
| Name must match the name of one entry in pod.spec.resourceClaims of | ||
| the Pod where this field is used. It makes that resource available | ||
| inside a container. | ||
| type: string | ||
| request: | ||
| description: |- | ||
| Request is the name chosen for a request in the referenced claim. | ||
| If empty, everything from the claim is made available, otherwise | ||
| only the result of this request. | ||
| type: string | ||
| required: | ||
| - name | ||
| type: object | ||
| type: array | ||
| x-kubernetes-list-map-keys: | ||
| - name | ||
| x-kubernetes-list-type: map | ||
| limits: | ||
| additionalProperties: | ||
| anyOf: | ||
| - type: integer | ||
| - type: string | ||
| pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
| x-kubernetes-int-or-string: true | ||
| description: |- | ||
| Limits describes the maximum amount of compute resources allowed. | ||
| More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | ||
| type: object | ||
| requests: | ||
| additionalProperties: | ||
| anyOf: | ||
| - type: integer | ||
| - type: string | ||
| pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
| x-kubernetes-int-or-string: true | ||
| description: |- | ||
| Requests describes the minimum amount of compute resources required. | ||
| If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, | ||
| otherwise to an implementation-defined value. Requests cannot exceed Limits. | ||
| More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | ||
| type: object | ||
| type: object | ||
| type: object | ||
| kafkaConsumerAutoscaler: | ||
| description: |- | ||
| `kafkaConsumerAutoscaler` [deprecated (*)] is the spec of a horizontal pod autoscaler to set up for `flowlogs-pipeline-transformer`, which consumes Kafka messages. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default-enabled nil check may skip validation.
Enabledhas kubebuilder defaulttrue, but this code treatsnilas disabled. If the webhook runs before CRD defaulting (or on an object that bypassed defaulting), a user withinformers: {}sneaks past the replica check while effectively running enabled. Consider treatingnilastrueto match the declared default:🔧 Suggested tweak
Also note: the CRD declares
+kubebuilder:validation:Minimum=1onReplicas, but this webhook enforces>=2when enabled. Worth aligning the docstring onReplicasor the CRD marker so users aren't surprised by a "1 is valid here, but not really" situation.🤖 Prompt for AI Agents