canonical / canonical/cos-coordinated-workers
Manage certificates in `NginxPrometheusExporter` reconciler
- Dominant language
- Python
- Stars
- 1
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
### Bug Description
Although Nginx object reconciler [has `_configure_tls()`](https://github.com/canonical/cos-coordinated-workers/blob/main/src/coordinated_workers/nginx.py#L723) which is called in its reconciler, the same piece of logic is missing from `NginxPrometheusExporter`.
In the layer definition, NginxPrometheusExporter [checks whether certificates are on the container's disk](https://github.com/canonical/cos-coordinated-workers/blob/main/src/coordinated_workers/nginx.py#L866) and if they aren't, it uses http to call Nginx. If the certs aren't provided manually by the charm, it will always use http.
We should add a `tls_config_getter` to `NginxPrometheusExporter`'s constructor and have a method to manage certificates run in the reconciler.
### To Reproduce
.
### Environment
.
### Relevant log output
```shell
.
```
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/coordinated_workers/nginx.py, comparing the existing _configure_tls() at line 723 with the NginxPrometheusExporter definition and its certificate check near line 866. Trace the reconciler and constructor, then verify that certificates supplied through tls_config_getter are managed so the exporter uses HTTPS instead of falling back to HTTP.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, prometheus, python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100