openstack-helm/doc/source/devref/oslo-config.rst
Pete Birley 5e8be5c339 Remove hacked OSLO genconfig tool
This PS removes the pregenerated config templates producing using
the hacked oslo-genconfig tool. This results in both a much smaller
codebase and also more readable configuration by removing the
requirement to specify settings via oslo namespaced references.

This initial PS applies only to Keystone, A follow up will extend to
all remaining services.

Partially implements: blueprint remove-pregenerated-config-templates
See: https://blueprints.launchpad.net/openstack-helm/+spec/remove-pregenerated-config-templates

Change-Id: I3ced7ad02c703c767925a17b1a18f6158a878e83
2017-09-19 21:51:26 -05:00

3.5 KiB

OSLO-Config Values

OpenStack-Helm generates oslo-config compatible formatted configuration files for services dynamically from values specified in a yaml tree. This allows operators to control any and all aspects of an OpenStack services configuration. An example snippet for an imaginary Keystone configuration is described here:

conf:
  keystone:
    DEFAULT: # Keys at this level are used for section headings
      max_token_size: 255
    token:
      provider: fernet
    fernet_tokens:
      key_repository: /etc/keystone/fernet-keys/
    credential:
      key_repository: /etc/keystone/credential-keys/
    database:
      max_retries: -1
    cache:
      enabled: true
      backend: dogpile.cache.memcached
    oslo_messaging_notifications:
      driver: # An example of a multistring option's syntax
        type: multistring
        values:
          - messagingv2
          - log
    security_compliance:
      password_expires_ignore_user_ids:
      # Values in a list will be converted to a comma seperated key
        - "123"
        - "456"

This will be consumed by the templated configmap-etc.yaml manifest to produce the following config file:

---
# Source: keystone/templates/configmap-etc.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: keystone-etc
data:
  keystone.conf: |+
    [DEFAULT]
    max_token_size = 255
    transport_url = rabbit://keystone:password@rabbitmq.default.svc.cluster.local:5672/openstack
    [cache]
    backend = dogpile.cache.memcached
    enabled = true
    memcache_servers = memcached.default.svc.cluster.local:11211
    [credential]
    key_repository = /etc/keystone/credential-keys/
    [database]
    connection = mysql+pymysql://keystone:password@mariadb.default.svc.cluster.local:3306/keystone
    max_retries = -1
    [fernet_tokens]
    key_repository = /etc/keystone/fernet-keys/
    [oslo_messaging_notifications]
    driver = messagingv2
    driver = log
    [security_compliance]
    password_expires_ignore_user_ids = 123,456
    [token]
    provider = fernet

Note that some additional values have been injected into the config file, this is performed via statements in the configmap template, which also calls the helm-toolkit.utils.to_oslo_conf to convert the yaml to the required layout:

{{- if empty .Values.conf.keystone.database.connection -}}
{{- tuple "oslo_db" "internal" "user" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup"| set .Values.conf.keystone.database "connection" | quote | trunc 0 -}}
{{- end -}}

{{- if empty .Values.conf.keystone.DEFAULT.transport_url -}}
{{- tuple "oslo_messaging" "internal" "user" "amqp" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | set .Values.conf.keystone.DEFAULT "transport_url" | quote | trunc 0 -}}
{{- end -}}

{{- if empty .Values.conf.keystone.cache.memcache_servers -}}
{{- tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.keystone.cache "memcache_servers" | quote | trunc 0 -}}
{{- end -}}

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: keystone-etc
data:
  keystone.conf: |+
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.keystone | indent 4 }}
{{- end }}