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

[DPE-3451][DPE-3452] Expose pgbouncer #137

Merged
merged 29 commits into from
Feb 16, 2024
Merged

[DPE-3451][DPE-3452] Expose pgbouncer #137

merged 29 commits into from
Feb 16, 2024

Conversation

dragomirp
Copy link
Contributor

@dragomirp dragomirp commented Feb 1, 2024

  • Implements expose interface flag (still pending reviews)
  • Adds TLS if relation is exposed
  • Hotpatches data-integrator for integration tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy of the data integrator with the expose flag requested.

if tls:
sslmode = "require"
else:
sslmode = "disable"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will work with TLS enabled as well.

Comment on lines 97 to 108
# TODO remove hotpatching when data-integrator implements its side of the replation
await ops_test.model.wait_for_idle(apps=[DATA_INTEGRATOR_APP_NAME])
await _update_file(
ops_test,
"./lib/charms/data_platform_libs/v0/data_interfaces.py",
"lib/charms/data_platform_libs/v0/data_interfaces.py",
)
await _update_file(
ops_test,
"./tests/integration/relations/pgbouncer_provider/data_integrator_charm.py",
"src/charm.py",
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replace the data_interfaces and charm code on the data-integrator units, so that we can implement the interface in the mean time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Q: why did you go with "mission impossible"-style of live data-integrator charm patching instead of PR data-intgrator charms? :-)

@dragomirp dragomirp mentioned this pull request Feb 2, 2024
@dragomirp dragomirp changed the title [DPE-3451] Expose pgbouncer [DPE-3451][DPE-3452] Expose pgbouncer Feb 2, 2024
@dragomirp dragomirp marked this pull request as ready for review February 2, 2024 13:33
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly methods required by the Postgresql TLS charm lib.

key, ca, cert = self.tls.get_tls_files()
if key is not None:
self.render_file(
f"{PGB_CONF_DIR}/{self.app.name}/{TLS_KEY_FILE}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should use the app specific config dir, in case of multiple subordinates in the same principle.

Comment on lines -385 to -403
@pytest.mark.group(1)
async def test_relation_with_data_integrator(ops_test: OpsTest):
"""Test that the charm can be related to the data integrator without extra user roles."""
config = {"database-name": "test-database"}
await ops_test.model.deploy(
DATA_INTEGRATOR_APP_NAME,
channel="edge",
config=config,
)
await ops_test.model.add_relation(f"{PGB}:database", DATA_INTEGRATOR_APP_NAME)
async with ops_test.fast_forward():
await ops_test.model.wait_for_idle(status="active")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to its own suite.

Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

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

LGTM! Just let's wait for the reviews.

Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

LGTM for the code and test. Well done!
P.S. for me your approach with livepatching data-integrator is crazy... IMHO invest 3 hours to improve data-integrator and remove livepatching-blackmagic from here. Tnx!

Comment on lines 97 to 108
# TODO remove hotpatching when data-integrator implements its side of the replation
await ops_test.model.wait_for_idle(apps=[DATA_INTEGRATOR_APP_NAME])
await _update_file(
ops_test,
"./lib/charms/data_platform_libs/v0/data_interfaces.py",
"lib/charms/data_platform_libs/v0/data_interfaces.py",
)
await _update_file(
ops_test,
"./tests/integration/relations/pgbouncer_provider/data_integrator_charm.py",
"src/charm.py",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: why did you go with "mission impossible"-style of live data-integrator charm patching instead of PR data-intgrator charms? :-)

Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

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

Great updates!

@dragomirp dragomirp merged commit 7231fdf into main Feb 16, 2024
30 checks passed
@dragomirp dragomirp deleted the dpe-3451-expose branch February 16, 2024 10:56
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.

3 participants