Files
cloudkitty/doc/source/admin/configuration/configuration.rst
Luka Peschke 3426a6648a Build docs with -W
This fixes all build warnings in the docs, and makes them build
with -W (consider warnings as errors).

Work items:

* Remove the useless "METRICS_CONF" global variable in the monasca collector.
  It was causing the "load_conf()" function to fail, as the
  /etc/cloudkitty/metrics.yml file couldn't be found.

* Change the docstring indentation in
  cloudkitty/rating/hash/controllers/mapping.py. This was the cause for the
  "doc/source/api-reference/v1/rating/hashmap.rst:12: WARNING: Field list ends
  without a blank line; unexpected unindent." message.

* Added a cloudkitty.conf sample to the admin documentation.

* Deleted unused files.

* Fixed the policy.yaml sample include path.

* Sorted the v2 API parameters alphabetically.

* Ignored the "wsmeext.sphinxext: directive 'autoattribute' is
  already registered" warning

* Added :noindex: directives to functions documented twice.

* Made sphinx always build with -W.

Change-Id: I5f1ab04e18920f3352c2807878cad327692a225f
2019-11-25 11:27:13 +01:00

5.1 KiB

Step by step configuration guide

Note

For a sample cloudkitty.conf file, see samples/cloudkitty-conf .

Edit /etc/cloudkitty/cloudkitty.conf to configure cloudkitty.

Common options

Options supported by most OpenStack projects are also supported by cloudkitty:

[DEFAULT]
verbose = true
debug = false
log_dir = /var/log/cloudkitty
transport_url = rabbit://RABBIT_USER:RABBIT_PASSWORD@RABBIT_HOST

API authentication method

The authentication method is defined through the auth_strategy option in the [DEFAULT] section.

Standalone mode

If you're using CloudKitty in standalone mode, you'll have to use noauth:

[DEFAULT]
auth_strategy = noauth

Keystone integration

If you're using CloudKitty with OpenStack, you'll want to use Keystone authentication:

[DEFAULT]
auth_strategy = keystone

When using Keystone, you'll have to provide the CloudKitty credentials for Keystone. These must be specified in the [keystone_authtoken] section. Since these credentials will be used in multiple places, it is convenient to use a common section:

[ks_auth]
auth_type = v3password
auth_protocol = http
auth_url = http://KEYSTONE_HOST:5000/
identity_uri = http://KEYSTONE_HOST:5000/
username = cloudkitty
password = CK_PASSWORD
project_name = service
user_domain_name = default
project_domain_name = default

[keystone_authtoken]
auth_section = ks_auth

Note

The service project may also be called services.

CloudKitty provides the rating OpenStack service.

To integrate cloudkitty to Keystone, run the following commands (as OpenStack administrator):

openstack user create cloudkitty --password CK_PASSWORD

openstack role add --project service --user cloudkitty admin

openstack service create rating --name cloudkitty \
    --description "OpenStack Rating Service"

openstack endpoint create rating --region RegionOne \
    public http://localhost:8889

openstack endpoint create rating --region RegionOne \
    admin http://localhost:8889

openstack endpoint create rating --region RegionOne \
    internal http://localhost:8889

Storage

The next step is to configure the storage. Start with the SQL and create the cloudkitty table and user:

mysql -uroot -p << EOF
CREATE DATABASE cloudkitty;
GRANT ALL PRIVILEGES ON cloudkitty.* TO 'CK_DBUSER'@'localhost' IDENTIFIED BY 'CK_DBPASSWORD';
EOF

Specify the SQL credentials in the [database] section of the configuration file:

[database]
connection = mysql+pymysql://CK_DBUSER:CK_DBPASSWORD@DB_HOST/cloudkitty

Once you have set up the SQL database service, the storage backend for rated data can be configured. A complete configuration reference can be found in the storage backend configuration guide. We'll use a v2 storage backend, which enables the v2 API. The storage version and driver to use must be specified in the [storage] section of the documentation:

[storage]
version = 2
backend = influxdb

Driver-specific options are then specified in the [storage_{drivername}] section:

[storage_influxdb]
username = cloudkitty
password = cloudkitty
database = cloudkitty
host = influxdb

Once you have configured the SQL and rated data storage backends, initalize the storage:

cloudkitty-storage-init

Then, run the database migrations:

cloudkitty-dbsync upgrade

Fetcher

The fetcher retrieves the list of scopes to rate, which will then be passed to the collector. A complete configuration reference can be found in the fetcher configuration guide. For this example, we'll use the gnocchi fetcher, which will discover scopes (in this case OpenStack projects) to rate. The fetcher to use is specified through the backend option of the [fetcher] section:

[fetcher]
backend = gnocchi

Fetcher-specific options are then specified in the [fetcher_{fetchername}] section:

[fetcher_gnocchi]
auth_section = ks_auth
region_name = MyRegion

Collector

The collector will retrieve data for the scopes provided by the fetcher and pass them to the rating modules. The collector to use is specified in the [collect] section, and the collector-specific options are specified in the [collector_{collectorname}] section:

[collect]
collector = gnocchi

[collector_gnocchi]
auth_section = ks_auth
region_name = MyRegion

Note that you'll also have to configure what metrics the collector should collect, and how they should be collected. Have a look at the collector configuration guide for this: