0Pricing
Helm Academy · Lesson

Scoping a Block with with

Narrowing the dot to a subtree, and its pitfalls.

Stop Repeating Long Paths

Typing .Values.image.repository over and over gets noisy. The with action narrows the dot to a subtree so you can write shorter paths.

The with Action

A with block opens with {{ with SOMETHING }} and closes with {{ end }}. Inside it, the dot is reset to whatever you passed in.

{{ with .Values.image }}
repository: {{ .repository }}
tag: {{ .tag }}
{{ end }}

All lessons in this course

  1. Conditional Blocks with if and else
  2. Truthiness and Operators in Conditions
  3. Looping Over Lists and Maps with range
  4. Scoping a Block with with
← Back to Helm Academy