Skip to content

feat: Add k8smount provider#409

Open
mattdowdell wants to merge 1 commit intoknadh:masterfrom
mattdowdell:feat/k8smount-provider
Open

feat: Add k8smount provider#409
mattdowdell wants to merge 1 commit intoknadh:masterfrom
mattdowdell:feat/k8smount-provider

Conversation

@mattdowdell
Copy link
Copy Markdown

@mattdowdell mattdowdell commented Mar 29, 2026

Add a provider for Kubernetes volume mounts. This allows a process running in a Pod to read in configuration form ConfigMaps and Secrets, and watch for updates thereafter.

This is intended as an upgrade to reading Pod configuration in as environment variables, allowing values to be updated in place instead of requiring a Pod restart. It is not intended to replace reading of structured data in a ConfigMap or Secret, such as JSON or YAML. In such cases, it is recommended to use the existing file provider.

The following features are provided in this change:

  • Support for loading configuration from the symlink structure used by volume mounts of ConfigMap and Secrets in Kubernetes Pods.
  • Support for watching for configuration changes on said volume mounts. This feature is based on the existing file provider.
  • Support for transforming keys and values after the initial load. This feature is based on the existing environment variable provider.

This change also upgrades the Go version in the workspace to 1.25. The provider uses os.Root to prevent access to files outside the intended mount. Go 1.25 is needed to use io/fs.ReadLinkFS which extends os.Root with methods that are useful for working with symlink-based structure of volume mounts. Without these methods, we'd be forced to use the equivalent functions in os, and so abandon the protection provided by os.Root.

@mattdowdell mattdowdell force-pushed the feat/k8smount-provider branch 2 times, most recently from 763d35a to e6f7ba6 Compare March 29, 2026 10:12
Add a provider for [Kubernetes volume mounts]. This allows a process running in a Pod to read in
configuration form ConfigMaps and Secrets, and watch for updates thereafter.

This is intended as an upgrade to reading Pod configuration in as environment variables, allowing
values to be updated in place instead of requiring a Pod restart. It is not intended to replace
reading of structured data in a ConfigMap or Secret, such as JSON or YAML. In such cases, it is
recommended to use the existing file provider.

The following features are provided in this change:

- Support for loading configuration from the symlink structure used by volume mounts of ConfigMap
  and Secrets in Kubernetes Pods.
- Support for watching for configuration changes on said volume mounts. This feature is based on the
  existing file provider.
- Support for transforming keys and values after the initial load. This feature is based on the
  existing environment variable provider.

This change also upgrades the Go version in the workspace to 1.25. The provider uses [`os.Root`] to
prevent access to files outside the intended mount. Go 1.25 is needed to use [`io/fs.ReadLinkFS`]
which extends `os.Root` with methods that are useful for working with symlink-based structure of
volume mounts. Without these methods, we'd be forced to use the equivalent functions in `os`, and so
abandon the protection provided by `os.Root`.

[Kubernetes volume mounts]: https://kubernetes.io/docs/concepts/storage/volumes/
[`os.Root`]: https://pkg.go.dev/os#Root
[`io/fs.ReadLinkFS`]: https://pkg.go.dev/io/fs#ReadLinkFS
@mattdowdell mattdowdell force-pushed the feat/k8smount-provider branch from e6f7ba6 to ac08649 Compare March 29, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant