Skip to content

fix(chart): drop ingress-nginx defaults - #440

Merged
uniqueg merged 4 commits into
devfrom
fix/chart-drop-nginx-defaults
Oct 23, 2026
Merged

uniqueg merged 4 commits into
devfrom
fix/chart-drop-nginx-defaults

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

foca-common (0.2.0, unreleased) no longer has defaults for a particular ingress controller. ingress-nginx is retired, and apps had copied these defaults (cloud-registry#196).

  • Ingress: the template no longer adds nginx.ingress.kubernetes.io/proxy-body-size from the app's size limit. Controller annotations are opt-in through <valuesKey>.ingress.annotations, and the docs give a body-size example per controller.
    • The check that config.server.max_content_length is a positive integer still runs. It moved into foca-common.validate, so it now runs without an Ingress too.
    • The maxContentLength setting and the foca-common.maxContentLength helper stay, because cloud-registry and proTES set the setting. App charts can use the helper in their own resources.
  • NetworkPolicy: the ingressFrom description is neutral.
    • The schema no longer has minItems, so [] works as a default.
    • Rendering still fails if the policy is enabled without peers, and the error message now links to the docs.
    • The petstore example defaults to [] with a documented placeholder comment, instead of the ingress-nginx namespace.
  • OpenShift Route: new <valuesKey>.route.enabled (camelCase, true in the petstore values) turns off the Route, which serves all paths, e.g., when the app brings its own Route or HTTPRoute. Values without the key, as in 0.1.0, keep the Route (dig ... true). The petstore NOTES mention the new value.
  • Neutral wording: keep-alive and body-size descriptions in the schema and values no longer name ingress-nginx. Both schema copies stay identical.
  • Docs:
    • docs/helm-chart.md:
      • New "NetworkPolicy peers" section, adapted from Cloud Registry's chart docs, so that apps can link to it instead of copying. It has peers for Envoy Gateway, Traefik (k3s), ingress-nginx, OpenShift, Gateway-namespace proxies (e.g., Istio) and in-namespace clients.
      • The per-setup guides (Gateway API, ingress-nginx, Traefik, OpenShift) link to the new section.
      • The ingress-nginx guide shows the opt-in body-size, TLS-redirect and rate-limit annotations.
      • The settings table, templates table and deployment notes are updated.
    • docs/migration-0.17.md: new section "No ingress-nginx defaults" for foca-common 0.1.0 → 0.2.0.

How it was verified

  • pytest charts/foca-common/tests (Helm v3.22.1, as in CI): 203 passed. New and changed tests cover:
    • no annotation from the size limit, and opt-in annotations;
    • the helper (settings default, overlay precedence, generated config);
    • the invalid-limit check without an Ingress;
    • route.enabled: false, and values without route.enabled;
    • the schema rejecting a non-boolean route.enabled;
    • no default peers, with the default, [] and null all failing when the policy is enabled;
    • given peers being rendered.
      The snapshots ingress-https (annotation gone) and http-route (explicit peers) are updated.
  • helm lint --strict charts/foca-common and helm lint --strict examples/petstore/chart -f ci/<each>.yaml: passed.
  • pre-commit run --all-files: passed.
  • mypy: passed.
  • mkdocs build --strict: passed. The anchors #networkpolicy-peers and #no-ingress-nginx-defaults resolve.
  • Reviews: adversarial-reviewer and quality-reviewer, one round. No high findings. Fixed: a commented Istio-style peer example, a note that the list is not exhaustive, and rewrapped NOTES and Traefik text. No second round, because the fixes changed only docs and text.
  • The kind install job is unchanged: ci/gateway-values.yaml already sets its own peers, and kind has no Route API.
  • CI on 94a8498: all checks pass (lint and chart tests, kind install of the petstore chart incl. the Envoy Gateway release, unit and integration tests, image scans, docs, Read the Docs, codecov).

Declined review findings

  • Warn in NOTES when an ingress-nginx Ingress has no body-size annotation (adversarial, medium): the library would have to detect one controller, which is what this issue removes. The behaviour change for ingress-nginx users (their default 1 MiB limit applies again) is documented in the migration guide and in the ingress-nginx guide. It will also go on the cloud-registry and proTES migration checklists for their bump to 0.2.0.
  • Drop the maxContentLength setting and helper (quality, low): apps already set the setting, and the helper costs nothing. Keeping both avoids a break, and the docs say what they are for.
  • The docs link in the NetworkPolicy error points to latest (both, low): the values already link to latest docs the same way, and the anchor is new and meant to stay stable.

Open questions

None.

Closes #436

🤖 Generated with Claude Code

Summary by Sourcery

Remove ingress-nginx-specific defaults from the common Helm chart and make ingress, NetworkPolicy, and OpenShift Route configuration explicitly opt-in or setup-specific.

New Features:

  • Add an opt-in <valuesKey>.route.enabled setting to control automatic OpenShift Route creation.
  • Provide reusable documentation and examples for configuring NetworkPolicy peers across common ingress and Gateway setups.

Bug Fixes:

  • Remove the automatic ingress-nginx body-size annotation and require controller-specific annotations to be configured explicitly.
  • Run maximum content-length validation independently of whether an Ingress is enabled.
  • Allow empty NetworkPolicy peer lists as values defaults while continuing to reject enabled policies without peers.

Enhancements:

  • Make ingress, NetworkPolicy, Route, schema, and values behavior neutral toward any particular ingress controller.
  • Preserve the maxContentLength setting and helper for use by application-owned resources.
  • Update migration guidance and chart examples for the removal of ingress-nginx defaults.

Documentation:

  • Document controller-specific body-size, TLS, rate-limit, and NetworkPolicy configuration, including migration guidance from foca-common 0.1.0.

Tests:

  • Expand chart tests and snapshots for opt-in annotations, content-length validation and helper precedence, Route disabling and backward compatibility, schema validation, and explicit NetworkPolicy peers.

uniqueg and others added 4 commits October 23, 2026 15:51
foca-common sets no defaults for a particular ingress controller:

- The Ingress no longer adds nginx.ingress.kubernetes.io/proxy-body-size
  from the app's size limit; controller annotations are opt-in via
  ingress.annotations. The limit is still checked (now in
  foca-common.validate, also without an Ingress), and the
  maxContentLength setting and helper stay for app charts' resources.
- The schema allows an empty networkPolicy.ingressFrom (as a default),
  with a neutral description; the template still fails if the policy is
  enabled without peers, and its message links to the docs. The petstore
  example defaults to [] instead of the ingress-nginx namespace.
- route.enabled (true if not set, as in 0.1.0 values) turns off the
  OpenShift Route, e.g., for a Route or HTTPRoute of the app's own.
- Neutral keep-alive and body-size descriptions in schema and values.

Tests cover the new defaults, opt-in annotations, the helper, the Route
toggle and empty peers; snapshots updated.

Refs #436

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Exposing the app" says that the chart has no controller defaults and
gets a "NetworkPolicy peers" section (Envoy Gateway, Traefik on k3s,
ingress-nginx, OpenShift, clients in the namespace; from Cloud
Registry's chart docs), which the per-setup guides and the petstore
values link to, so that app charts can link instead of copying. The
ingress-nginx guide shows the opt-in body-size, TLS-redirect and rate
limit annotations; the OpenShift guide and deployment notes describe
route.enabled. The 0.17 migration guide gets "No ingress-nginx
defaults" for foca-common 0.1.0 -> 0.2.0.

Refs #436

Co-Authored-By: Claude Opus 5.5 <[email protected]>
From review: a commented peer for implementations that run a Gateway's
proxies in its namespace (e.g., Istio, via the Gateway API label), a
note that the list is not exhaustive, and rewrapped NOTES and Traefik
paragraphs.

Refs #436

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR removes foca-common’s ingress-nginx and namespace-specific defaults, making ingress annotations and NetworkPolicy peers opt-in while retaining content-length validation and helper compatibility; it adds backward-compatible OpenShift Route control, updates the petstore example and schemas, and centralizes the operational and migration guidance in documentation with comprehensive test and snapshot updates.

Sequence diagram for content-length validation and opt-in ingress annotations

sequenceDiagram
    participant Helm as Helm rendering
    participant Validate as foca-common.validate
    participant Ingress as foca-common.ingress
    participant Values as App values

    Helm->>Validate: maxContentLength
    Validate-->>Helm: validate positive integer
    Helm->>Ingress: render Ingress
    Ingress->>Values: ingress.annotations
    Values-->>Ingress: controller-specific annotations
    Ingress-->>Helm: Ingress without controller defaults
Loading

Flow diagram for OpenShift Route selection

flowchart TD
    A[Render exposure resources] --> B{Ingress or HTTPRoute enabled?}
    B -->|Yes| C[Do not create OpenShift Route]
    B -->|No| D{route.enabled is false?}
    D -->|Yes| C
    D -->|No or unset| E{Route API available?}
    E -->|Yes| F[Create OpenShift Route for all paths]
    E -->|No| C
Loading

Flow diagram for NetworkPolicy peer validation

flowchart TD
    A[NetworkPolicy enabled] --> B[Read ingressFrom]
    B --> C{At least one peer?}
    C -->|No: null or empty list| D[Fail rendering and link to NetworkPolicy peer docs]
    C -->|Yes| E[Render NetworkPolicy with supplied peers]
    F[NetworkPolicy disabled] --> G[Do not render NetworkPolicy]
Loading

File-Level Changes

Change Details Files
Remove controller-specific ingress-nginx behavior while preserving opt-in controller configuration.
  • Stop deriving the ingress body-size annotation from the app configuration.
  • Retain user-provided annotations and document per-controller body-size, TLS, and rate-limit examples.
  • Keep maxContentLength validation and the helper, and run validation independently of Ingress rendering.
charts/foca-common/templates/_ingress.tpl
charts/foca-common/templates/_helpers.tpl
charts/foca-common/app-values.schema.json
examples/petstore/chart/values.yaml
examples/petstore/chart/values.schema.json
Make NetworkPolicy peer configuration explicitly cluster-specific and fail safely when absent.
  • Remove the ingress-nginx namespace default and allow an empty list in the schema.
  • Continue failing when an enabled policy has no peers, with a link to the shared peer documentation.
  • Update examples, snapshots, and tests to cover Envoy Gateway and empty/null/default peer cases.
charts/foca-common/templates/_networkpolicy.tpl
charts/foca-common/app-values.schema.json
examples/petstore/chart/values.yaml
examples/petstore/chart/values.schema.json
charts/foca-common/tests/test_templates.py
charts/foca-common/tests/test_snapshots.py
charts/foca-common/tests/__snapshots__/http-route.yaml
Add explicit control over automatic OpenShift Route creation with backward-compatible defaults.
  • Honor .route.enabled when deciding whether to render the fallback Route.
  • Default the setting to true when omitted so 0.1.0 values continue to render Routes.
  • Document the all-path behavior, update petstore NOTES and values, and test disabled, omitted, and invalid values.
charts/foca-common/templates/_helpers.tpl
charts/foca-common/templates/_route.tpl
charts/foca-common/app-values.schema.json
examples/petstore/chart/templates/NOTES.txt
examples/petstore/chart/values.yaml
examples/petstore/chart/values.schema.json
charts/foca-common/tests/test_templates.py
Align chart documentation and migration guidance with neutral, controller-agnostic behavior.
  • Add a reusable NetworkPolicy peers guide covering common gateways, controllers, OpenShift, and direct clients.
  • Update exposure, settings, templates, deployment, and controller-specific sections to describe opt-in annotations and peers.
  • Add migration steps for removed ingress-nginx defaults, route control, and copied app-chart defaults.
docs/helm-chart.md
docs/migration-0.17.md
Update regression coverage to verify helper behavior, validation, rendering changes, and schema compatibility.
  • Verify no implicit ingress annotation and explicit annotation opt-in.
  • Verify helper output and overlay precedence through an app-owned resource.
  • Verify invalid content lengths fail without an Ingress and schemas reject non-boolean route.enabled.
  • Update snapshots for removed annotations and explicit NetworkPolicy peers.
charts/foca-common/tests/test_templates.py
charts/foca-common/tests/test_snapshots.py
charts/foca-common/tests/__snapshots__/ingress-https.yaml
charts/foca-common/tests/__snapshots__/http-route.yaml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (12e863c) to head (94a8498).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #440   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2869      2869           
=========================================
  Hits          2869      2869           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 23, 2026 14:50

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 4721f68 into dev Oct 23, 2026
23 checks passed
@uniqueg
uniqueg deleted the fix/chart-drop-nginx-defaults branch October 23, 2026 14:52
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.

1 participant