filemap - processing Kubernetes-style config maps and secrets
What's this
filemap is a Python module for comfortable processing of Kubernetes-style config maps and secrets, mounted as the volumes.
Usage
When connected as volumes, Kubernetes config maps and secrets are single-level directory, where files are keys and file contents are values.
Basic usage
When loaded, inside FileMap object, keys are transformed into fields and namespaces, field trees are formed with the dots in file names, as:
- somekey => obj.data.somekey
- some.key => obj.data.some.key
- some.another.key => obj.data.some.another.key
Example:
from filemap import FileMap
config = FileMap('/etc/config')
print(config.data.somekey)
print(config.data.some.key)
print(config.data.some.another.key)
Note: when text data is loaded, it's automatically right-stripped.
Getting single key by name
print(config.get('some.key'))
print(config.get('some.another.key'))
Serialization to dict
When serialized, FileMap object is transformed into dict:
data = config.serialize() # or
data = dict(config) # does the same
print(data['somekey'])
print(data['some']['key'])
print(data['some']['another']['key'])
Combining multiple volumes
FileMap object can be updated multiple times with content from the different data folders:
config = FileMap()
config.update('/etc/config')
config.update('/etc/config2')
config.update('/etc/secrets')
If the same keys exist in different volumes, newer keys override the older ones.
Loading binary data, numbers, JSON
Refer to library pydoc for more info
Installation
pip3 install filemap
Metadata
Release files for filemap 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filemap-0.0.7.tar.gz | 3.1 kB | Without provenance | Details for filemap-0.0.7.tar.gz |
Release files / filemap-0.0.7.tar.gz
| Download URL | filemap-0.0.7.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20c087e9ba1da457ca0b0d10d7265f7ef3cb0c3327637f706e727c084ed0b171
|
|
BLAKE2b-256 checksum How to use checksums |
263721edb13aac2053e20e760693a86362ccc4029635d8609f4ad753026590c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
|
Security for filemap 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.