-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support filtering by multiple labels/resources ("OR" logic) #1508
Comments
@tillepille thanks for reporting the issue, this is a known limitation. If it's not possible to specify in one set of flags, for now your best bet is to set up multiple backups, each with their own filter. |
@skriss Exactly, multiple backups are my current setup, but this kind of eliminates the benefits of using velero. Do you have a starting point in the point for me? Thanks for your fast reply! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing the stale issue. |
I am really happy to see the request being reopened @reasonerjt , I browsed this issue a few days ago and was disappointed to see this thread was closed. I am also trying to find a solution to use multiple label selectors to group resources in one backup file. I spent some time to figure out if there is any workable option other then creating separate backups for each labelSelector rule. In my scenario I want to backup all secrets with a label selector labels in a subset. These secrets are created by various teams, some external, and is extremely difficult to create a consensus among all groups to use one label. Also, we would have to take care of existing secret resources when defining this one label solution; unless they are updated to add the new label we agree upon using, the backup will miss existing resources. Is there a plan to address this issue in velero ?.. I have in mind a simple solution : The velero labelSelector option should have a new flag, If So with the current implementation, you have a default How is this solving our issue : We want to be able to define a label selector using OR for the rules; but OR is a !AND, right ? So an OR rule can be simply created by defining an AND rule and negating it. The current velero implementation works with a label-selector--criteria=INCLUDE, we just need to add the label-selector--criteria=EXCLUDE option |
It would be better if we just go with how kubectl handles the labels. We can refer https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#list-and-watch-filtering |
@nirutgupta the issue is that you can't define a kubectl filter criteria for an OR condition, for two different label selectors, like : |
After discussing with a few folks, I think that this solution isn't incredibly complex but there is the downside of having to introduce a new API field which essentially duplicates existing behavior. To solve the use cases @birsanv described above, we could simply add a new API I suggest this as I don't believe we will be able to get OR functionality at the Kube level, so this would be a good workaround on our end. Thoughts? |
Describe the solution you'd like
Currently
means, that the flag gets overwritten.
So only configmaps / things with the label
backup=bar
will be backed up.It would be great if i could specify multiple resource types or label combinations.
Anything else you would like to add:
I know that i can specify multiple labels in one string like
-l 'backup=foo,shouldbackup=true'
but this is an AND not an OR
In my usecase its not possible to add one label to all the things i want to include into the backup.
Environment:
velero version
): v1.0.0kubectl version
):v1.14.2/etc/os-release
): Client debian:stretch-slim (container) / Server Ubuntu:18.04The text was updated successfully, but these errors were encountered: