Skip to content

Add centralized field ownership tracker for shared resources#4523

Draft
caseydavenport wants to merge 1 commit intotigera:masterfrom
caseydavenport:caseydavenport/fieldowner-tracker
Draft

Add centralized field ownership tracker for shared resources#4523
caseydavenport wants to merge 1 commit intotigera:masterfrom
caseydavenport:caseydavenport/fieldowner-tracker

Conversation

@caseydavenport
Copy link
Member

The operator manages several FelixConfiguration fields using three inconsistent patterns: annotation-based tracking (BPF), nil-check defaulting (HealthPort, VXLANVNI, etc.), and unconditional writes (NFTablesMode). This replaces all three with a centralized fieldowner.Tracker in pkg/controller/utils/fieldowner/.

Each controller gets a per-controller annotation (operator.tigera.io/managed-fields-<controller>) storing a JSON map of field name → last-written value. On each reconcile the tracker compares the stored value to the current spec value to detect out-of-band modifications, regardless of how the change was made.

Three conflict policies per field:

  • ConflictError — reject out-of-band modifications, go degraded (BPFEnabled, NFTablesMode)
  • ConflictDefer — release ownership if user modifies the field, let their value persist (HealthPort, VXLANVNI, VXLANPort, RouteTableRange, BPFHostConntrackBypass, DNSTrustedServers)
  • ConflictOverride — always apply the operator's value (not yet used, will be used for applicationlayer/gatewayapi fields)

The BPF field includes MigrateAnnotation() for backward compat with the old operator.tigera.io/bpfEnabled annotation. Remaining controllers (Istio, applicationlayer, gatewayapi, egressgateway) will be migrated in follow-up PRs.

Related design doc: https://github.com/tigera/designs/pull/14

Replaces the ad-hoc per-field annotation patterns on FelixConfiguration
with a centralized fieldowner.Tracker that uses a single per-controller
annotation storing a JSON map of field name to last-written value.

Three conflict policies are supported:
- ConflictError: reject out-of-band modifications (BPFEnabled, NFTablesMode)
- ConflictDefer: release ownership if user modifies the field (HealthPort,
  VXLANVNI, VXLANPort, RouteTableRange, BPFHostConntrackBypass, DNSTrustedServers)
- ConflictOverride: always apply the operator's value (not yet used)

The BPF field is migrated as proof of concept, with MigrateAnnotation()
providing backward compat for the old per-field annotation. The remaining
installation controller fields (NFTablesMode, all nil-check defaults) are
also migrated in this commit.
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.

2 participants