Git-Based Configuration Sources

A configuration source of type git performs a git clone command of a Git repository into an initContainer before unpacking files to the shared volume on the pod.

Retrieving files based on a tag or commit hash is supported. The Git repository can be secure or insecure, but MATRIXX Support recommends securing the repository with SSH keys.

Git-Based Configuration Source Properties describes the available configuration properties.

Table 1. Git-Based Configuration Source Properties
Property Description
global.configurationSources.name.git.repositoryUrl The URL of the Git repository, in SSH or HTTP format. For example:
[email protected]:matrixx/matrixx-configuration.git
or
http://gitlab.acme.com/matrixx/matrixx-configuration.git
global.configurationSources.name.git.tag (Optional) The name of the Git tag to use. If none is specified, the latest version of the default branch is used. This property and the commitHash property are mutually exclusive.
global.configurationSources.name.git.commitHash (Optional) The commit hash to use when checking out. The latest version of the default branch is used if not specified. This property is mutually exclusive with the tag property.
global.configurationSources.name.git.repositoryPath (Optional) The path within the repository to clone. Use this option if you do not want to clone the entire contents of the repository.
global.configurationSources.name.git.repositoryCredentials.secretName (Optional) The name of an existing Kubernetes secret in the same namespace that has entries which are copied as files to ~/.config/git.
global.configurationSources.name.git.sshKey.secretName (Optional) The name of an existing Kubernetes secret in the same namespace that has a private SSH key file optionally and optionally a known_host file and passphrase.

The following example shows specification of two Git-based configuration sources, acme-rsgateway-config and acme-pricing:

global:
  configurationSources:
 
    acme-rsgateway-config:
      git:
        repositoryUrl: [email protected]:matrixx/matrixx-configuration.git
        tag: DEV-20210521-1230
        sshKey:
          secretName: acme-gitlab-sshkey
 
    acme-pricing:
      git:
        repositoryUrl: [email protected]:matrixx/pricing-configuration.git
        tag: DEV-20210520-1023
        sshKey:
          secretName: acme-gitlab-sshkey
 
  topology:
    domains:
    - subdomains:
        - id: 1
          pricing:
            configurationSource:
              refName: acme-pricing
            fileName: pricing.xml
 
rsgateway:
  configuration:
    sources:
      - refName: acme-rsgateway-config

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

Some properties of a Git-based configuration source can be overridden at the point where it is referenced. This allows components to use a relatively general configuration source in specific ways. This can help prevent duplication of configuration, such as credentials.

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
repositoryUrl The URL of the Git repository.
tag The name of the tag to use.
commitHash The commit hash to use.
repositoryPath The path within the repository to copy. Use this option to only copy a subset of the repository.

The following example shows use of overrides. A single configuration source generic-git-config is defined at the global level. The components that reference this configuration source, RS Gateway and Gateway Proxy, source override global properties of the configuration source. Both components specify different, specific repositoryPath values, and RS Gateway also specifies a Git tag.

global:
  configurationSources:
 
    generic-git-config:
      git:
        repositoryUrl: [email protected]:matrixx/matrixx-configuration.git
        tag: DEV-20210521-1230
        sshKey:
          secretName: acme-gitlab-sshkey
 
gateway-proxy:
  configuration:
    sources:
      - refName: generic-git-config
        git:
          repositoryPath: gateway-proxy
 
rsgateway:
  configuration:
    sources:
      - refName: generic-git-config
        git:
          repositoryPath: rsgateway
          tag: DEV-20210522-0934