-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 kubernetes equality-based ops for field selector metadata.name
#13476
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Miltiadis Alexis <[email protected]>
Signed-off-by: Miltiadis Alexis <[email protected]>
…a.name Signed-off-by: Miltiadis Alexis <[email protected]>
metadata.name
Is there any reason this couldn't also be implemented for namespaces, it feels nearly identical? |
I noticed that for the namespace we need to adapt more codepaths. Mostly right now, we use the to validate access to the namespace. For the // verify if we have permission to list Workflows
allowed, err := auth.CanI(ctx, "list", workflow.WorkflowPlural, options.Namespace, "") Apart from that there are the wfList, err := k.wfClient.ArgoprojV1alpha1().Workflows(namespace).List(ctx, listOptions) For the Since the namespace is touching a lot more components I thought I could split the MRs to make it easier for testing review etc Please let me know @Joibel if I am mistaken or confused smth 🚀 |
Thanks for your comprehensive answer, I hadn't realised |
Limit, Offset int | ||
ShowRemainingItemCount bool | ||
StartedAtAscending bool | ||
Namespace, Name, NameOperator, NamePrefix string |
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.
We probably want to unify this with #13160 , which I need to re-review
@tooptoop4 yes I will spend some time this weekend. I will rebase and check what needs to be adjusted |
Partial fix for #13468
Motivation
Currently, our system only supports the '=' operator for the field selector
metadata.name
when interacting with Kubernetes resources. This limitation restricts the flexibility and functionality of our queries. The goal of this PR is to expand support to include the'=='
and'!='
operators, aligning our capabilities with native Kubernetes functionality. This enhancement will provide users with more granular control over resource selection and filtering, improving overall system usability and compatibility with standard Kubernetes practices.Modifications
ListOptions
Expansion:ListOptions
struct to include a newNameOperator
field.metav1.ListOptions
, which inherently supports additional operators.BuildListOptions
Enhancement:BuildListOptions
function to implement a more generic parsing of terms formetadata.name
.BuildArchivedWorkflowSelector
Update:BuildArchivedWorkflowSelector
function.NameOperator
field, enabling support for '==', '!=', and '=' operators.Code Refactoring:
NameOperator
field and expanded operator support.Verification
Unit Testing:
list_options.go
to cover the new functionality.Local Testing:
argo stop -n argo --field-selector metadata.name(=,==,!=)
Example audit log from local testing: