-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add L4RoutePolicy CRD for attaching stream plugins to Gateway API L4 routes #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlinsRan
wants to merge
14
commits into
master
Choose a base branch
from
feat/l4routepolicy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0017200
feat: add L4RoutePolicy CRD for attaching stream plugins to Gateway A…
AlinsRan 030f36a
chore: fix CI, generate CRD, add L4 route translator tests
AlinsRan c36522a
test: add L4RoutePolicy e2e tests for TCPRoute
AlinsRan 6105dde
docs: update CRD API reference with L4RoutePolicy
AlinsRan d742959
fix: register L4RoutePolicy CRD in config/crd kustomization
AlinsRan 146b116
fix: grant l4routepolicies RBAC in e2e controller manifest
AlinsRan 20f6527
fix: write L4RoutePolicy ancestors status correctly
AlinsRan 125934f
chore: recognize L4RoutePolicy in types.KindOf and GVK lookup
AlinsRan 4db79aa
fix: address review feedback on L4RoutePolicy
AlinsRan 805611f
fix: attach L4RoutePolicy plugins at stream_route level
AlinsRan dc51e7a
fix: always emit stream_route plugins so api7ee removal is detected
AlinsRan 0ebe08d
Revert "fix: always emit stream_route plugins so api7ee removal is de…
AlinsRan c9222de
test: tolerate YAML line-wrapping in unknown-plugin status assertion
AlinsRan d9a46f0
feat: validate targetRefs group and skip sectionName for L4RoutePolicy
AlinsRan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" | ||
| ) | ||
|
|
||
| // L4RoutePolicySpec defines the desired state of L4RoutePolicy. | ||
| type L4RoutePolicySpec struct { | ||
| // TargetRefs identifies the L4 route resources (TCPRoute, UDPRoute, or TLSRoute) | ||
| // to which this policy applies. Only same-namespace targets are supported. | ||
| // | ||
| // +kubebuilder:validation:MinItems=1 | ||
| // +kubebuilder:validation:MaxItems=16 | ||
| // +kubebuilder:validation:XValidation:rule="self.all(r, r.kind == 'TCPRoute' || r.kind == 'UDPRoute' || r.kind == 'TLSRoute')",message="targetRefs kind must be TCPRoute, UDPRoute, or TLSRoute" | ||
|
Copilot marked this conversation as resolved.
|
||
| // +kubebuilder:validation:XValidation:rule="self.all(r, r.group == 'gateway.networking.k8s.io')",message="targetRefs group must be gateway.networking.k8s.io" | ||
| TargetRefs []gatewayv1alpha2.LocalPolicyTargetReferenceWithSectionName `json:"targetRefs"` | ||
|
|
||
| // Plugins is the list of APISIX stream plugins to attach to the targeted L4 routes. | ||
| // Plugin names should be valid APISIX stream plugin names (e.g., limit-conn, ip-restriction). | ||
| // | ||
| // +optional | ||
| Plugins []Plugin `json:"plugins,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
|
|
||
| // L4RoutePolicy defines plugin configuration for Gateway API L4 routes (TCPRoute, UDPRoute, TLSRoute). | ||
| // It follows the Gateway API Policy Attachment pattern and attaches APISIX stream plugins | ||
| // to the targeted L4 route resources. | ||
| type L4RoutePolicy struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| // Spec defines the desired state of L4RoutePolicy. | ||
| Spec L4RoutePolicySpec `json:"spec,omitempty"` | ||
| Status PolicyStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // L4RoutePolicyList contains a list of L4RoutePolicy. | ||
| type L4RoutePolicyList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []L4RoutePolicy `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&L4RoutePolicy{}, &L4RoutePolicyList{}) | ||
| } | ||
|
AlinsRan marked this conversation as resolved.
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.