Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy signing keys from main to workers #349

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

amandahla
Copy link
Collaborator

@amandahla amandahla commented May 13, 2024

Attention

To be merged after IRC PRs.

Overview

Copy signing keys from main unit to worker since is required to be the same for prevent problems while sending signed events.

Also, check if Redis configuration has changed before restarting Synapse. Redis charm sends the same custom event for relation created and joined.

Rationale

Every unit will sign events with the same key.

Juju Events Changes

Module Changes

Library Changes

Checklist

No doc is changed in CH.

@amandahla amandahla changed the title WIP - Copy signing keys from main to workers Copy signing keys from main to workers May 15, 2024
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
arturo-seijas
arturo-seijas previously approved these changes May 20, 2024
@@ -58,15 +61,32 @@ def _change_config(self, charm_state: CharmState) -> None:
Args:
charm_state: Instance of CharmState
"""
if self._charm.get_main_unit() is None and self._charm.unit.is_leader():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I see, the method database_observer._change_config is nearly equal to the method charm.change_config. Why not calling the charm method instead? (maybe add that method to the base class of the charm, so no casting is needed)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will be better handled/discussed in ISD-1820. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But...this is related to the last commit that I pushed regarding is_main check. I'll wait for the integration tests to run and see the behavior but I think it would be easy to do your suggestion in all observers and just call the charm.change_config method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: Merge this one (after reviews) and then work on the reconcile/restarts in the ISD-1820.

renovate bot and others added 6 commits June 3, 2024 12:03
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* chore: update charm libraries

* remove stored state from redis observer

* remove stored state

* fix tests

* src-docs

* fix unit tests

* Update test_charm_scaling.py

* fix unit tests

* fix tests

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Arturo Seijas <arturo.seijas@canonical.com>
Co-authored-by: javierdelapuente <javier.delapuente@canonical.com>
Co-authored-by: arturo-seijas <102022572+arturo-seijas@users.noreply.github.com>
Copy link
Contributor

github-actions bot commented Jun 3, 2024

Test coverage for 9bf0b75

Name                            Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------------------
src/actions/__init__.py             2      0      0      0   100%
src/actions/register_user.py       21      0      2      0   100%
src/actions/reset_instance.py      20      0      2      0   100%
src/admin_access_token.py           9      0      0      0   100%
src/backup.py                     175      5     24      2    96%   353-354, 423-424, 480->482, 483
src/backup_observer.py            134     16     14      0    89%   132-135, 140-143, 179-182, 211-214
src/charm.py                      325     16     84      9    94%   141->143, 146, 270-271, 298, 305, 384-388, 391-392, 417-419, 431->exit, 449-452, 514-515
src/charm_state.py                109      1     20      1    98%   252
src/charm_types.py                 34      0     10      0   100%
src/database_client.py             57      1     12      4    93%   35, 47->exit, 69->exit, 88->98
src/database_observer.py           62      9     14      3    82%   75-76, 86-93, 109->111
src/exceptions.py                   3      0      0      0   100%
src/irc_bridge.py                  36      9      6      0    79%   31, 71-86
src/media_observer.py              52      4      4      2    89%   56, 82, 104-105
src/mjolnir.py                     89      1     28      3    97%   82, 86->93, 91->93
src/observability.py               13      0      0      0   100%
src/pebble.py                     223     33     34     10    83%   121-125, 156-157, 169->exit, 180-184, 224-225, 294-295, 297-298, 312, 314, 316, 318, 320, 327-330, 351, 399-400, 422-423, 612-632
src/redis_observer.py              49      5      6      1    89%   65-68, 85-86
src/s3_parameters.py               22      0      4      0   100%
src/saml_observer.py               44      1      8      0    98%   66
src/smtp_observer.py               69      4     16      2    93%   77-81, 84, 103->108
src/synapse/__init__.py             3      0      0      0   100%
src/synapse/admin.py               19      2      2      0    90%   40-41
src/synapse/api.py                175      3     24      3    97%   176, 229, 402
src/synapse/workload.py           298     28     66     11    89%   300-301, 322-323, 401->403, 418->exit, 422-423, 443-444, 484-485, 521-522, 541-543, 545, 567-568, 623, 639, 686->689, 713-714, 733, 741->743, 743->745, 750-751, 787, 814, 833->838, 839
src/user.py                        23      0      4      0   100%
---------------------------------------------------------------------------
TOTAL                            2066    138    384     51    92%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:01
Run started:2024-06-03 15:16:27.607653

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 10965
  Total lines skipped (#nosec): 4
  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):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants