Skip to content

[Feature Request] Support external_ids field in VPC policyRoutes #6226

@jimyag

Description

@jimyag

Description

Summary

Add support for custom external_ids in VPC spec.policyRoutes, allowing users to attach metadata to policy routes for tracking ownership and origin.

OVN's Logical_Router_Policy table natively supports external_ids (ref: ovn-nb man page), and kube-ovn's OVN-NB client already accepts this parameter. Only the CRD layer needs to be updated.

Current Behavior

The VPC CRD's PolicyRoute struct only exposes priority, match, action, and nextHopIP. Users cannot specify custom external_ids - the controller automatically sets {"vendor": "kube-ovn"}.

Expected Behavior

apiVersion: kubeovn.io/v1
kind: Vpc
metadata:
  name: my-vpc
spec:
  policyRoutes:
    - priority: 100
      match: "ip4.src == 10.0.0.0/24"
      action: allow
      externalIDs:
        created-by: my-controller
        purpose: egress-routing

The controller should merge user-specified external_ids with the default {"vendor": "kube-ovn"}.

Proposed Changes

  1. Add ExternalIDs map[string]string field to PolicyRoute struct in pkg/apis/kubeovn/v1/vpc.go
  2. Update VPC controller to merge user-specified external_ids
  3. Update CRD definition

I'm willing to submit a PR for this feature.

Who will benefit from this feature?

Users who need to track the ownership and origin of policy routes in multi-controller or multi-team environments. This enables:

  • Identifying which controller/operator created a specific policy route
  • Debugging and auditing by recording the source of each policy
  • Safe cleanup - controllers can manage only the routes they created

Anything else?

The infrastructure already supports this:

  • pkg/ovsdb/ovnnb/logical_router_policy.go: ExternalIDs map[string]string
  • pkg/ovs/ovn-nb-logical_router_policy.go: AddLogicalRouterPolicy(..., externalIDs map[string]string)

Ref: OVN-NB Logical_Router_Policy Table

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew network feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions