Skip to content

fix: make default network policy compatible with Cilium dataplane - #216

Merged
mskwierczynski982 merged 9 commits into
masterfrom
feat/cilium-readiness
Sep 11, 2026
Merged

mskwierczynski982 merged 9 commits into
masterfrom
feat/cilium-readiness

Conversation

@mskwierczynski982

@mskwierczynski982 mskwierczynski982 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds namespaceSelector: {} / podSelector: {} peers to the two ipBlock rules in network-policy.yaml. They sit inside the existing rules, so they inherit those rules' ports.

+12 lines, nothing removed. Also drops the unused redisCidr value from consumer charts and bumps chart versions.

Why

Cilium never matches Pod IPs through ipBlock:

CIDR rules do not apply to traffic where both sides of the connection are either managed by Cilium or use an IP belonging to a node in the cluster — Cilium docs

Our policies don't name the traefik namespace — they admit Traefik only because 0.0.0.0/0 matches its pod IP. Under Cilium that stops working and every Traefik-routed app loses ingress.

Safe to deploy on NPM now

Under NPM the added peers grant nothing new, since 0.0.0.0/0 already covers pod IPs. Rendered master vs branch with identical values:

Description

Briefly describe the problem and solution. Please remember to create 1 PR per 1 chart in case of dependency between them, otherwise PR gate will fail.

Chart

Select the chart that you are modifying:

  • core
  • dotnet-core
  • cron-job
  • job
  • app-reverse-proxy
  • pact-broker
  • ado-build-agents
  • ado-agent-cleaner
  • event-worker

Checklist

  • Description provided
  • Linked issue
  • Chart version bumped
  • README.md updated with any new values or changes
  • Updated template tests in ${CHART}/tests/*.py

mskwierczynski982 and others added 9 commits August 13, 2026 14:49
Cilium resolves traffic to security identities and its CIDR selectors only
match the `world` identity. Azure NPM matched raw addresses, so rules that
work today stop matching once the dataplane changes.

network-policy.yaml - add namespaceSelector/podSelector peers to both
ipBlock rules. They sit inside the existing rules so they inherit the port
lists and widen nothing. Without them, Traefik loses access to app pods:
the policies do not name the traefik namespace and admit it only through
ipBlock 0.0.0.0/0 matching Traefik's pod IP.

cilium-network-policy.yaml - new, egress only. Node addresses resolve to
the host / remote-node identities, which no ipBlock rule can match, and
NPM's implicit pod-to-own-node allow does not carry over. Covers Azure IMDS
at 169.254.169.254, which is link-local and resolves to `host`, so toCIDR
would not match it. Rendered under the same switch as the NetworkPolicy.

Also adds port 8443 alongside the long-standing 8433 typo in the external
egress rule, and drops the unused redisCidr value. Tests reworked to match
rules by content rather than list position, so adding a peer or a port no
longer breaks every assertion below it.

Requires the cilium.io/v2 CRD, so this chart version must only be consumed
by clusters already running Azure CNI powered by Cilium.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Keeps this branch to charts/core and charts/dotnet-core only, so the
backward compatibility of the network policy change can be tested against
an Azure NPM cluster without dragging every consumer chart along.

The app-reverse-proxy, cron-job, event-worker and job bumps - version
increments plus removal of the unused redisCidr value - are held in a
local stash and will be reapplied once core is verified.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mskwierczynski982
mskwierczynski982 marked this pull request as ready for review September 9, 2026 13:41
@mskwierczynski982
mskwierczynski982 requested a review from a team as a code owner September 9, 2026 13:41
@mskwierczynski982
mskwierczynski982 merged commit 6e1d941 into master Sep 11, 2026
1 check passed
@mskwierczynski982 mskwierczynski982 mentioned this pull request Sep 25, 2026
8 of 14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants