Courseiva
Application Deployment →hardMultiple Choice

CKAD Application Deployment Practice Question

You have a Helm chart that deploys a web application. You want to conditionally include a ConfigMap in the release based on a value 'config.enabled'. Which template syntax correctly implements this?

⚠ Common exam trap

CKAD often tests whether candidates confuse Helm's Go template syntax with Jinja2, Handlebars, or Ansible syntax — the delimiters {{ }} with 'if/end' are the giveaway for Helm.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

{{- if .Values.config.enabled }} (ConfigMap YAML) {{- end }}

Helm uses Go's text/template engine, where conditionals are written as {{ if ... }} ... {{ end }}. The {{- syntax trims preceding whitespace, which is idiomatic in Helm charts to avoid stray blank lines in rendered YAML. Option B correctly uses this Go template syntax with .Values.config.enabled as the condition.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    {% if .Values.config.enabled %} (ConfigMap YAML) {% endif %}

    Why it's wrong here

    This uses `{% if %}` and `{% endif %}`, which are Jinja2/Django template tags, not the Go template syntax that Helm relies on. Helm executes templates through Go's `text/template` package, where actions are delimited by `{{ }}` and conditionals use the `if` keyword with a matching `end`. The `%` delimiter is not recognized and would cause a parse error or render as literal text depending on context.

  • ✓

    {{- if .Values.config.enabled }} (ConfigMap YAML) {{- end }}

    Why this is correct

    This is the correct Helm conditional: `{{- if` trims all whitespace before it so the ConfigMap YAML sits directly at the intended indentation level, and `{{- end }}` trims the trailing whitespace after the block. Helm checks whether `.Values.config.enabled` evaluates to a truthy value (true for booleans, non-empty for strings/lists/maps) and renders the enclosed YAML only in that case. The dash (`-`) is critical for producing clean YAML without stray blank lines that can break resource parsing.

  • ✗

    {{- when .Values.config.enabled }} (ConfigMap YAML) {{- end }}

    Why it's wrong here

    The `when` keyword is not part of Helm's template language; Helm's data-driven directives are limited to `if`, `with`, `range`, and `else`. Using `{{- when ... }}` would produce an unrecognized operator error because Go's `text/template` expects a valid action keyword after the opening brace. A developer coming from Ansible or other systems may reach for `when`, but Helm has no equivalent—only `if` based on truthiness.

  • ✗

    {{#if .Values.config.enabled}} (ConfigMap YAML) {{/if}}

    Why it's wrong here

    `{{#if}}...{{/if}}` is Handlebars/Moustache-style syntax, which is not supported by Helm's Go templates. Helm requires an explicit `end` keyword to close a block, not a closing tag with a slash, and the `#` character is not a valid action prefix in Go's template syntax. Even if the syntax were valid, the lack of `-` dashes would leave extra whitespace/newlines in the rendered YAML, which can cause indentation errors in the resulting Kubernetes manifest.

About these practice questions

Courseiva writes every CKAD question from scratch — 826 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CNCF exam blueprint

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.