Skip to content

feat: Control verbosity of kube-network-policies sidecar container - #14255

Open
olivergregorius wants to merge 2 commits into
siderolabs:mainfrom
olivergregorius:verbosity-flag-for-kube-network-policies
Open

feat: Control verbosity of kube-network-policies sidecar container#14255
olivergregorius wants to merge 2 commits into
siderolabs:mainfrom
olivergregorius:verbosity-flag-for-kube-network-policies

Conversation

@olivergregorius

Copy link
Copy Markdown

Pull Request

What? (description)

Added a new flag kubeNetworkPoliciesVerbose to KubeFlannelCNIConfigV1Alpha1 to control verbosity of kube-network-policies sidecar container.

Why? (reasoning)

By default when network policies are enabled for flannel, it logs each and every packet flooding the logs overwhelming log collectors like Promtail.

Acceptance

Please use the following checklist:

  • you linked an issue (if applicable)
  • you included tests (if applicable)
  • you ran conformance (make conformance)
  • you formatted your code (make fmt)
  • you linted your code (make lint)
  • you generated documentation (make docs)
  • you ran unit-tests (make unit-tests)

See make help for a description of the available targets.

@github-project-automation github-project-automation Bot moved this to To Do in Planning Sep 4, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Sep 4, 2026
Add `kubeNetworkPoliciesVerbose` to the KubeFlannelCNIConfig document,
controlling the `--v` flag passed to the kube-network-policies sidecar
container Flannel deploys when `kubeNetworkPoliciesEnabled` is set.

When true (the default, preserving prior behavior), the container runs
with `--v=2`; when explicitly set to false, it runs with `--v=0`. The
field is a pointer so "unset" can be distinguished from "explicitly
false" and still resolve to the previous always-verbose behavior.

Signed-off-by: Oliver Gregorius <oliver@gregorius.dev>
@olivergregorius
olivergregorius force-pushed the verbosity-flag-for-kube-network-policies branch from 80a6035 to 55bc15a Compare September 4, 2026 22:17
// Enables verbose logging for kube-network-policies.
//
// This enables verbose logging for the kube-network-policies container.
FlannelKubeNetworkPoliciesVerbose *bool `yaml:"kubeNetworkPoliciesVerbose,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't update legacy configs - they are deprecated/not documented anymore

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove this change or is it just a hint from you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you should l remove changes to legacy configs - they will not be updated.

Also see #13391 - looks like this approach is not good.

The --v=2 is not a good default, and --v=0 might not good either, I wonder if we should just drop all of them, and add extraArgs as a field.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just drop all of them, and add extraArgs as a field.

I already had this in mind as well, but as a consequence the kubeNetworkPoliciesEnabled flag should be moved to a surrounding object:

flannel:
  kubeNetworkPolicies:
    enabled: true
    extraArgs:
      - --v=2

That's a bigger and also a breaking change. But it would be much more clean than having two flags, of course.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still can do changes like this one for 1.15+ and we can keep it backwards compatible as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you should l remove changes to legacy configs

Done with 0d411b4

@smira smira moved this from In Review to On Hold in Planning Sep 7, 2026
@github-project-automation github-project-automation Bot moved this from On Hold to Approved in Planning Sep 11, 2026
@majabojarska
majabojarska self-requested a review September 11, 2026 11:02
@majabojarska

Copy link
Copy Markdown
Member

Nevermind my approval, opened the wrong PR to approve.

KubeNetworkPoliciesVerbose was added to both the deprecated
FlannelCNIConfig (v1alpha1) and its replacement,
KubeFlannelCNIConfigV1Alpha1, in the same change. Since
FlannelCNIConfig is being phased out in favor of
KubeFlannelCNIConfigV1Alpha1, the new field should only exist on the
replacement document.

Remove the field from FlannelCNIConfig, keeping the
KubeNetworkPoliciesVerbose() method (required by the shared
config.K8sFlannelCNIConfig interface) hardcoded to true, matching how
other unsupported knobs are handled on the deprecated type.

Signed-off-by: Oliver Gregorius <oliver@gregorius.dev>
@olivergregorius
olivergregorius force-pushed the verbosity-flag-for-kube-network-policies branch from 2cb23da to 0d411b4 Compare September 11, 2026 12:53
@smira smira moved this from Approved to In Review in Planning Sep 14, 2026
@smira

smira commented Sep 14, 2026

Copy link
Copy Markdown
Member

Putting this on hold until #13391 comes up with a final design. We need a proper way to expose this in the machine config, which will not require changes every now and then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants