In a Helm template, how do you refer to the image.port parameter?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

In a Helm template, how do you refer to the image.port parameter?

Explanation:
Accessing user-provided configuration in a Helm template is done through the .Values object. When you define image.port in values.yaml, you reference it in a template with {{ .Values.image.port }}. This is the standard, correct way to pull in the chart’s configurable value so the template uses whatever port you’ve specified at install time. Using .Release.image.port would look in release metadata, which doesn’t contain your image configuration, so it won’t work here. .Chart.Values isn’t how Helm exposes runtime values either; .Chart holds metadata about the chart itself, not the values supplied by a user. Adding a | quote would turn the number into a string, which isn’t necessary and could affect how the value is used (for example, numeric ports are often used as numbers). So the right reference is {{ .Values.image.port }}.

Accessing user-provided configuration in a Helm template is done through the .Values object. When you define image.port in values.yaml, you reference it in a template with {{ .Values.image.port }}. This is the standard, correct way to pull in the chart’s configurable value so the template uses whatever port you’ve specified at install time.

Using .Release.image.port would look in release metadata, which doesn’t contain your image configuration, so it won’t work here. .Chart.Values isn’t how Helm exposes runtime values either; .Chart holds metadata about the chart itself, not the values supplied by a user. Adding a | quote would turn the number into a string, which isn’t necessary and could affect how the value is used (for example, numeric ports are often used as numbers).

So the right reference is {{ .Values.image.port }}.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy