Juju Charm - Cloudkitty
Go to file
hernandanielg eb39635b4d Cloudkitty charm
This charm enables the deployment of the cloudkitty service
in the Openstack environment, cloudkitty service provides rating as a service
based on metrics, it handles field mapping rules to calculate costs and generate reports for the end-user.

Cloudkitty charm can relate to mysql,  rabbitmq-server, gnocchi and keystone.

func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/929
Change-Id: I35353c24c779b226d5edd2641a3177258849122b
2022-10-06 19:31:43 +00:00
lib/charms Cloudkitty charm 2022-10-06 19:31:43 +00:00
src Cloudkitty charm 2022-10-06 19:31:43 +00:00
templates Cloudkitty charm 2022-10-06 19:31:43 +00:00
tests Cloudkitty charm 2022-10-06 19:31:43 +00:00
unit_tests Cloudkitty charm 2022-10-06 19:31:43 +00:00
.flake8 Cloudkitty charm 2022-10-06 19:31:43 +00:00
.gitignore Cloudkitty charm 2022-10-06 19:31:43 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:36:33 +00:00
.jujuignore Cloudkitty charm 2022-10-06 19:31:43 +00:00
.stestr.conf Cloudkitty charm 2022-10-06 19:31:43 +00:00
.zuul.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
LICENSE Cloudkitty charm 2022-10-06 19:31:43 +00:00
README.md Cloudkitty charm 2022-10-06 19:31:43 +00:00
actions.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
build-requirements.txt Cloudkitty charm 2022-10-06 19:31:43 +00:00
charmcraft.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
config.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
metadata.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
osci.yaml Cloudkitty charm 2022-10-06 19:31:43 +00:00
rename.sh Cloudkitty charm 2022-10-06 19:31:43 +00:00
requirements.txt Cloudkitty charm 2022-10-06 19:31:43 +00:00
run_tests Cloudkitty charm 2022-10-06 19:31:43 +00:00
test-requirements.txt Cloudkitty charm 2022-10-06 19:31:43 +00:00
tox.ini Cloudkitty charm 2022-10-06 19:31:43 +00:00

README.md

Cloudkitty

Cloudkitty charm - Openstack Rating as a Service

Overview

This charm provides a way to deploy Cloudkitty - Openstack Rating as a Service module - in Openstack

What is CloudKitty ?

CloudKitty is a generic solution for the chargeback and rating of a cloud. Provides a metric-based rating for cloud administrators allowing them to create rating rules to the collected data.

CloudKitty usage

With Cloudkitty, it is possible to:

  • Collect metrics from OpenStack (through Gnocchi).
  • Apply rating rules to the previous metrics.
  • Retrieve the rated information, grouped by scope and/or by metric type.

However, it is not possible to:

  • Limit resources in other OpenStack services.
  • Add taxes, convert between currencies, etc...

CloudKitty associates a price to a metric for a given period, the price is mapped according to end-user needs.

Configuration

Cloudkitty charm configuration options

  • debug
    to run service in debug mode change debug config value
    juju config cloudkitty debug=true
    
  • region
    set the openstack cloud region, if value required to be changed preferably to specify in a bundle
    cloudkitty:
        charm: ch:cloudkity
        options:
            region: MyRegion
    

To display all configuration option information run juju config cloudkitty. If the application is not deployed then see the charm's configuration file.

Deployment

Deploy cloudkitty charm

juju deploy cloudkitty --channel edge

Or in a bundle

applications:
  cloudkitty:
    charm: ch:cloudkitty
    channel: edge
    num_units: 1
    series: jammy

Relations

Cloudkitty charm supports the following relations.

MySQL relation - relation to mysql-operator charm - provides database storage for the cloudkitty service.

NOTE: This charm is not backward compatible with legacy mysql-innodb-cluster charm

juju deploy mysql --channel edge
juju relate cloudkitty mysql

Keystone relation - provides identity management.

juju deploy keystone
juju relate cloudkitty keystone

Gnocchi relation - provides metrics collector service.

juju deploy gnocchi
juju relate cloudkitty gnocchi

RabbitMQ relation - provides messages queue service.

juju deploy rabbitmq-server
juju relate cloudkitty rabbitmq-server

Actions

This section lists Juju actions supported by the charm. Actions allow specific operations to be performed on a per-unit basis.

  • restart-services
    restarts cloudkitty-{api,processor} services in the unit.

    juju run-action --wait cloudkitty/leader restart-services
    

Usage

To interact with the service we should use the built-in openstack cloudkitty client in the openstackclients package

Check clients usage like this

openstack rating --help

First enable hashmap module

$ openstack rating module enable hashmap

Then start by creating a service called image for example

$ openstack rating hashmap service create image

Create a field called flavor_id as an example, and associate it with the service using the service ID

$ openstack rating hashmap field create <SERVICE_ID> flavor_id

Map the field with a value of the specific field, a flavor id

$ openstack flavor list
+---------+-----------+-------+------+-----------+-------+-----------+
| ID      | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+---------+-----------+-------+------+-----------+-------+-----------+
| 123abc  | m1.tiny   |   512 |    8 |        40 |     1 | True      |
+---------+-----------+-------+------+-----------+-------+-----------+

Create the mapping of type flat and let's assign a cost of 1.2

$ openstack rating hashmap mapping create --type flat --field-id <FIELD_ID> --value 123abc 1.2

Finally check the summary report

$ openstack rating summary get

TO-DO

This charm is under development not yet stable, the following list provides pending features

  • Enable TLS support using [TLS interface]

  • InfluxDB relation required for storage v2

  • Cloudkitty dashboard charm relation

  • High availability

Contributing

Please see the Juju SDK docs for guidelines on enhancements to this charm following best practice guidelines, and CONTRIBUTING.md for developer guidance.

Follow Openstack best practices for Software contributions in charm development.

Bugs

Please report bugs on Launchpad.

For general charm questions refer to the OpenStack Charm Guide.