---
title: Charmhub | Deploy Gnocchi K8S using Charmhub - The Open Operator Collection
description: Deploy the latest version of Gnocchi K8S as a Kubernetes Operator on
  any cloud.
url: https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service
---

# Gnocchi K8S

[OpenStack Charmers](https://charmhub.io/publisher/openstack-charmers "View all packages from OpenStack Charmers")

* [OpenStack Charmers](https://charmhub.io/publisher/openstack-charmers "View all packages from OpenStack Charmers")

Platform:

edge 1

```
juju deploy gnocchi-k8s --channel edge
```

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

[Toggle side navigation](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#drawer)

## charms.gnocchi\_k8s.v0.gnocchi\_service

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

    Fetch library

    ```
    charmcraft fetch-lib charms.gnocchi_k8s.v0.gnocchi_service
    ```

    [Download gnocchi\_service.py](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service/download)
  + *Last updated* 10 Oct 2023
  + *Revision* Library version 0.2

GnocchiService Provides and Requires module.

This library contains the Requires and Provides classes for handling
the Gnocchi service interface.

Import `GnocchiServiceRequires` in your charm, with the charm object and the
relation name:
- self
- "gnocchi-db"

Two events are also available to respond to:
- readiness\_changed
- goneaway

A basic example showing the usage of this relation follows:

```
from charms.gnocchi_k8s.v0.gnocchi_service import (
    GnocchiServiceRequires
)

class GnocchiServiceClientCharm(CharmBase):
    def __init__(self, *args):
        super().__init__(*args)
        #  GnocchiService Requires
        self.gnocchi_svc = GnocchiServiceRequires(
            self, "gnocchi-db",
        )
        self.framework.observe(
            self.gnocchi_svc.on.readiness_changed,
            self._on_gnocchi_service_readiness_changed
        )
        self.framework.observe(
            self.gnocchi_svc.on.goneaway,
            self._on_gnocchi_service_goneaway
        )

    def _on_gnocchi_service_readiness_changed(self, event):
        '''React to the Gnocchi service readiness changed event.

        This event happens when Gnocchi service relation is added to the
        model and relation data is changed.
        '''
        # Do something with the configuration provided by relation.
        pass

    def _on_gnocchi_service_goneaway(self, event):
        '''React to the Gnocchi Service goneaway event.

        This event happens when Gnocchi service relation is removed.
        '''
        # HeatSharedConfig Relation has goneaway.
        pass
```

---

Index

* [class GnocchiServiceReadinessRequestEvent](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicereadinessrequestevent)
* [class GnocchiServiceProviderEvents](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiserviceproviderevents)
* [class GnocchiServiceProvides](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiserviceprovides)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiserviceprovides-__init__)
* + [def set\_service\_status(
    self,
    relation,
    is\_ready)](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiserviceprovides-set_service_status)
* [class GnocchiServiceReadinessChangedEvent](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicereadinesschangedevent)
* [class GnocchiServiceGoneAwayEvent](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicegoneawayevent)
* [class GnocchiServiceRequirerEvents](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicerequirerevents)
* [class GnocchiServiceRequires](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicerequires)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicerequires-__init__)
* + [def get\_remote\_app\_data(
    self,
    key)](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicerequires-get_remote_app_data)
* + [def service\_ready(
    self)](https://charmhub.io/gnocchi-k8s/libraries/gnocchi_service#gnocchiservicerequires-service_ready)

#### class GnocchiServiceReadinessRequestEvent

Description

GnocchiServiceReadinessRequest Event. None

#### class GnocchiServiceProviderEvents

Description

Events class for `on`. None

#### class GnocchiServiceProvides

Description

GnocchiServiceProvides class. None

Methods

GnocchiServiceProvides.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

GnocchiServiceProvides.
set\_service\_status(

*self*

,
relation: Relation

,
is\_ready: bool
)

Description

Set gnocchi service readiness status on the relation. None

#### class GnocchiServiceReadinessChangedEvent

Description

GnocchiServiceReadinessChanged Event. None

#### class GnocchiServiceGoneAwayEvent

Description

GnocchiServiceGoneAway Event. None

#### class GnocchiServiceRequirerEvents

Description

Events class for `on`. None

#### class GnocchiServiceRequires

Description

GnocchiServiceRequires class. None

Methods

GnocchiServiceRequires.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

GnocchiServiceRequires.
get\_remote\_app\_data(

*self*

,
key: str
)

Description

Return the value for the given key from remote app data. None

GnocchiServiceRequires.
service\_ready(

*self*
)

Description

Return if gnocchi service is ready or not. None
