Skip to content

fix(notediscovery): align template standards#672

Open
mberlofa wants to merge 3 commits into
mainfrom
fix/notediscovery-template-standards
Open

fix(notediscovery): align template standards#672
mberlofa wants to merge 3 commits into
mainfrom
fix/notediscovery-template-standards

Conversation

@mberlofa

@mberlofa mberlofa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep the Helm test hook under templates/tests/ so helm test renders and executes it, with unittest coverage for the hook pod.
  • Align pod template labels with immutable selector labels plus user podLabels.
  • Guard empty ingress.ingressClassName rendering and add fail-fast validation for enabled ingress without hosts.
  • Add networkPolicy.extraEgress support with DNS and HTTPS baseline egress allowances before user rules.
  • Expand validation tests and align NOTES.txt with numbered HelmForge operational sections.

Validation

  • helm template test charts/notediscovery | rg -n "helm.sh/hook|test-connection" (hook rendered from templates/tests/test-connection.yaml)
  • helm unittest charts/notediscovery (33 tests, 8 suites)
  • make template-standards-check CHART=notediscovery
  • node scripts/charts/validate-chart.js --chart notediscovery --no-k3d
  • make validate-chart CHART=notediscovery TIMEOUT=900 (FULLY VALIDATED, 19 layers)
  • make standards-check CHART=notediscovery
  • make standards-guard CHART=notediscovery
  • make site-sync-check CHART=notediscovery
  • make release-check REPO=charts passed with expected post-merge release warning
  • make attribution-check REPO=charts

Site Sync

Site PR: helmforgedev/site#350

Summary by CodeRabbit

  • New Features
    • Added networkPolicy.extraEgress to support custom outbound egress rules while preserving built-in DNS (53) and HTTPS (443) access.
  • Bug Fixes
    • Avoided emitting an empty ingressClassName.
    • Improved NetworkPolicy rendering to conditionally include or exclude egress isolation based on configuration.
  • Documentation
    • Expanded README/NOTES with clearer guidance on NetworkPolicy behavior, configuration, and troubleshooting.
  • Tests
    • Added/updated NetworkPolicy, validation, podLabels selector, and Helm test hook coverage.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Standards Check (GR-079) — PASS

Every changed chart fully passes standards-check.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 960ac5f6-3801-4d73-b14d-3259dded9c6c

📥 Commits

Reviewing files that changed from the base of the PR and between dc7172e and 7fa0924.

📒 Files selected for processing (14)
  • charts/notediscovery/README.md
  • charts/notediscovery/templates/NOTES.txt
  • charts/notediscovery/templates/_helpers.tpl
  • charts/notediscovery/templates/deployment.yaml
  • charts/notediscovery/templates/ingress.yaml
  • charts/notediscovery/templates/networkpolicy.yaml
  • charts/notediscovery/tests/networkpolicy-extra-egress-values.yaml
  • charts/notediscovery/tests/networkpolicy_test.yaml
  • charts/notediscovery/tests/podlabels-selector-instance-values.yaml
  • charts/notediscovery/tests/podlabels-selector-name-values.yaml
  • charts/notediscovery/tests/test_connection_test.yaml
  • charts/notediscovery/tests/validation_test.yaml
  • charts/notediscovery/values.schema.json
  • charts/notediscovery/values.yaml
✅ Files skipped from review due to trivial changes (4)
  • charts/notediscovery/tests/podlabels-selector-instance-values.yaml
  • charts/notediscovery/tests/networkpolicy-extra-egress-values.yaml
  • charts/notediscovery/tests/podlabels-selector-name-values.yaml
  • charts/notediscovery/README.md
🚧 Files skipped from review as they are similar to previous changes (9)
  • charts/notediscovery/tests/test_connection_test.yaml
  • charts/notediscovery/templates/deployment.yaml
  • charts/notediscovery/templates/ingress.yaml
  • charts/notediscovery/values.schema.json
  • charts/notediscovery/tests/networkpolicy_test.yaml
  • charts/notediscovery/templates/networkpolicy.yaml
  • charts/notediscovery/templates/_helpers.tpl
  • charts/notediscovery/values.yaml
  • charts/notediscovery/tests/validation_test.yaml

📝 Walkthrough

Walkthrough

This PR adds networkPolicy.extraEgress support to the notediscovery Helm chart, extends validation for ingress and selector labels, adjusts deployment and ingress rendering, and updates NOTES.txt, README, schema, values, and tests.

Changes

NoteDiscovery Chart Updates

Layer / File(s) Summary
Schema and values for extraEgress
charts/notediscovery/values.schema.json, charts/notediscovery/values.yaml
Adds extraEgress to the networkPolicy schema and default values.
NetworkPolicy egress rendering and tests
charts/notediscovery/templates/networkpolicy.yaml, charts/notediscovery/tests/networkpolicy_test.yaml, charts/notediscovery/tests/networkpolicy-extra-egress-values.yaml
Conditionally adds Egress and renders DNS, HTTPS, and custom egress rules, with tests and sample values covering the rendered policy.
Helm value validation for ingress and podLabels
charts/notediscovery/templates/_helpers.tpl, charts/notediscovery/tests/validation_test.yaml, charts/notediscovery/tests/podlabels-selector-*-values.yaml
Adds validation for required ingress hosts and selector-label overrides, with matching test cases and fixtures.
Deployment and ingress template fixes
charts/notediscovery/templates/deployment.yaml, charts/notediscovery/templates/ingress.yaml
Uses selector labels in the Deployment pod template and renders ingressClassName only when set.
NOTES, README, and test hook docs
charts/notediscovery/templates/NOTES.txt, charts/notediscovery/README.md, charts/notediscovery/tests/test_connection_test.yaml
Reworks NOTES sections, documents the new network policy behavior and example values, and adds the Helm test hook spec.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • helmforgedev/charts#641: Both PRs extend NetworkPolicy rendering to support custom extra egress rules and add matching validation/tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the PR’s main goal of aligning the notediscovery chart with template standards and validation conventions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/notediscovery-template-standards

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

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🟢 Security Scan: notediscovery

Framework Score
MITRE + NSA + SOC2 87.37374%

✅ Security posture acceptable.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review


P2 Badge Move the Helm test pod back under templates

Because this hook manifest was moved to charts/notediscovery/tests/, Helm treats it as an ordinary chart file instead of a rendered template; I checked helm template review charts/notediscovery --show-only tests/test-connection.yaml, which reports it cannot find that template, while Helm renders test hooks from templates/tests/. In installs from this chart, the helm.sh/hook: test pod is never created, so the helm test command in NOTES has nothing to run.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread charts/notediscovery/tests/networkpolicy_test.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
charts/notediscovery/templates/_helpers.tpl (1)

164-170: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider consolidating the two selector-label override checks.

Both blocks repeat the same hasKey/fail pattern for app.kubernetes.io/name and app.kubernetes.io/instance. A range over a list of protected keys would reduce duplication and make it easier to add more protected labels later.

♻️ Optional refactor
 {{- $podLabels := .Values.podLabels | default dict -}}
-{{- if hasKey $podLabels "app.kubernetes.io/name" -}}
-{{- fail "podLabels must not override the selector label app.kubernetes.io/name" -}}
-{{- end -}}
-{{- if hasKey $podLabels "app.kubernetes.io/instance" -}}
-{{- fail "podLabels must not override the selector label app.kubernetes.io/instance" -}}
-{{- end -}}
+{{- range $key := (list "app.kubernetes.io/name" "app.kubernetes.io/instance") -}}
+{{- if hasKey $podLabels $key -}}
+{{- fail (printf "podLabels must not override the selector label %s" $key) -}}
+{{- end -}}
+{{- end -}}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/notediscovery/templates/_helpers.tpl` around lines 164 - 170, The two
pod label override guards in _helpers.tpl duplicate the same hasKey/fail pattern
for app.kubernetes.io/name and app.kubernetes.io/instance; refactor this check
into a single range over a list of protected selector keys. Keep the existing
fail behavior in the shared loop so any protected key in $podLabels is rejected,
and make the helper easier to extend by adding future protected labels in one
place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@charts/notediscovery/templates/_helpers.tpl`:
- Around line 164-170: The two pod label override guards in _helpers.tpl
duplicate the same hasKey/fail pattern for app.kubernetes.io/name and
app.kubernetes.io/instance; refactor this check into a single range over a list
of protected selector keys. Keep the existing fail behavior in the shared loop
so any protected key in $podLabels is rejected, and make the helper easier to
extend by adding future protected labels in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 225328ed-83e3-4b02-b3c7-c8cdd4074ff3

📥 Commits

Reviewing files that changed from the base of the PR and between 870b4c7 and fd6f042.

📒 Files selected for processing (13)
  • charts/notediscovery/README.md
  • charts/notediscovery/templates/NOTES.txt
  • charts/notediscovery/templates/_helpers.tpl
  • charts/notediscovery/templates/deployment.yaml
  • charts/notediscovery/templates/ingress.yaml
  • charts/notediscovery/templates/networkpolicy.yaml
  • charts/notediscovery/tests/networkpolicy_test.yaml
  • charts/notediscovery/tests/podlabels-selector-instance-values.yaml
  • charts/notediscovery/tests/podlabels-selector-name-values.yaml
  • charts/notediscovery/tests/test-connection.yaml
  • charts/notediscovery/tests/validation_test.yaml
  • charts/notediscovery/values.schema.json
  • charts/notediscovery/values.yaml

@mberlofa mberlofa force-pushed the fix/notediscovery-template-standards branch from 9112435 to dc7172e Compare July 4, 2026 11:25
@github-actions github-actions Bot added the size:L label Jul 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
charts/notediscovery/tests/test_connection_test.yaml (1)

16-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider asserting helm.sh/hook-delete-policy too.

The template also sets helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded, which isn't covered here. Adding an assertion would tighten coverage of the hook lifecycle behavior.

♻️ Suggested addition
       - equal:
           path: metadata.annotations["helm.sh/hook"]
           value: test
+      - equal:
+          path: metadata.annotations["helm.sh/hook-delete-policy"]
+          value: before-hook-creation,hook-succeeded
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/notediscovery/tests/test_connection_test.yaml` around lines 16 - 18,
The Helm test coverage in the connection test should also verify the hook delete
policy set by the template. Update the test in test_connection_test.yaml to
assert metadata.annotations["helm.sh/hook-delete-policy"] matches
before-hook-creation,hook-succeeded, alongside the existing helm.sh/hook check,
so the lifecycle behavior of the test hook is covered by the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@charts/notediscovery/tests/test_connection_test.yaml`:
- Around line 16-18: The Helm test coverage in the connection test should also
verify the hook delete policy set by the template. Update the test in
test_connection_test.yaml to assert
metadata.annotations["helm.sh/hook-delete-policy"] matches
before-hook-creation,hook-succeeded, alongside the existing helm.sh/hook check,
so the lifecycle behavior of the test hook is covered by the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7bbb8aa9-14d3-40b5-9a09-ad8515a138f0

📥 Commits

Reviewing files that changed from the base of the PR and between 9112435 and dc7172e.

📒 Files selected for processing (3)
  • charts/notediscovery/tests/networkpolicy-extra-egress-values.yaml
  • charts/notediscovery/tests/networkpolicy_test.yaml
  • charts/notediscovery/tests/test_connection_test.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/notediscovery/tests/networkpolicy-extra-egress-values.yaml
  • charts/notediscovery/tests/networkpolicy_test.yaml

@mberlofa mberlofa force-pushed the fix/notediscovery-template-standards branch from dc7172e to 7fa0924 Compare July 5, 2026 19:35
@mberlofa

mberlofa commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both remaining CodeRabbit nitpicks from the review bodies.

What changed:

  • Refactored the protected selector label validation in _helpers.tpl to range over the guarded keys instead of duplicating the hasKey/fail block.
  • Added metadata.annotations["helm.sh/hook-delete-policy"] coverage to test_connection_test.yaml.

Validation:

  • helm unittest charts/notediscovery -f tests/test_connection_test.yaml -f tests/validation_test.yaml passed.
  • make validate-chart CHART=notediscovery passed after the final rebase: notediscovery: FULLY VALIDATED (19 layers), including all k3d behavioral scenarios.
  • make release-check REPO=charts passed with the expected GR-077 release-publication warning.
  • make attribution-check REPO=charts passed.

These CodeRabbit items were posted in review bodies/top-level summaries, not as unresolved review threads. The only thread on the PR was already resolved/outdated, so there is no new thread ID to reply to or resolve.

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