Skip to content

Catch unsupported LOG_LEVEL and LOG_FORMAT values before rollout #1166

Closed

Description

@privateip

Parent: #1144

Deliverable: An unsupported LOG_LEVEL or LOG_FORMAT is caught before it reaches a node, instead of crash-looping a DaemonSet.

Since #1155, every binary that runs controller-runtime reads LOG_LEVEL and LOG_FORMAT as the defaults for --log-level and --log-format. logging.Setup rejects a level slog can't parse and any format other than json or text, and the root command exits before doing anything else. An environment variable that a binary ignored before #1155, such as one set for a sidecar or copied from another service, now stops the pod at startup. Galactic's own manifests set neither variable today, so the risk is in downstream manifests and new overlays.

Failing fast is right for an explicit flag. The gap is that nothing checks the values before rollout.

Work items:

  • Add a manifest check, alongside task test:manifests, that renders every Kustomization under config/ and deploy/ and fails on an unsupported LOG_LEVEL, LOG_FORMAT, --log-level or --log-format on a Galactic container.
  • Publish the supported values from internal/logging so the check and the docs use the same list.
  • Note in the logging reference that an unsupported value stops the binary at startup, and that downstream manifests should run the same check.

Dependencies: none. If #1147 changes the flags or levels, the check follows it.

Acceptance: CI fails when a manifest in this repository sets an unsupported log level or format on a Galactic container, and the logging reference states the startup behavior.

Activity

  1. added
    tech-debt
    on Oct 27, 2026
  2. self-assigned this
    on Oct 27, 2026
  3. privateip commented on Oct 27, 2026

    @privateip
    ContributorAuthor

    Verdict: valid. Reproduced on main at ea783e8.

    1. I added a throwaway fixture under tests/manifests/fabric-api/ that patches LOG_LEVEL=verbose onto the galactic-router container from config/galactic-router/overlays/router.
    2. task test:manifests exited 0, and the rendered DaemonSet carried LOG_LEVEL: verbose.
    3. logging.Setup(w, "verbose", "json") returned --log-level: slog: level string "verbose": unknown name, so that pod would exit at startup.

    Other findings:

    • test:manifests builds only tests/manifests. Nothing renders config/ or deploy/ in CI, so no value in those trees is checked.
    • 67 kustomizations under config/ and deploy/ build on their own. The containerlab overlays under deploy/containerlab/resources build only after the lab scripts copy config/ onto each node, so a render-only check can't cover them. Their patches still set --log-level on the fabric-api sidecar.
    • No manifest names the binary a container runs. The image repository name (ghcr.io/datum-cloud/<binary>) is the reliable signal for the 8 binaries that use internal/logging.
  4. privateip commented on Oct 27, 2026

    @privateip
    ContributorAuthor

    Fix plan (branch fix/issue-1166)

    Root cause: logging.Setup validates the level and format only at startup (logging.go#L62-L81), and no manifest check runs the same rules.

    Changes:

    1. internal/logging exports Levels, Formats and Binaries, the 8 commands that call Setup, plus ValidateLevel and ValidateFormat. Setup calls the validators, so runtime behavior is unchanged. A test fails if Binaries drifts from the cmd/ packages that import the package.
    2. A new hack/check-log-settings reads rendered YAML from stdin and source YAML from files. It finds containers in pod templates, CronJobs and inline kustomization patches. For a Galactic container it rejects an unsupported LOG_LEVEL or LOG_FORMAT env value, and an unsupported --log-level or --log-format argument in either the =value or the separate-argument form. A container counts as Galactic when its image repository, or its name in an image-less patch, is in Binaries.
    3. task test:manifests renders every non-Component kustomization under config/ and deploy/ and pipes the output to the checker. It skips rendering the containerlab overlays but scans their source YAML and patches. The CI Manifests job already runs this task.
    4. docs/observability/logging.md says that an unsupported value stops the binary at startup and that downstream manifests should run the same check.

    Tests: table tests for the checker, including the verbose case from the reproduction. A fixture with a bad value must make test:manifests fail.

    Risk: CI only, no runtime change. The check reads literal values only, so a value from valueFrom or a ConfigMap isn't checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tech-debt

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions