Skip to content

Add NetworkPolicy helm conditional wrapping to chart generation - #164

Merged
openshift-merge-bot[bot] merged 1 commit into
stolostron:mainfrom
dislbenn:networkpolicy-helm-conditional
Jul 22, 2026
Merged

Add NetworkPolicy helm conditional wrapping to chart generation#164
openshift-merge-bot[bot] merged 1 commit into
stolostron:mainfrom
dislbenn:networkpolicy-helm-conditional

Conversation

@dislbenn

Copy link
Copy Markdown
Collaborator

Summary

  • Add wrapNetworkPoliciesWithCondition function to generate-charts.py and bundles-to-charts.py
  • Wraps generated NetworkPolicy templates with {{- if .Values.global.networkPolicies.enabled }} / {{- end }}
  • Runs after all other template processing in injectRequirements to avoid interfering with YAML parsing steps
  • Idempotent — skips files already wrapped

Context

Automated chart regeneration was stripping the networkPolicies.enabled conditional from NetworkPolicy templates. This ensures all generated NetworkPolicy resources are gated behind the flag, matching the existing pattern used in hand-maintained templates (e.g. hypershift-addon-manager-networkpolicy.yaml).

Companion PRs:

Test plan

  • Run make regenerate-charts in backplane-operator and verify NetworkPolicy templates have the {{- if }} wrapper
  • Run make regenerate-charts-from-bundles and verify same
  • Verify idempotency — running twice doesn't double-wrap

🤖 Generated with Claude Code

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dislbenn

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

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@dislbenn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: bd0fdab3-85ce-44f0-aeee-24c7d24bbada

📥 Commits

Reviewing files that changed from the base of the PR and between 2c08d40 and 5a34d2b.

📒 Files selected for processing (2)
  • scripts/bundle-generation/bundles-to-charts.py
  • scripts/bundle-generation/generate-charts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dislbenn
dislbenn force-pushed the networkpolicy-helm-conditional branch from 1d977b7 to 2abc038 Compare July 22, 2026 15:32
Wrap generated NetworkPolicy templates with
{{- if .Values.global.networkPolicies.enabled }} so NetworkPolicies
are only deployed when explicitly enabled. Applied in both
generate-charts.py and bundles-to-charts.py after all other template
processing completes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: dislbenn <dbennett@redhat.com>
@dislbenn
dislbenn force-pushed the networkpolicy-helm-conditional branch from 2abc038 to 5a34d2b Compare July 22, 2026 15:33
@dislbenn dislbenn added the lgtm label Jul 22, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 46e2a0b into stolostron:main Jul 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant