Open
Conversation
763d35a to
e6f7ba6
Compare
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
e6f7ba6 to
ac08649
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
This change also upgrades the Go version in the workspace to 1.25. The provider uses
os.Rootto prevent access to files outside the intended mount. Go 1.25 is needed to useio/fs.ReadLinkFSwhich extendsos.Rootwith 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 inos, and so abandon the protection provided byos.Root.