Remove redundant Helm templating from networkpolicy.yaml bundle manifest - #1707
Remove redundant Helm templating from networkpolicy.yaml bundle manifest#1707dislbenn wants to merge 1 commit into
Conversation
|
Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits. 📝 Please follow instructions in the contributing guide to update your commits with the DCO Full details of the Developer Certificate of Origin can be found at developercertificate.org. The list of commits missing DCO signoff:
DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dislbenn The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
@dislbenn: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
Superseded by #1708, opened from a branch based on |



Description
deploy/olm-catalog/multicluster-operators-subscription/manifests/networkpolicy.yaml(added in #1702) wraps its resources in{{- if .Values.global.networkPolicies.enabled }}/{{- end }}. Since this file lives in the OLM bundle'smanifests/directory — which is meant to contain plain, valid Kubernetes YAML that OLM applies directly via the CSV install path — the embedded Go/Helm template syntax breaks any tool that parses it as plain YAML.This surfaced as a scheduled CI failure in
stolostron/multiclusterhub-operator's bundle-regeneration automation:bundles-to-charts.py'saddCRDs()crashed withyaml.parser.ParserErroron this file ({{-isn't valid inside a YAML flow node), which took down chart regeneration for every other component processed in the same run, not just this one.Why removing it is correct, not just a workaround
The wrapping is also redundant.
multiclusterhub-operator's chart-generation tooling (installer-dev-tools'sbundles-to-charts.py) already automatically wraps everyNetworkPolicyresource it extracts from a bundle with the exact same{{- if .Values.global.networkPolicies.enabled }}condition when building the toggle Helm chart — confirmed by re-running the actual chart generation against this file with the wrapping removed:The generated chart output confirms the
networkPolicies.enabledgate is present either way — this file doesn't need to add it manually, and the manual copy was the one causing the parse failure.Why this targets
mainrelease-5.0andrelease-5.1are kept in sync withmainvia a fast-forward cronjob, so fixingmainis sufficient — merging directly intorelease-5.0would have broken that fast-forward relationship (main would no longer be a strict descendant of release-5.0).Changes Made
Removed the two
{{- if }}/{{- end }}lines. Everything else in the file is unchanged — it's still exactly the same 6NetworkPolicyresources.Testing
yaml.safe_load_all()on the file now succeeds, parsing all 6NetworkPolicydocuments correctly (previously raisedParserError).multiclusterhub-operatorchart-regeneration pipeline (generate-shell.py --update-charts-from-bundles) against this branch end-to-end: completes successfully, and the resulting toggle chart'sNetworkPolicytemplates are still correctly gated behindglobal.networkPolicies.enabled(see log excerpt above).helm template.Related
/cc @falconizmi @fxiang1 @jnpacker @mikeshng @rokej @philipwu08 @xiangjingli