Skip to content

fix: add egress NetworkPolicy for CA extractor on OCP 4.22#166

Open
p-rog wants to merge 1 commit into
validatedpatterns:mainfrom
p-rog:ocp-422-netpol-fix
Open

fix: add egress NetworkPolicy for CA extractor on OCP 4.22#166
p-rog wants to merge 1 commit into
validatedpatterns:mainfrom
p-rog:ocp-422-netpol-fix

Conversation

@p-rog

@p-rog p-rog commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

OCP 4.22 introduces platform-managed default-deny-all NetworkPolicies in core openshift-* namespaces, including openshift-config. These are owned by ClusterVersion/version and cannot be removed. This is a breaking change for the ztvp-certificates chart, whose CA extractor Job runs in openshift-config and requires egress to the Kubernetes API server and CoreDNS.

Without this fix, the CA extractor Job times out on every API call (~150s each), fails to create the ztvp-trusted-ca ConfigMap, and causes cascading failures:

  • qtodo pods stuck in Init:0/4 (missing CA volume mount)
  • ztvp-certificates ArgoCD app: OutOfSync/Degraded
  • ACS Central auth provider not configured

Changes

  • New: charts/ztvp-certificates/templates/ca-extractor-netpol.yaml — egress NetworkPolicy allowing CA extractor pods to reach:
    • Kubernetes API server (TCP 6443, port-only rule — endpoints are node IPs after DNAT)
    • CoreDNS (TCP/UDP 5353, scoped to openshift-dns namespace)
    • Sync-wave 22 (before Job at 23), gated by .Values.enabled
    • Uses selectorLabels helper — covers both the initial Job and the CronJob pods
  • Updated: docs/DEVELOPMENT.md — added supported OCP versions table (4.20, 4.21, 4.22) and updated recommended provisioning options

Verification

Tested on OCP 4.22.4 (live cluster dry-run):

Check Result
Cert extractor Job completes PASS — 13 seconds (vs 7+ min timeout without policy)
ztvp-trusted-ca ConfigMap created PASS — 234,365 bytes
qtodo pods recover from Init:0/4 PASS — 3/3 Running
qtodo route responds PASS — HTTP 302 → Keycloak
All ArgoCD apps Synced/Healthy PASS — 12/13 (ztvp-certificates OutOfSync expected since NP was manually applied)
No regression on OCP 4.21 Expected — policy is harmless when no default-deny exists

Why port-only rules

The k8s API server rule has no to selector because API endpoints are node IPs after DNAT — podSelector and namespaceSelector cannot match them. This is standard OVN-Kubernetes behavior on OpenShift.

Made with Cursor

OCP 4.22 introduces platform-managed default-deny NetworkPolicies in
openshift-config namespace. This blocks the ztvp-certificates CA
extractor Job from reaching the Kubernetes API server and CoreDNS,
causing cascading deployment failures (no trusted CA ConfigMap, qtodo
stuck in Init, ACS Central unconfigured).

Add an egress NetworkPolicy that allows the CA extractor pods to reach
the k8s API (port 6443) and CoreDNS (port 5353). The policy is harmless
on OCP 4.21 and earlier where no default-deny exists.

Also update DEVELOPMENT.md with supported OCP versions table and add
4.22 to the recommended provisioning options.

Verified on OCP 4.22.4: cert extractor completes in 13s (vs 7+ min
timeout without the policy), all ArgoCD apps recover to Synced/Healthy.

Co-authored-by: Cursor <cursoragent@cursor.com>
@p-rog
p-rog requested review from mlorenzofr and sabre1041 July 23, 2026 16:49

@mlorenzofr mlorenzofr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The change itself works fine, but unfortunately, during validation, I discovered that we have more dependencies that need to be fixed before we can say that the pattern supports version 4.22.

Changes need to be made to the versions of ODF, RHTAS, quay, and pipelines before considering the pattern valid for that version (supply chain).

Comment thread docs/DEVELOPMENT.md
|---|---|---|
| **4.20** | Supported | Tested and verified |
| **4.21** | Supported | Tested and verified |
| **4.22** | Supported | Tested and verified |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we should remove 4.22 for now

Comment thread docs/DEVELOPMENT.md
* Salesforce ID: Can be omitted (See note below)
* Cloud Provider: AWS
* OpenShift Version: 4.20, 4.21
* OpenShift Version: 4.20, 4.21, 4.22

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we should remove 4.22 for now

Comment thread docs/DEVELOPMENT.md

| OCP Stream | Status | Notes |
|---|---|---|
| **4.20** | Supported | Tested and verified |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
| **4.20** | Supported | Tested and verified |
| **< 4.20** | Unsupported | |
| **4.20** | Supported | Tested and verified |

@p-rog

p-rog commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

The change itself works fine, but unfortunately, during validation, I discovered that we have more dependencies that need to be fixed before we can say that the pattern supports version 4.22.

Changes need to be made to the versions of ODF, RHTAS, quay, and pipelines before considering the pattern valid for that version (supply chain).

Ah... true. I didn't test other supply chain use case and its components like ODF, RHTAS or quay.
I tested the layer 0 components.

OK, I will remove 4.22 from the support scope for now. I think still fixing qtodo app make sense. One item less to fix for 4.22 support. WDYT?

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