Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Oct 26, 2022

Issue

  • Jira issue: DPE-820
  • A TLS flag was not set when the charm was not ready but is already related to the TLS certificates operator. This commonly happens when the charm is deployed in a bundle together with the TLS certificates operator.
  • Also, another problem happened and was related to the charm sending a certificate signing request (CSR) with it's IP address as a DNS name instead of an IP address.

Solution

  • Update the code to correctly set the TLS flag when the workload hasn't started yet, but already has a relation with the TLS certificates operator.

Context

  • You can FOCUS on the following files when reviewing:

    • src/charm.py: has the change in the restart logic (to match the k8s charm) and also adds the missing change of the TLS flag (that is used internally by the charm to call the Patroni REST API using either HTTP or HTTPS).

    • tests/integration/test_tls.py: has the updates that Will made to improve the test (simulating what we have on a bundle deployment: no wait_for_idle).

  • Other files and what has changed on them:

Testing

  • The integration test was improved and two new units tests were added.

Release Notes

  • Fix TLS flag value change when the workload hasn't started yet.
  • Fix IP address on certificate signing request.

Thanks @WRFitch for starting this fixes.

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #44 (1bacda9) into main (4994516) will increase coverage by 1.60%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
+ Coverage   62.45%   64.05%   +1.60%     
==========================================
  Files           6        6              
  Lines         815      818       +3     
  Branches      122      121       -1     
==========================================
+ Hits          509      524      +15     
+ Misses        276      264      -12     
  Partials       30       30              
Impacted Files Coverage Δ
src/charm.py 56.25% <100.00%> (+2.99%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@marceloneppel marceloneppel changed the title Fix TLS switch Fix TLS flag Oct 27, 2022
Copy link

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

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

Very good work, Marcelo!

Copy link
Contributor

@MiaAltieri MiaAltieri left a comment

Choose a reason for hiding this comment

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

Looks great 2 minor comments

@marceloneppel marceloneppel merged commit 5c6e5f7 into main Oct 27, 2022
@marceloneppel marceloneppel deleted the fix-tls-switch branch October 27, 2022 09:58
@marceloneppel
Copy link
Member Author

Thanks for the reviews, @Mehdi-Bendriss and @MiaAltieri!

BON4 pushed a commit to BON4/postgresql-operator that referenced this pull request Apr 23, 2024
* fix early tls deployment by only reloading patroni config if it's already running

* added unit test for reloading patroni

* lint

* removing postgres restart check

* adding series flags to test apps

* adding series flags to test apps

* made series into a list

* Update test_new_relations.py

* updating test to better emulate bundle deploymen

* updated tls lib

* Fix TLS IP address on CSR

* removed failing test for now. This will be fixed before merge

* Fix TLS

* Update TLS lib

* Remove unneeded series

* Add comment

* Add Juju agent version bootstrap constraint

* Add test for restart method

* Update TLS lib

* Add test for update config method

* Update TLS lib

* Improve comment

Co-authored-by: WRFitch <will.fitch@canonical.com>
Co-authored-by: Will Fitch <WRFitch@outlook.com>
github-actions bot added a commit to canonical/test-runners-2-github-x64-postgresql-operator that referenced this pull request May 23, 2024
github-actions bot added a commit to canonical/test-runners-2-azure-arm64-postgresql-operator that referenced this pull request May 23, 2024
github-actions bot added a commit to canonical/test-runners-2-is-x64-postgresql-operator that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants