feat(serve): add modes and apply-time controls - #259
Merged
Conversation
- Add serve.modes: target/cr mode control per CRD and per target - Add serve.apply.overrides: resourceConflict and targetConflict - Add validation: at least one mode enabled, target mode disabled → target not set - Add gateway apply handler checks for Target mode and Full CR mode - Update CHANGELOG, docs, and fixture - Add testdata for invalid configurations
Replaces the proof-of-concept matchFields list with a robust fieldSelector map, aligning the pattern with Kubernetes Service selectors.
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.
Summary
Adds three new control blocks under
servegiving platform teams granular control over the Gateway API surface, override behaviour, and full CR routing.serve.modesControls which apply modes are available for a CRD. Both default to
truefor backward compatibility.At least one mode must be enabled.
ork validateenforces this. Can be set at the CRD level and per target.serve.apply.overridesControls whether request-level overrides (
?overwrite=trueand?override=true) are honoured. Both default totrue(allow overrides). This is a second line of defence — even if the caller passes the override parameter, the gateway can reject it based on the configuration.resourceConflict— whentrue, callers can pass?overwrite=trueto force field ownership on server-side apply. Whenfalse, the override is rejected regardless of the request.targetConflict— whentrue, callers can pass?override=trueto change the routing surface (target/alias) of an existing CR. Whenfalse, the override is rejected and routing surface changes are always disallowed.Both settings can be set at the CRD level (fallback) and per target. Target-level wins when set.
serve.targets[<name>].fieldSelectorLinks full CRs to a target based on field values. When a CR matches ALL key-value pairs, it is automatically routed to that target — enabling per-target response config, tokens, permissions, and mode enforcement for full CR mode.
fieldSelector— a map of dot-notation field paths to values (max 3 per target). This is a true selector — like Service → Pod selection. Each target must have a unique selector.ork validateenforces uniqueness and warns if a target hascr: falsebut no field selector.Validation rules:
path:valuepairspec.mealPlan: dinner)The target becomes the owner of the matched CR — controlling its mode, response config, tokens, and provenance.
Test Plan
ork validatecatches at least one mode enabledork validatecatches target mode disabled → target setork validatecatches max 3 field selectorsork validatecatches duplicate field selectors across targetsork validatewarns if CR mode disabled with no field selectormake unit-testcleanmake orkcleanPlatform teams can now enforce intent-first delivery, control override behaviour per target, and route full CRs to targets based on field values — just like a Service selector.