Skip to content

feat(helm): add auto-environment values to k8s-reporter chart#1031

Merged
mbevc1 merged 12 commits into
mainfrom
20260724_helm_auto_env
Jul 27, 2026
Merged

feat(helm): add auto-environment values to k8s-reporter chart#1031
mbevc1 merged 12 commits into
mainfrom
20260724_helm_auto_env

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
  • Expose the CLI's --auto-environment flag and its companion flags
    (--environment-description, --include-scaling, --exclude-scaling)
    as reporterConfig.* values on the k8s-reporter chart, so the reporter
    CronJob can auto-create Kosli environments (type K8S) on first run
    without editing the chart.
  • Chart version bumped to 2.6.0 and the values table in README regenerated. Also bumped CLI to 2.34.0
  • Remove obsolete conditionals empty spaces (will render smaller output and triggers changes)
  • Follow-up feat: add --auto-environment flag to kosli snapshot #1028
  • Clean up leftover Hugo lock

@mbevc1 mbevc1 added enhancement New feature or request helm labels Jul 24, 2026
@mbevc1
mbevc1 enabled auto-merge (squash) July 24, 2026 16:23
@claude

claude Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Claude finished @mbevc1's task in 1m 36s —— View job


PR Review: Helm auto-environment values

  • Gather context (diff, changed files)
  • Review chart template & values changes
  • Verify CLI flags exist & are wired
  • Check version/release sequencing
  • Post review

Reviewed the chart changes against the CLI. This is a clean, well-scoped follow-up to #1028 and the earlier review feedback has all been incorporated. ✅

Verification

  • Flags exist and are correctly inherited. --auto-environment, --environment-description, --include-scaling, --exclude-scaling are all registered as persistent flags on the snapshot command group (cmd/kosli/snapshotAutoEnvironment.go:37-40, wired via addAutoEnvironmentFlags(cmd) in snapshot.go:18), so snapshot k8s picks them up. The generated args are valid.
  • Prior feedback addressed:
    • environmentDescription is now quoted (cronjob.yaml:117) — the colon-space footgun (Prod: main cluster) is handled.
    • includeScaling uses kindIs "bool" (cronjob.yaml:119) for a proper tri-state (unset → server default), avoiding the --set-string false truthiness trap.
    • httpProxy is now quoted (cronjob.yaml:132).
  • Mutual exclusivity is safe: the template renders exactly one of --include-scaling / --exclude-scaling, so the CLI's MuXRequiredFlags guard is never tripped.
  • Docs are thorough. values.yaml clearly documents that the description/scaling values are only honoured when autoEnvironment: true, that a single description is shared across all auto-created envs, and the @default -- nil annotation flows into the README table.

Observations (non-blocking)

  1. Release sequencing (already tracked). Chart.yaml pins appVersion: v2.34.0, and since image.tag defaults to .Chart.AppVersion, the chart must not be published until CLI v2.34.0 (carrying auto-environment) is released — otherwise the default helm install hits ImagePullBackOff. You've already confirmed this ("needs to be merged after releasing auto-env feature"), so just flagging to keep it visible at merge time.
  2. Silent no-op if misconfigured. If a user sets includeScaling/environmentDescription but leaves autoEnvironment: false, those values render nothing (they're nested inside the autoEnvironment block). This is intentional and documented, so no change needed — worth noting only in case you'd prefer a fail/NOTES.txt hint in future.

Nits

  • The .hugo_build.lock deletion is a good cleanup, unrelated to the feature but harmless.
  • No tests exist for the chart templates (this repo has none for Helm rendering), so nothing regressed — but a helm template golden/snapshot check would be a nice future addition to lock in the quoting behaviour.

Nice, careful work — the tri-state scaling handling and the quoting fixes in particular are exactly right. LGTM pending the CLI v2.34.0 release ordering.
· 20260724_helm_auto_env

Comment thread charts/k8s-reporter/templates/cronjob.yaml Outdated
@mbevc1
mbevc1 force-pushed the 20260724_helm_auto_env branch from 0b94b2d to 7513d38 Compare July 24, 2026 17:14
Comment thread charts/k8s-reporter/templates/cronjob.yaml Outdated
mbevc1 added 7 commits July 24, 2026 18:29
Expose the CLI's `--auto-environment` flag and its companion flags
(`--environment-description`, `--include-scaling`, `--exclude-scaling`)
as `reporterConfig.*` values on the k8s-reporter chart, so the reporter
CronJob can auto-create Kosli environments (type K8S) on first run
without editing the chart.

Chart version bumped to 2.6.0 and the values
table in README regenerated.
Make reporterConfig.includeScaling nullable (default `null`) so it maps to
all three CLI states: unset omits both scaling flags (Kosli server
default), true passes `--include-scaling`, and false passes
`--exclude-scaling`. The template uses `kindIs "invalid"` to tell an unset
value apart from an explicit false, so autoEnvironment no longer forces a
scaling flag. Also whitespace-trims the auto-environment arg block so it
renders cleanly.
Clarify in the value help text that environmentDescription and
includeScaling apply to every environment auto-created in a single run,
that a single description is shared by all of them, and that existing
environments are never modified (the CLI ignores these flags for envs
that already exist).

Also normalise the args block whitespace: the dryRun and httpProxy
conditionals now use {{- trim markers like the auto-environment block,
so the rendered manifest has no stray blank lines.
Guard the scaling flag with `kindIs "bool"` instead of
`not (kindIs "invalid" ...)`. A string value (e.g. from
`--set-string reporterConfig.includeScaling=false` or a quoted
`includeScaling: "false"`) is Go-template truthy whenever non-empty,
which previously emitted --include-scaling regardless of the intended
value. Requiring a genuine boolean means any non-bool falls back to the
safe "unset -> server default" path.
@mbevc1
mbevc1 force-pushed the 20260724_helm_auto_env branch from 64be161 to c058258 Compare July 24, 2026 17:30
Comment thread charts/k8s-reporter/Chart.yaml
@mbevc1
mbevc1 merged commit 9f6364f into main Jul 27, 2026
20 checks passed
@mbevc1
mbevc1 deleted the 20260724_helm_auto_env branch July 27, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request helm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants