canonical / discourse-k8s-operator

discourse-k8s-operator - charm repository.
Apache License 2.0
7 stars 5 forks source link

Redis integration. Do not use StoredState. #225

Closed javierdelapuente closed 7 months ago

javierdelapuente commented 7 months ago

Overview

Related to https://github.com/canonical/discourse-k8s-operator/issues/208 (failing S3 upload_assets). Also story ISD-1767.

When the Redis IP address changes, if discourse also restarts/upgrades, it can get into error state, and it will not advance. The charm will be unable to migrate/upload to s3 or any other similar action in the workload, as the Redis IP address is wrong. The reason for the Redis IP address to be wrong is because it was stored previously in StoredState, being the correct one is in the relation data of the Redis integration.

The fix consists in not using StoredState and getting the IP address from the relation data.

Rationale

There is a fix that can get Discourse into error state, without any fix except changing the charm code manually (or undeploying the charm).

Juju Events Changes

Module Changes

Library Changes

Checklist

github-actions[bot] commented 7 months ago

Test coverage for 5b9ebe8fad4b740ddf1312a472a05347b3b47e1f

Name              Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------
src/charm.py        336     32     80     13    89%   186, 194-195, 207, 335->343, 376->381, 393, 581-583, 588-589, 600-602, 607-608, 620-622, 627-628, 640-642, 667-669, 711->exit, 721->exit, 751-757, 783->exit, 797-798, 808->exit, 822
src/database.py      30      1      8      1    95%   56
-------------------------------------------------------------
TOTAL               366     33     88     14    90%

Static code analysis report

Run started:2024-04-19 12:50:21.788320

Test results:
    No issues identified.

Code scanned:
    Total lines of code: 1989
    Total lines skipped (#nosec): 3
    Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
    Total issues (by severity):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
    Total issues (by confidence):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
Files skipped (0):