ConfigMap-Based Configuration Sources

A configuration source of type configmap either dynamically defines a Kubernetes ConfigMap or references an existing ConfigMap in the same namespace.

ConfigMap Configuration Source Properties describes the available configuration properties.

Table 1. ConfigMap Configuration Source Properties
Property Description
global.configurationSources.config_source_name.configmap.name The name of the Kubernetes ConfigMap referenced by the configuration source config_source_name.
global.configurationSources.config_source_name.configmap.data (Optional) This is a map of file names and corresponding contents used to create a ConfigMap.
Note: If this property is not defined, it is assumed that global​.configurationSources.​config_source_name.configmap.name refers to an external ConfigMap in the same namespace.

Changes in a ConfigMap do not trigger Kubernetes to restart an application. For this reason, MATRIXX strongly recommends use of immutable ConfigMaps. Immutable ConfigMaps require you to change the name of a ConfigMap specified in Helm chart values each time you change its contents. The name change ensures that Kubernetes effects a rolling restart of the application to pick up any changes.

For more information, see the discussion about immutable ConfigMaps in Kubernetes documentation at the Kubernetes website.

Note: If you do not change the name of the ConfigMap after changing its contents, the next helm upgrade command fails with an error similar to the following:
Error: UPGRADE FAILED: cannot patch "sandbox-payment-gateway-201206101149" with kind ConfigMap: ConfigMap "sandbox-payment-gateway-201206101149" is invalid: data: Forbidden: field is immutable when `immutable` is set

The following example shows a configuration source named dynamic-config that references a ConfigMap dynamic-configmap-1 specifying a matrixx.yaml file.

global:
  configurationSources:
    dynamic-config:
      configmap:
        name: dynamic-configmap-1
        data:
          matrixx.yaml: |-
            custom_property_one: 1
            custom_property_two: 2

The following example shows the dynamic-config configuration source (and by extension the dynamic-configmap-1 ConfigMap) applied to RS Gateway.

rsgateway:
  configuration:
    sources:
      - refName: dynamic-config

Files for MATRIXX Engine, Traffic Routing Agent, Network Enabler, and Pricing Operator are copied to the /sync directory of the respective container. Files for all other components are copied to the /sync/conf directory of the respective container.

Some properties of a ConfigMap-based configuration source can be overridden at the point where they are referenced. This allows components to use a relatively general configuration source in specific ways. This can help prevent duplication of configuration.

Properties That Can Be Overridden describes the properties that can be made particular to a given component.

Table 2. Properties That Can Be Overridden
Property Description
sub_chart_name.configuration.sources.refName.name The name of an existing ConfigMap to reference, overriding the name given in the specification of the configuration source.