Lesson 03 Templating Fundamentals
Theme:

Homework: Templating Fundamentals

Lesson 03 — 3 tasks, self-check criteria

Instructions

Complete each task independently. Use helm template to verify your output at every step. Check your work against the self-check criteria listed under each task.

Task 1: Multi-Service ConfigMap with Pipelines

Create a Helm chart called hw-templating with a ConfigMap template that reads a list of services from values.yaml and generates environment variables for each service.

values.yaml

services:
  - name: api-gateway
    port: 8080
    protocol: https
  - name: auth-service
    port: 3000
    protocol: http
  - name: worker
    port: 9090
    protocol: grpc

defaults:
  timeout: "30s"
  retries: 3

Requirements

Expected output (partial)

data:
  API_GATEWAY_URL: "https://api-gateway:8080"
  API_GATEWAY_PORT: "8080"
  AUTH_SERVICE_URL: "http://auth-service:3000"
  AUTH_SERVICE_PORT: "3000"
  WORKER_URL: "grpc://worker:9090"
  WORKER_PORT: "9090"
  DEFAULT_TIMEOUT: "30s"
  DEFAULT_RETRIES: "3"

Self-Check

Task 2: Conditional Deployment with Resource Toggles

Extend your chart with a Deployment template that uses conditionals, with, and range to handle optional sections.

Add to values.yaml

replicaCount: 3
image:
  repository: myapp
  tag: "2.1.0"

probes:
  liveness:
    enabled: true
    path: /healthz
    port: 8080
  readiness:
    enabled: true
    path: /ready
    port: 8080

nodeSelector:
  disktype: ssd
  region: us-east-1

tolerations:
  - key: "dedicated"
    operator: "Equal"
    value: "gpu"
    effect: "NoSchedule"

Requirements

Self-Check

Task 3: Release-Aware Annotations with Capabilities

Create a Service template that uses .Release and .Capabilities objects for metadata and version-aware configuration.

Requirements

Self-Check

Grading Rubric

GradeCriteria
Pass Task 1 complete: ConfigMap renders with correct range iteration, pipelines produce expected URL format, and all values are quoted. helm template produces valid YAML.
Merit Tasks 1 and 2 complete: Deployment includes working conditionals for probes, with for nodeSelector, toYaml | nindent for tolerations, required for image tag, and clean whitespace (no blank lines).
Distinction All three tasks complete: Service uses .Release and .Capabilities objects correctly, ternary function for conditional annotations, and all self-check criteria pass for every task.

Hints