Skip to content

Conversation

@hbhasker
Copy link

Summary

This PR adds label selector support to the exportTo field for networking resources in the Istio API.

Implements support for: istio/istio#50661

Changes

1. Add exportToSelectors field to networking resources

  • networking/v1alpha3/virtual_service.proto: Added export_to_selectors field (field number 7)
  • networking/v1alpha3/destination_rule.proto: Added export_to_selectors field (field number 6)
  • networking/v1alpha3/service_entry.proto: Added export_to_selectors field (field number 10)

2. LabelSelector type definition

  • Added LabelSelector and LabelSelectorRequirement messages to type/v1beta1/selector.proto
  • Kept LabelSelector in mesh/v1alpha1/config.proto for backward compatibility
  • New networking resources use istio.type.v1beta1.LabelSelector
  • Existing MeshConfig fields continue using mesh.v1alpha1.LabelSelector

Backward Compatibility

This PR maintains backward compatibility:

  • LabelSelector exists in both mesh/v1alpha1 and type/v1beta1
  • Existing code using meshconfig.LabelSelector continues to work
  • New code can use typev1beta1.LabelSelector for networking resources

Example Usage

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: reviews
  namespace: bookinfo
spec:
  hosts:
  - reviews
  exportTo:
  - "."  # Static: current namespace
  exportToSelectors:
  - matchLabels:
      env: production  # Dynamic: all namespaces with env=production
  - matchExpressions:
    - key: team
      operator: In
      values: [platform, infrastructure]
  http:
  - route:
    - destination:
        host: reviews

When both exportTo and exportToSelectors are specified, the resource is exported to the union of all matched namespaces.

Protobuf Field Numbers

Carefully chosen to avoid conflicts:

  • VirtualService: field 7 (unused)
  • DestinationRule: field 6 (unused)
  • ServiceEntry: field 10 (unused)

Related

🤖 Generated with Claude Code

Bhasker Hariharan added 2 commits January 14, 2026 06:22
Add label selector support to export_to field for ServiceEntry,
VirtualService, and DestinationRule. This allows resources to be
dynamically exported to namespaces matching label selectors without
knowing namespace names in advance.

Related to istio/istio#50661
…backward compatibility

- Add LabelSelector to type/v1beta1/selector.proto for networking resources
- Keep LabelSelector in mesh/v1alpha1/config.proto for MeshConfig fields
- This maintains backward compatibility with existing code using meshconfig.LabelSelector
- New networking resources (VirtualService, DestinationRule, ServiceEntry) use istio.type.v1beta1.LabelSelector
@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Jan 14, 2026
@istio-policy-bot
Copy link

😊 Welcome @hbhasker! This is either your first contribution to the Istio api repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 14, 2026

CLA Missing ID CLA Not Signed

@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test labels Jan 14, 2026
@istio-testing
Copy link
Collaborator

Hi @hbhasker. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@howardjohn
Copy link
Member

howardjohn commented Jan 14, 2026 via email

- Revert config.pb.go to keep LabelSelector in mesh/v1alpha1
- Revert config_json.gen.go changes
- Reorder export_to_selectors to be after workload_selector in destination_rule.proto
- Reorder fields in service_entry.proto to match field number ordering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@hbhasker
Copy link
Author

@howardjohn could you elaborate on why? btw sorry I explicitly marked this as draft for now because I didn't think it was ready for review. But since I have your attention :)

@hbhasker hbhasker changed the title Add label selector support to exportTo field RFC: Add label selector support to exportTo field Jan 14, 2026
- Keep LabelSelector and LabelSelectorRequirement documentation in mesh/v1alpha1
- Maintain local links to LabelSelector instead of external URLs
- Keep number_of_entries at 84

This is consistent with reverting config.pb.go changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. needs-ok-to-test size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants