AI Skill Report Card

Updating IngressClassName in Values

B+78·Sep 30, 2026·Source: Web
13 / 15

For each <project>/qualif/values.yaml, ensure the result contains:

YAML
ingresses: ingressClassName: traefik

Do this with yq (eval in-place, -i), never manual text editing — it preserves YAML structure and comments better and avoids indentation mistakes.

Detect OS first:

  • Windows → binary is yq.exe
  • Linux/Mac → binary is yq
Bash
# Linux/Mac example for one file yq -i '.ingresses.ingressClassName = "traefik"' path/to/qualif/values.yaml

This single yq expression handles all three cases described below because yq's = assignment creates missing keys (ingresses, then ingressClassName) and overwrites existing scalar values — no need for separate branches in yq itself. Still, verify per-file logic explicitly (see Workflow) so you can log what changed.

Recommendation▾
Fix typo 'qualif' consistency and consider generalizing beyond the hardcoded 'qualif' environment folder name for broader reuse
14 / 15

Progress:

  • Step 1: Detect OS, pick yq binary (yq vs yq.exe)
  • Step 2: Find all */qualif/values.yaml files under project root
  • Step 3: For each file, inspect current state of ingresses / ingressClassName
  • Step 4: Apply the correct fix (add block / add key / fix value)
  • Step 5: Validate result and log a summary per file

Step 1 — Pick the binary

Bash
if [[ "$OSTYPE" == "msys" || "$OS" == "Windows_NT" ]]; then YQ=yq.exe else YQ=yq fi

Step 2 — Enumerate target files

Bash
find . -type d -name qualif -exec test -f {}/values.yaml \; -print # or directly build file list: find . -path "*/qualif/values.yaml"

Step 3 — Inspect before modifying (for correct logging / decision)

Bash
$YQ e '.ingresses' file.yaml # null if missing $YQ e '.ingresses.ingressClassName' file.yaml # null if missing key

Three cases:

  1. No ingresses key at all → add the whole block:
    Bash
    $YQ -i '.ingresses.ingressClassName = "traefik"' file.yaml
  2. ingresses exists but no ingressClassName → add key under existing block (same command works, yq merges into existing map without clobbering sibling keys):
    Bash
    $YQ -i '.ingresses.ingressClassName = "traefik"' file.yaml
  3. ingresses.ingressClassName exists but wrong value (e.g. nginx) → overwrite:
    Bash
    $YQ -i '.ingresses.ingressClassName = "traefik"' file.yaml

All three cases reduce to the same idempotent yq command — this is the key insight, use it as the single implementation, but keep the pre-check (Step 3) to report what was changed vs already-correct.

Step 4 — Apply and log

Bash
for f in $(find . -path "*/qualif/values.yaml"); do before=$($YQ e '.ingresses.ingressClassName' "$f") $YQ -i '.ingresses.ingressClassName = "traefik"' "$f" after=$($YQ e '.ingresses.ingressClassName' "$f") echo "$f: before=[$before] after=[$after]" done

Step 5 — Validate

Bash
$YQ e '.ingresses.ingressClassName' file.yaml # must print: traefik

Optionally validate the whole file still parses:

Bash
$YQ e '.' file.yaml > /dev/null || echo "INVALID YAML: $file"
Recommendation▾
The three 'cases' in Step 3 are redundant since they all resolve to the same command—trim this repetition to tighten the skill
16 / 20

Example 1 — key missing entirely Input (values.yaml):

YAML
replicaCount: 2 image: repository: myapp

Output:

YAML
replicaCount: 2 image: repository: myapp ingresses: ingressClassName: traefik

Example 2 — ingresses present, ingressClassName missing Input:

YAML
ingresses: enabled: true host: myapp.example.com

Output:

YAML
ingresses: enabled: true host: myapp.example.com ingressClassName: traefik

Example 3 — wrong value present Input:

YAML
ingresses: ingressClassName: nginx

Output:

YAML
ingresses: ingressClassName: traefik
Recommendation▾
Add an example showing a multi-document or already-correct file being skipped/logged as unchanged, and a failure/edge case (e.g., ingresses defined as a list, or malformed YAML)
  • Always use yq -i (in-place) rather than sed/regex — YAML structure/indentation stays valid.
  • Run a dry-run pass first (print before/after without -i) on a few files to confirm behavior before bulk-applying.
  • Back up files first if not under git, e.g. cp file.yaml file.yaml.bak, or rely on git diff after the run to review changes.
  • Confirm yq version is Mike Farah's Go yq (v4+), since syntax (.a.b = "x") differs from Python yq/jq wrapper.
  • Process files in a loop with clear per-file logging so partial failures are visible.
  • Don't use plain string replacement/sed for nested YAML — it breaks on differing indentation or when ingresses block already has other sibling keys.
  • Don't assume ingresses is a list — here it's treated as a map (singular ingress config with a class name), not ingresses: [].
  • Don't forget the OS-specific binary name (yq vs yq.exe); hardcoding one breaks cross-platform runs.
  • Don't skip validation — a malformed yq expression can silently produce null or corrupt the file structure.
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
13/15
Workflow
14/15
Examples
16/20
Completeness
15/20
Format
14/15
Conciseness
12/15