Skip to content

OCPBUGS-94072: netpol: DNS egress policies with openshift-dns 5353 (includes missing #759 forward-port) - #777

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:release-4.21from
mkowalski:dns-egress-5353-4.21
Aug 12, 2026
Merged

OCPBUGS-94072: netpol: DNS egress policies with openshift-dns 5353 (includes missing #759 forward-port)#777
openshift-merge-bot[bot] merged 2 commits into
openshift:release-4.21from
mkowalski:dns-egress-5353-4.21

Conversation

@mkowalski

@mkowalski mkowalski commented Aug 12, 2026

Copy link
Copy Markdown

What this PR does

Two commits:

  1. Cherry-pick of 0fd6985 (PR OCPBUGS-94072: add startup probes and DNS egress to network policies #759, "Bug 94072: add startup probes and DNS egress to network policies") — this branch never received the original OCPBUGS-94072 fix: no startupProbes on nmstate-webhook/kube-rbac-proxy and no DNS egress policies. Without it, the original bug regresses on upgrade from 4.20.
  2. Adds an OpenShift-gated egress rule (UDP/TCP 5353 to openshift-dns) to the three allow-*-egress-dns NetworkPolicies.

Why

On OpenShift the dns-default service maps port 53 to CoreDNS pods listening on 5353, and OVN-Kubernetes evaluates egress NetworkPolicy after service DNAT. The port-53 allow-*-egress-dns rules therefore never match real DNS traffic — DNS from the webhook, metrics and operator pods is silently dropped despite the allow policy. Blocked DNS is the main contributor to the 50–75s startup stall analysed in OCPBUGS-94072 (cluster-wide proxy environment), which combined with tight probe timing produces permanent CrashLoopBackOff.

This adds the documented OpenShift DNS NetworkPolicy pattern: UDP/TCP 5353 towards the openshift-dns namespace, gated on the existing IsOpenShift render flag. The port-53 rule is kept for vanilla Kubernetes.

Upstream: nmstate#1570
Related probe fix: #773 #774 #775


This PR was prepared with AI assistance. Please verify before acting on it.

Add startupProbe to nmstate-webhook and kube-rbac-proxy containers to
allow sufficient time for initialization before liveness/readiness
probes begin checking. Without a startupProbe, pods that take longer
than ~30s to start are killed by the liveness probe and enter
CrashLoopBackOff.

The startupProbe uses TCP socket checks with initialDelaySeconds=10,
periodSeconds=10, and failureThreshold=18, giving containers up to
3 minutes to start. Once the startupProbe succeeds, regular
liveness/readiness probes take over (no initialDelaySeconds needed
since startup was already verified).

Additionally, add DNS egress network policies (UDP/TCP 53) for
webhook, metrics, and operator pods. The existing default-deny
policies block all egress except TCP 6443 (API server), which
prevents DNS resolution. While in-cluster API server access uses the
KUBERNETES_SERVICE_HOST IP directly, various libraries and sidecars
(kube-rbac-proxy) may attempt DNS lookups during initialization,
causing startup delays that compound with aggressive probe timing.

Signed-off-by: Mateusz Kowalski <mko@redhat.com>
Generated-by: AI
Signed-off-by: Mateusz Kowalski <mko@redhat.com>
(cherry picked from commit 0fd6985)
The allow-{webhook,metrics,operator}-egress-dns NetworkPolicies only
allow egress on port 53. On OpenShift the dns-default service maps
port 53 to CoreDNS pods listening on port 5353, and OVN-Kubernetes
evaluates egress NetworkPolicy rules after service DNAT, so the
port-53 rule never matches the actual DNS traffic and lookups from
the selected pods are silently dropped. This is the documented
OpenShift NetworkPolicy pattern for DNS: allow UDP/TCP 5353 towards
the openshift-dns namespace.

Blocked DNS is the main contributor to the 50-75s startup stall of
the nmstate pods observed in OCPBUGS-94072 on a cluster with a
cluster-wide proxy, which together with tight probe timing results
in CrashLoopBackOff.

Keep the port-53 rule for vanilla Kubernetes deployments and gate
the 5353 rule on IsOpenShift, which is already provided as render
data to this template.

Assisted-By: Claude Fable 5
Signed-off-by: Mateusz Kowalski <mko@redhat.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 12, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 12, 2026

Copy link
Copy Markdown

@mkowalski: This pull request references Jira Issue OCPBUGS-94072, which is invalid:

  • expected the bug to be open, but it isn't
  • expected the bug to target either version "4.21.z." or "openshift-4.21.z.", but it targets "4.20.z" instead
  • expected the bug to be in one of the following states: NEW, ASSIGNED, POST, but it is Closed (Done) instead
  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected dependent Jira Issue OCPBUGS-97950 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is New instead
  • expected dependent Jira Issue OCPBUGS-97950 to target a version in 4.22.0, but it targets "4.21.z" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does

Two commits:

  1. Cherry-pick of 0fd6985 (PR OCPBUGS-94072: add startup probes and DNS egress to network policies #759, "Bug 94072: add startup probes and DNS egress to network policies") — this branch never received the original OCPBUGS-94072 fix: no startupProbes on nmstate-webhook/kube-rbac-proxy and no DNS egress policies. Without it, the original bug regresses on upgrade from 4.20.
  2. Adds an OpenShift-gated egress rule (UDP/TCP 5353 to openshift-dns) to the three allow-*-egress-dns NetworkPolicies.

Why

On OpenShift the dns-default service maps port 53 to CoreDNS pods listening on 5353, and OVN-Kubernetes evaluates egress NetworkPolicy after service DNAT. The port-53 allow-*-egress-dns rules therefore never match real DNS traffic — DNS from the webhook, metrics and operator pods is silently dropped despite the allow policy. Blocked DNS is the main contributor to the 50–75s startup stall analysed in OCPBUGS-94072 (cluster-wide proxy environment), which combined with tight probe timing produces permanent CrashLoopBackOff.

This adds the documented OpenShift DNS NetworkPolicy pattern: UDP/TCP 5353 towards the openshift-dns namespace, gated on the existing IsOpenShift render flag. The port-53 rule is kept for vanilla Kubernetes.

Upstream: nmstate#1570
Related probe fix: #773 #774 #775


This PR was prepared with AI assistance. Please verify before acting on it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1eb90550-1929-497f-bdcd-26f69bf2a0c1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from cybertron and emy August 12, 2026 15:14
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mkowalski

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2026
@mkowalski

Copy link
Copy Markdown
Author

/label jira/valid-bug

@openshift-ci openshift-ci Bot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Aug 12, 2026
@mkowalski

Copy link
Copy Markdown
Author

/override-sticky ci/prow/security

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

@mkowalski: Overrode contexts on behalf of mkowalski: ci/prow/security

These overrides will persist across retests on the current HEAD SHA. Pushing a new commit will clear them. Use /override-cancel to remove them.

Details

In response to this:

/override-sticky ci/prow/security

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mkowalski

Copy link
Copy Markdown
Author

/test e2e-operator-ovn-ipv4

@rbbratta

Copy link
Copy Markdown

/jira refresh

@rbbratta

Copy link
Copy Markdown

/lgtm

@openshift-ci-robot

Copy link
Copy Markdown

@rbbratta: This pull request references Jira Issue OCPBUGS-94072, which is invalid:

  • expected the bug to target either version "4.21.z." or "openshift-4.21.z.", but it targets "4.20.z" instead
  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected dependent Jira Issue OCPBUGS-97950 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is New instead
  • expected dependent Jira Issue OCPBUGS-97950 to target a version in 4.22.0, but it targets "4.21.z" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Retaining the jira/valid-bug label as it was manually added.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Aug 12, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2026
@openshift-merge-bot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 80a489a and 2 for PR HEAD 97f1ad9 in total

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

@mkowalski: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security 97f1ad9 link true /test security

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit c0398f9 into openshift:release-4.21 Aug 12, 2026
9 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@mkowalski: Jira Issue OCPBUGS-94072: Some pull requests linked via external trackers have merged:

The following pull request, linked via external tracker, has not merged:

All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with /jira refresh.

Jira Issue OCPBUGS-94072 has not been moved to the MODIFIED state.

Details

In response to this:

What this PR does

Two commits:

  1. Cherry-pick of 0fd6985 (PR OCPBUGS-94072: add startup probes and DNS egress to network policies #759, "Bug 94072: add startup probes and DNS egress to network policies") — this branch never received the original OCPBUGS-94072 fix: no startupProbes on nmstate-webhook/kube-rbac-proxy and no DNS egress policies. Without it, the original bug regresses on upgrade from 4.20.
  2. Adds an OpenShift-gated egress rule (UDP/TCP 5353 to openshift-dns) to the three allow-*-egress-dns NetworkPolicies.

Why

On OpenShift the dns-default service maps port 53 to CoreDNS pods listening on 5353, and OVN-Kubernetes evaluates egress NetworkPolicy after service DNAT. The port-53 allow-*-egress-dns rules therefore never match real DNS traffic — DNS from the webhook, metrics and operator pods is silently dropped despite the allow policy. Blocked DNS is the main contributor to the 50–75s startup stall analysed in OCPBUGS-94072 (cluster-wide proxy environment), which combined with tight probe timing produces permanent CrashLoopBackOff.

This adds the documented OpenShift DNS NetworkPolicy pattern: UDP/TCP 5353 towards the openshift-dns namespace, gated on the existing IsOpenShift render flag. The port-53 rule is kept for vanilla Kubernetes.

Upstream: nmstate#1570
Related probe fix: #773 #774 #775


This PR was prepared with AI assistance. Please verify before acting on it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants