feat(Istio): Add label selector exclusions for ServiceEntries#14328
Merged
ymesika merged 4 commits intoJul 1, 2026
Conversation
Signed-off-by: Yossi Mesika <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new controller/Helm setting to exclude Istio ServiceEntry resources from kgateway ServiceEntry backend and endpoint discovery using standard Kubernetes label selectors, with validation to prevent “match everything” selector entries.
Changes:
- Introduces
serviceEntriesExclusionLabelSelectorsHelm value ->KGW_SERVICE_ENTRIES_EXCLUSION_LABEL_SELECTORSsetting, and plumbs it into controller settings. - Adds shared selector parsing helpers (including exclusion-specific validation) and uses them for both namespace discovery selectors and ServiceEntry exclusion selectors.
- Applies exclusion filtering in the ServiceEntry plugin’s input collection and adds unit tests; updates Helm golden manifests accordingly.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| api/settings/settings.go | Adds ServiceEntriesExclusionLabelSelectors setting (env-backed) with default []. |
| api/settings/settings_test.go | Extends settings envvar tests to cover the new setting. |
| install/helm/kgateway/values.yaml | Documents and exposes serviceEntriesExclusionLabelSelectors chart value. |
| install/helm/kgateway/templates/deployment.yaml | Injects KGW_SERVICE_ENTRIES_EXCLUSION_LABEL_SELECTORS into the controller Deployment env. |
| pkg/pluginsdk/collections/label_selectors.go | New shared utilities for parsing JSON label selectors, validating exclusion selectors, and matching. |
| pkg/pluginsdk/collections/label_selectors_test.go | Unit tests for selector parsing/matching and exclusion validation. |
| pkg/pluginsdk/collections/discovery.go | Refactors namespace discovery selector parsing to use the shared helper. |
| pkg/pluginsdk/collections/collections.go | Parses/validates ServiceEntry exclusion selectors once in CommonCollections when Istio integration is enabled. |
| pkg/kgateway/extensions2/plugins/serviceentry/plugin.go | Adds plugin option plumbing for ServiceEntry exclusion selectors (defaults from settings/common collections). |
| pkg/kgateway/extensions2/plugins/serviceentry/collections.go | Filters ServiceEntries collection prior to backend/endpoint derivation based on exclusion selectors. |
| pkg/kgateway/extensions2/plugins/serviceentry/exclusion_test.go | Adds tests for selector-based ServiceEntry exclusion and verifies backend filtering behavior. |
| test/helm/testdata/kgateway/default.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/additional-labels.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/admin-bind-address.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-empty-pod-annotations.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-empty-tolerations-override.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-empty-topology-spread-constraints-override.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-null-pod-annotations.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-null-tolerations-fallback.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-null-topology-spread-constraints-fallback.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-overrides-replace-not-merge.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/controller-overrides-top-level-values.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/hpa-and-vpa.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/pdb-max-unavailable.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/pdb-min-available.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/priority-class-name.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/probes-full-override.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/prometheus-annotations-disabled.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/readiness-probe-override.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/replicas-null.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/replicas-zero.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/service-full-config.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/service-monitor-enabled.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/startup-probe-override.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/tolerations.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/topology-spread-constraints.golden | Updates golden output to include the new env var with default []. |
| test/helm/testdata/kgateway/xds-tls-enabled.golden | Updates golden output to include the new env var with default []. |
Signed-off-by: Yossi Mesika <[email protected]>
davidjumani
approved these changes
Jul 1, 2026
Signed-off-by: Yossi Mesika <[email protected]>
ymesika
force-pushed
the
serviceentry-exclusion-label-selectors
branch
from
July 1, 2026 13:43
0dee525 to
b7cfc5e
Compare
davidjumani
approved these changes
Jul 1, 2026
ymesika
enabled auto-merge
July 1, 2026 13:49
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 1, 2026
chandler-solo
pushed a commit
to chandler-solo/kgateway
that referenced
this pull request
Jul 10, 2026
…ceEntries (kgateway-dev#14328) (kgateway-dev#14359) Signed-off-by: Yossi Mesika <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a controller setting for excluding Istio ServiceEntries from kgateway ServiceEntry backend and endpoint discovery using standard Kubernetes label selectors.
Example Helm configuration:
Empty exclusion selector entries are rejected because they would match every ServiceEntry.
Change Type
/kind feature
Changelog
Additional Notes