-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use labels to filter source
in replacements
#4763
Comments
We will accept this request, but the syntax for label and/or annotation selection in the source selector should be identical to the label/annotation selection in targets. Looking through the kustomize code, it looks like target selectors are specified with the fields kustomize/api/types/selector.go Line 28 in 482e893
/triage accepted |
Thank you 🙏 and really good thing to use this api rather than the Kubernetes one. Being able to use labels and/or annotations is a great idea too. |
Is there any documentation or working examples for labelSelector? I'm trying the following; base.yaml ---
apiVersion: getambassador.io/v3alpha1
kind: Host
metadata:
name: api-regional
labels:
host-type: regional
spec:
hostname: "api.nonprod-us-west-2.some.link"
---
apiVersion: getambassador.io/v3alpha1
kind: Host
metadata:
name: api-apex
labels:
host-type: apex
spec:
hostname: "api.some.link" kustomization.yaml
tld.yaml
I feel like there's something basic I'm missing here. I'm using the document here; https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api, to guess at what
|
@jamesloosli the proposition is not yet implemented 🤔, I think this is why you have this error. |
Dear @natasha41575 @davinkevin, Is this correct to assume that what you are proposing will be somewhat identical to 'labelSelector' and/or 'annotationSelector' already implemented in patch transformer, see here? If so am I correct to assume that these could be implemented both for replacements 'source:' and 'targets[select:]' and 'targets[reject:]'? Thank you! |
The only thing of course is that originally @davinkevin was talking about the set of labels to match. And current implementation in patch transformer does matching on a single label/annotation. This brings me to another question (I guess I shouldn't even ask here) to @natasha41575 : do you think it will be difficult to replace strings with sets in patch transformer as well? Or to avoid breaking changes... maybe to introduce new sets in addition to existing single label and annotation selectors? Thank you! |
In my case, only one
It was really my original request to have multiple filter. Obviously, using a syntax like this one is something possible, but a bit strange for a new API. |
Awesome find @davinkevin! Thank you!I had no idea! As per the link you've kindly provided earlier: "operations may specify label selectors to filter the sets of objects".
Had no chance to confirm but I am guessing the same will work with 'annotationSelector:' It looks as if value based filtering with multiple operators, please see here, is also supported, e.g:
|
@vugardzhamalov 👍. To be honest, I'm not a huge fan of the Thank you for this, I can't wait to see it release 😍 |
Also anxiously waiting for this to release. Since 5.0.0 throws errors for unmatched replacements, we're unable to use the latest Kustomize.
Well that makes sense. |
Also I've just realized that it was clearly identified in merged PR that this is already implemented for both types of targets. We are just waiting for a similar change in the 'source' field now... |
This should be added to targets as well, if possible. E.g. replace some values in deployments having a specific annotation or label. |
/assign |
Any updates on this? |
Is your feature request related to a problem? Please describe.
As a kustomize & Sealed Secrets user, I would like to use
replacement
to populate the fieldspec.tls.0.secretName
of an Ingress.The problem is I don't know beforehand the secret name, but only labels. And obviously, I have multiple SealedSecrets in my setup (some for applications, some for certificates…).
So if I use something like this, the result is an error like this
Error: multiple matches for selector SealedSecret.[noVer].[noGrp]/[noName].[noNs]
, which is expected from the specificationDescribe the solution you'd like
I would like to add some more advanced criteria to resolve the object I want in
source
. In my context, and to be Kubernetes idiomatic, usinglabels
would do the job perfectly. For example, a potential API for that:Describe alternatives you've considered
I don't have any alternative at the moment, so I have to duplicate the name and update the entry in my
Ingress
definition every time I want to deploy it.Additional context
No additional context, feel free to ask question if you want. The method to be modified, IIUC is named
selectSourceNode
The text was updated successfully, but these errors were encountered: