-
Notifications
You must be signed in to change notification settings - Fork 18
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
Shorthand for "current yaml path" in templating #25
Comments
My initial thought is that this would be too complex if all cases are supported. |
Yep agreed. Unless you're talking about specifically the name? i.e a template function that would map to But generally we should try to be a little prudent when comes to adding custom functions in the code base and when we do...it should super general purpose IMO (of course exception apply but hopefully not many) And tbh |
I think using the merges would make this no longer required as you could just leave it out completely. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
/lifecycle frozen |
The new spec:
template:
metadata:
name: ".*" The additional cost of this approach is that you would need to mark that field as a regex in the metadata.yaml: apiVersion: v2
parts:
- name: ExamplePart
components:
- name: Example
allOf:
- path: that-template.yaml
config:
perField:
- pathToKey: spec.template.metadata.name
inlineDiffFunc: regex |
A very common pattern with this approach is to have an entry in the template that resolves to the value at the same YAML path in the document being compared. This is repetitive and therefore a potential source of error, particularly with longer paths or more complex documents.
Example:
For the document:
the current template would have to look like:
If there were to be a shorthand for this operation it could look like:
Consider this a discussion of:
The text was updated successfully, but these errors were encountered: