Skip to content

without_configmap

A without behavior source backed by a Kubernetes ConfigMap mount, reloaded with watchfiles.

without_configmap

read_yaml_file

read_yaml_file(
    model_type: type[ModelT], file_name: str
) -> Callable[[Path], ModelT]

Parse a single YAML file from the mount into a validated model.

The ConfigMap is mounted with one file (e.g. config.yaml) holding a YAML mapping. This reads mount / file_name, loads it, and validates it into model_type at the boundary, so missing keys fall back to declared model defaults and the rest of the system sees an already-valid value.

watch_config

watch_config(
    mount: Path,
    parse: Callable[[Path], T],
    *,
    changes: Changes = _awatch_changes,
) -> Stream[T]

The parsed config now, and a freshly parsed value on every mount change.

parse is the boundary: it turns the mount directory into a validated value. changes is the source of reload signals, injectable so tests can drive reloads deterministically without real filesystem events; it defaults to watching the mount directory with watchfiles.