Create missing cloud, region, or distribution

This how-to gives instructions on how to add a missing cloud, cloud region or K8s distribution in the Commodore defaults repo.

Create a missing cloud

If the cloud on which your cluster runs doesn’t exist yet in the Commodore defaults repo, you can create it as follows:

  1. Create file cloud/<cloudname>.yml in the repo

  2. Add the new cloud to all cloud-aware distributions

    cloud=<cloudname>
    for dist in distribution/*.yml; do
      d=${dist#distribution\/}
      d=${d%.yml}
      dist_cloud="distribution/${d%.yml}/cloud"
      if [ -d "${dist_cloud}" ]; then
        echo "Adding cloud to distribution ${d}"
        touch "${dist_cloud}/${cloud}.yml"
      fi
    done
  3. If the cloud has multiple regions, continue with [_creating_a_missing_region]

Create a missing region

If the cloud region on which your cluster runs doesn’t exist yet in the Commodore defaults repo, you can create it as follows:

  1. If the cloud on which your cluster runs doesn’t exist either, go to creating a missing cloud, follow the steps there and come back here.

  2. Create files cloud/<cloudname>/params.yml and cloud/<cloudname>/<regionname>.yml.

    File cloud/<cloudname>/params.yml may exist already if you’re adding a region to an existing cloud.
  3. If the file cloud/<cloudname>.yml has keys parameters or applications, move those keys and their contents to cloud/<cloudname>/params.yml.

  4. Ensure that the file cloud/<cloudname>.yml has exactly the following contents:

    cloud/<cloudname>.yml
    classes:
      - global.cloud.<cloudname>.params
      - global.cloud.<cloudname>.${facts:region}

Create a missing distribution

If the distribution don’t exist yet in the Commodore defaults repo, you can create it as follows:

  1. Create file distribution/<distributionname>.yml in the repo.

Make a distribution cloud-aware

If you foresee — or currently have — the need to be able to provide cloud-specific configurations for a distribution, you can make the distribution cloud-aware.

  1. If the distribution doesn’t exist yet, create it

  2. Ensure that the file distribution/<distributionname>.yml has the following class includes:

    distribution/<distributionname>.yml
    classes:
      - global.distribution.<distributionname>.params
      - global.distribution.<distributionname>.cloud.${facts:cloud}
    It’s perfectly acceptable to have entries in the applications array in this file.

    It’s fine to include additional classes in this file. Remember that class includes are processed top-to-bottom. This means that if you include a class at the end of the classes array, its configuration will override configurations in the other classes.

  3. Move any parameters configuration into distribution/<distributionname>/params.yml

    Consider splitting out large component configurations from the params.yml file.

    Always split out configurations of a single component and move them into a class named distribution/<distributionname>/<component-name>.yml and include that class in distribution/<distributionname>/params.yml.

    We recommend splitting out component configurations if they consist of 30+ lines of YAML.

  4. Create folder distribution/<distributionname>/cloud and create a file <cloudname>.yml for each cloud that the distribution needs to support.

    If you’re not sure which clouds the distribution needs to support, create files for all clouds which are defined in the configuration with

    distname=<distributionname>
    for cloud in cloud/*.yml; do
      touch distribution/${distname}/${cloud}
    done