Deploying climate-ref-frontend:v0.2.3 against the climate-ref-aft Helm chart (0.1.0) against an existing REF state volume surfaces two issues that together force /ref to be mounted read-write in the API pod when a read-only mount should be sufficient.
1. cv_cmip7_aft.yaml missing from packaged climate_ref_core
On startup the API resolves the dimensions CV via climate_ref.config._dimensions_cv_factory:
filename = "cv_cmip7_aft.yaml"
return Path(str(importlib.resources.files("climate_ref_core.pycmec") / filename))
In the worker image (ghcr.io/climate-ref/climate-ref:v0.13.0) the file is present at:
/app/.venv/lib/python3.11/site-packages/climate_ref_core/pycmec/cv_cmip7_aft.yaml
In the frontend image (ghcr.io/climate-ref/climate-ref-frontend:v0.2.3) climate_ref_core is installed but that YAML is not in the wheel, so the API crashes with:
FileNotFoundError: [Errno 2] No such file or directory:
'/app/.venv/lib/python3.11/site-packages/climate_ref_core/pycmec/cv_cmip7_aft.yaml'
The image's build process appears to strip or omit package-data from climate_ref_core. Fixing the frontend image (or vendoring the file) so that the packaged wheel includes climate_ref_core/pycmec/*.yaml resolves this.
Current workaround: an init container copies the file from the worker image onto the shared /ref PVC and the API is pointed at it via REF_DIMENSIONS_CV_PATH.
2. SQLite DB opened read-write at startup
With REF_DATABASE_URL=sqlite:////ref/ref.db (or the default derived from REF_CONFIGURATION), the API opens the DB in read-write mode and SQLite tries to create a journal/WAL sidecar next to the DB file. When /ref is mounted readOnly: true this fails:
OperationalError: (sqlite3.OperationalError) unable to open database file
For a read-only consumer (API just reads the state written by workers), the DB should either be opened via a read-only URI (sqlite:///file:/ref/ref.db?mode=ro&immutable=1&uri=true) or the API should not require write access to /ref at all.
Current workaround: drop readOnly: true on the API's /ref mount.
Environment
- Chart:
climate-ref-aft 0.1.0 (climate-ref-aft PR #7)
- Worker image:
ghcr.io/climate-ref/climate-ref:v0.13.0
- Frontend image:
ghcr.io/climate-ref/climate-ref-frontend:v0.2.3
- REF core: 0.13.0
- Kubernetes 1.x, Talos Linux
Suggested fixes
- Frontend image build: include
climate_ref_core/pycmec/*.yaml in the wheel / image.
- API: open the configured SQLite DB with
mode=ro&immutable=1 (or accept a URI-form URL) when the API is the sole reader, so /ref can stay read-only.
Deploying
climate-ref-frontend:v0.2.3against the climate-ref-aft Helm chart (0.1.0) against an existing REF state volume surfaces two issues that together force/refto be mounted read-write in the API pod when a read-only mount should be sufficient.1.
cv_cmip7_aft.yamlmissing from packagedclimate_ref_coreOn startup the API resolves the dimensions CV via
climate_ref.config._dimensions_cv_factory:In the worker image (
ghcr.io/climate-ref/climate-ref:v0.13.0) the file is present at:In the frontend image (
ghcr.io/climate-ref/climate-ref-frontend:v0.2.3)climate_ref_coreis installed but that YAML is not in the wheel, so the API crashes with:The image's build process appears to strip or omit package-data from
climate_ref_core. Fixing the frontend image (or vendoring the file) so that the packaged wheel includesclimate_ref_core/pycmec/*.yamlresolves this.Current workaround: an init container copies the file from the worker image onto the shared
/refPVC and the API is pointed at it viaREF_DIMENSIONS_CV_PATH.2. SQLite DB opened read-write at startup
With
REF_DATABASE_URL=sqlite:////ref/ref.db(or the default derived fromREF_CONFIGURATION), the API opens the DB in read-write mode and SQLite tries to create a journal/WAL sidecar next to the DB file. When/refis mountedreadOnly: truethis fails:For a read-only consumer (API just reads the state written by workers), the DB should either be opened via a read-only URI (
sqlite:///file:/ref/ref.db?mode=ro&immutable=1&uri=true) or the API should not require write access to/refat all.Current workaround: drop
readOnly: trueon the API's/refmount.Environment
climate-ref-aft0.1.0 (climate-ref-aft PR #7)ghcr.io/climate-ref/climate-ref:v0.13.0ghcr.io/climate-ref/climate-ref-frontend:v0.2.3Suggested fixes
climate_ref_core/pycmec/*.yamlin the wheel / image.mode=ro&immutable=1(or accept a URI-form URL) when the API is the sole reader, so/refcan stay read-only.