---
title: Charmhub | Deploy MongoDB using Charmhub - The Open Operator Collection
description: Deploy the latest version of MongoDB on any cloud.
url: https://charmhub.io/mongodb/libraries/config_server_interface
---

# MongoDB

[Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")

* [Canonical](https://charmhub.io/publisher/data-platform "View all packages from Canonical")
* [Databases](https://charmhub.io/?filter=databases)

Platform:

24.04

22.04

6/stable 265

```
juju deploy mongodb --channel 6/stable
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/mongodb/libraries/config_server_interface#drawer)

## charms.mongodb.v0.config\_server\_interface

* [*Docstrings*Docstrings](https://charmhub.io/mongodb/libraries/config_server_interface)
  [*Code*Source code](https://charmhub.io/mongodb/libraries/config_server_interface/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.mongodb.v0.config_server_interface
    ```

    [Download config\_server\_interface.py](https://charmhub.io/mongodb/libraries/config_server_interface/download)
  + *Last updated* 12 Nov 2024
  + *Revision* Library version 0.15

In this class, we manage relations between config-servers and shards.

This class handles the sharing of secrets between sharded components, adding shards, and removing
shards.

---

Index

* [class ClusterProvider](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name,
    substrate)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-__init__)
* + [def pass\_hook\_checks(
    self,
    event)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-pass_hook_checks)
* + [def is\_valid\_mongos\_integration(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-is_valid_mongos_integration)
* + [def update\_config\_server\_db(
    self,
    event)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-update_config_server_db)
* + [def generate\_config\_server\_db(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-generate_config_server_db)
* + [def update\_ca\_secret(
    self,
    new\_ca)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterprovider-update_ca_secret)
* [class ClusterRequirer](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name,
    substrate)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-__init__)
* + [def handle\_mongos\_k8s\_users\_removal(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-handle_mongos_k8s_users_removal)
* + [def pass\_hook\_checks(
    self,
    event)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-pass_hook_checks)
* + [def is\_mongos\_running(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-is_mongos_running)
* + [def update\_config\_server\_db(
    self,
    config\_server\_db)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-update_config_server_db)
* + [def update\_keyfile(
    self,
    key\_file\_contents)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-update_keyfile)
* + [def get\_tls\_statuses(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-get_tls_statuses)
* + [def get\_config\_server\_name(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-get_config_server_name)
* + [def get\_config\_server\_uri(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-get_config_server_uri)
* + [def is\_ca\_compatible(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-is_ca_compatible)
* + [def is\_mongos\_tls\_missing(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-is_mongos_tls_missing)
* + [def is\_config\_server\_tls\_missing(
    self)](https://charmhub.io/mongodb/libraries/config_server_interface#clusterrequirer-is_config_server_tls_missing)

#### class ClusterProvider

Description

Manage relations between the config server and mongos router on the config-server side. None

Methods

ClusterProvider.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str

,
substrate: str
)

Description

Constructor for ShardingProvider object. None

ClusterProvider.
pass\_hook\_checks(

*self*

,
event: EventBase
)

Description

Runs the pre-hooks checks for ClusterProvider, returns True if all pass. None

ClusterProvider.
is\_valid\_mongos\_integration(

*self*
)

Description

Returns true if the integration to mongos is valid. None

ClusterProvider.
update\_config\_server\_db(

*self*

,
event
)

Description

Provides related mongos applications with new config server db. None

ClusterProvider.
generate\_config\_server\_db(

*self*
)

Description

Generates the config server database for mongos to connect to. None

ClusterProvider.
update\_ca\_secret(

*self*

,
new\_ca: str
)

Description

Updates the new CA for all related shards. None

#### class ClusterRequirer

Description

Manage relations between the config server and mongos router on the mongos side. None

Methods

ClusterRequirer.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str

,
substrate: str
)

Description

Constructor for ShardingProvider object. None

ClusterRequirer.
handle\_mongos\_k8s\_users\_removal(

*self*
)

Handles the removal of all client mongos-k8s users and the mongos-k8s admin user.

Description

Raises:
PyMongoError

ClusterRequirer.
pass\_hook\_checks(

*self*

,
event
)

Description

Runs the pre-hooks checks for ClusterRequirer, returns True if all pass. None

ClusterRequirer.
is\_mongos\_running(

*self*
)

Description

Returns true if mongos service is running. None

ClusterRequirer.
update\_config\_server\_db(

*self*

,
config\_server\_db
)

Description

Updates config server str when necessary. None

ClusterRequirer.
update\_keyfile(

*self*

,
key\_file\_contents: str
)

Description

Updates keyfile when necessary. None

ClusterRequirer.
get\_tls\_statuses(

*self*
)

Description

Returns statuses relevant to TLS. None

ClusterRequirer.
get\_config\_server\_name(

*self*
)

Description

Returns the name of the Juju Application that mongos is using as a config server. None

ClusterRequirer.
get\_config\_server\_uri(

*self*
)

Description

Returns the short form URI of the config server. None

ClusterRequirer.
is\_ca\_compatible(

*self*
)

Description

Returns true if both the mongos and the config server use the same CA. None

ClusterRequirer.
is\_mongos\_tls\_missing(

*self*
)

Description

Returns true if the config-server has TLS enabled but mongos does not. None

ClusterRequirer.
is\_config\_server\_tls\_missing(

*self*
)

Description

Returns true if the mongos has TLS enabled but the config-server does not. None
