Skip to content

Shorthand for "current yaml path" in templating #25

@crwr45

Description

@crwr45

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:

spec:
  template:
    metadata:
      name: ThisNameCanBeAnything

the current template would have to look like:

spec:
  template:
    metadata:
      name: {{ .spec.template.metadata.name }}

If there were to be a shorthand for this operation it could look like:

spec:
  template:
    metadata:
      name: {{ anything() }}

Consider this a discussion of:

  • is it possible and worthwhile to include a shorthand for "replace this with the value from the same yaml path"?
  • is this worth implementing only for trivial cases (i.e. only when the full path already exists in the template)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions