Skip to content

Commit

Permalink
revert recent lib changes (#476)
Browse files Browse the repository at this point in the history
## Issue
Previous changes made it so that on Mongos-K8s would return different
endpoints to inside K8s apps and outside k8s apps if expose-external
enabled.

However it was decided recently that this approach is incorrect.

## Solution

Revert this change and bump libpatch
  • Loading branch information
MiaAltieri authored Sep 4, 2024
1 parent 2d12b44 commit 4238861
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/charms/mongodb/v1/mongodb_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 12
LIBPATCH = 13

logger = logging.getLogger(__name__)
REL_NAME = "database"
Expand Down Expand Up @@ -303,9 +303,7 @@ def _get_config(self, username: str, password: Optional[str]) -> MongoConfigurat
if self.charm.is_role(Config.Role.MONGOS):
mongo_args["port"] = Config.MONGOS_PORT
if self.substrate == Config.Substrate.K8S:
external = self.is_external_client(relation.id)
mongo_args["port"] = self.charm.get_mongos_port(external)
mongo_args["hosts"] = self.charm.get_mongos_hosts(external)
mongo_args["port"] = self.charm.get_mongos_port()
else:
mongo_args["replset"] = self.charm.app.name

Expand Down Expand Up @@ -401,13 +399,6 @@ def get_relation_name(self):
else:
return REL_NAME

def is_external_client(self, rel_id) -> bool:
"""Returns true if the integrated client requests external connectivity."""
return (
self.database_provides.fetch_relation_field(rel_id, EXTERNAL_CONNECTIVITY_TAG)
== "true"
)

@staticmethod
def _get_database_from_relation(relation: Relation) -> Optional[str]:
"""Return database name from relation."""
Expand Down

0 comments on commit 4238861

Please sign in to comment.