-
Notifications
You must be signed in to change notification settings - Fork 361
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
feat: support LabelSelector type for NamespaceSelectors #2494
Conversation
Signed-off-by: yeedove <[email protected]>
Signed-off-by: yeedove <[email protected]>
api/v1alpha1/envoygateway_types.go
Outdated
// NamespaceSelectors holds the label selector used to dynamically select namespaces. | ||
// Envoy Gateway will watch for namespaces matching the specified label selector. | ||
// Precisely one of Namespaces and NamespaceSelectors must be set. | ||
NamespaceSelectors *metav1.LabelSelector `json:"namespaceSelectors,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this field be renamed to namespaceSelector
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, done
2fb447c
to
2a574f0
Compare
Signed-off-by: yeedove <[email protected]>
2a574f0
to
bff6416
Compare
EG use squash merge model, please kindly don't force push everytime for better review. |
I will pay attention to this. Can you help me look at the |
--- FAIL: TestNamespaceSelectorProvider (67.82s)
kubernetes_test.go:1372:
Error Trace: /home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:1372
Error: Condition never satisfied
Test: TestNamespaceSelectorProvider
2024-01-25T11:14:20.404Z INFO kubernetes/predicates.go:39 gatewayclass has matching controller name, processing {"name": "test-gc"}
2024-01-25T11:14:20.404Z INFO kubernetes/predicates.go:43 bypassing reconciliation due to controller name {"controller": "not.configured/controller"}
2024-01-25T11:14:20.406Z DPANIC kubernetes/predicates.go:123 non-string key argument passed to logging, ignoring all later arguments {"invalid key": "not.configured/controller"}
2024-01-25T11:14:20.406Z INFO kubernetes/predicates.go:123 gatewayclass controller name
2024-01-25T11:14:20.406Z INFO kubernetes/predicates.go:124 gatewayclass name for gateway doesn't match configured name {"namespace": "", "name": "scheduled-status-test"}
2024-01-25T11:14:20.407Z DPANIC kubernetes/predicates.go:123 non-string key argument passed to logging, ignoring all later arguments {"invalid key": "not.configured/controller"}
2024-01-25T11:14:20.407Z INFO kubernetes/predicates.go:123 gatewayclass controller name
2024-01-25T11:14:20.407Z INFO kubernetes/predicates.go:124 gatewayclass name for gateway doesn't match configured name {"namespace": "", "name": "scheduled-status-test"}
2024-01-25T11:14:20.417Z INFO kubernetes/routes.go:266 processing HTTPRoute {"namespace": "test", "name": "test"}
2024-01-25T11:14:20.418Z INFO kubernetes/routes.go:266 processing HTTPRoute {"namespace": "test", "name": "test"}
2024-01-25T11:14:20.418Z INFO kubernetes/routes.go:266 processing HTTPRoute {"namespace": "test", "name": "test"}
2024-01-25T11:14:20.419Z INFO kubernetes/routes.go:137 processing GRPCRoute {"namespace": "test", "name": "test"} |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this, generally lgtm, just some nits.
Signed-off-by: yeedove <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2494 +/- ##
==========================================
- Coverage 64.68% 64.62% -0.07%
==========================================
Files 115 115
Lines 17472 17513 +41
==========================================
+ Hits 11302 11317 +15
- Misses 5449 5471 +22
- Partials 721 725 +4 ☔ View full report in Codecov by Sentry. |
@shawnh2 done, thank! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks !
What type of PR is this?
What this PR does / why we need it:
In the current configuration, the
namespaceSelectors
field underEnvoyGateway.Provider.Kubernetes.Wach
only supports label selection using the key, similar to theExists
operator inLabelSelectorOperator
.The
namespaceSelectors
field can support a more comprehensive label-based selection, allowing you to specify bothmatchLabels
andmatchExpressions
https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#LabelSelector
Which issue(s) this PR fixes:
Fixes #2481