HostOSConfiguration

Available since 2.26.0 (17.1.0 and 16.1.0) TechPreview

Warning

This section is intended for informational purposes only. For security reasons and to ensure safe and reliable cluster operability, contact Mirantis support to start using this resource.

This section describes the HostOSConfiguration custom resource (CR) used in the Container Cloud API. It contains all necessary information to introduce and load modules for further configuration of the host operating system of the related Machine object.

Note

This object must be created and managed on the management cluster.

For demonstration purposes, we split the Container Cloud HostOSConfiguration CR into the following sections:

HostOSConfiguration metadata

metadata

The Container Cloud HostOSConfiguration custom resource (CR) contains the following fields:

  • apiVersion

    Object API version that is kaas.mirantis.com/v1alpha1.

  • kind

    Object type that is HostOSConfiguration.

The metadata object field of the HostOSConfiguration resource contains the following fields:

  • name

    Object name.

  • namespace

    Project in which the HostOSConfiguration object is created.

Configuration example:

apiVersion: kaas.mirantis.com/v1alpha1
kind: HostOSConfiguration
metadata:
  name: host-os-configuration-sample
  namespace: default

HostOSConfiguration configuration

The spec object field contains configuration for a HostOSConfiguration object and has the following fields:

  • machineSelector

    A set of Machine objects to apply the HostOSConfiguration object to. Has the format of the Kubernetes label selector.

  • order

    Positive integer between 1 and 1024 that indicates the order of applying HostOSConfiguration objects on newly added or newly assigned machines. An object with the lowest order value is applied first. If the value is not set, the object is applied last in the order.

    If no order field is set for all HostOSConfiguration objects, the objects are sorted by name.

    Note

    If a user changes the HostOSConfiguration object that was already applied on some machines, then only the changed items from the spec.configs section of the HostOSConfiguration object are applied to those machines, and the execution order applies only to the changed items.

    The configuration changes are applied on corresponding LCMMachine objects almost immediately after host-os-modules-controller verifies the changes.

  • configs

    List of configurations to apply to Machine objects defined in machineSelector. Each entry has the following fields:

    • module

      Name of the module that refers to an existing module in one of HostOSConfigurationModules objects.

    • moduleVersion

      Version of the module in use in the SemVer format.

    • description

      Description and purpose of the configuration.

    • values

      Module configuration in the format of key-value pairs without nested objects.

    • secretValues

      Reference to a Secret object that contains the configuration values for the module:

      • namespace

        Project name of the Secret object.

      • name

        Name of the Secret object.

      Note

      You can use both values and secretValues together. But if the values are duplicated, the secretValues data rewrites duplicated keys of the values data.

    • order

      Positive integer between 1 and 1024 that indicates the order of applying the module configuration. A configuration with the lowest order value is applied first. If the value is not set, the configuration is applied last in the order.

      If no order field is set within the configs list entries, the following rules apply to the ordering when comparing each pair of entries:

      1. Ordering by alphabet based on the module values unless they are equal.

      2. Ordering by version based on the moduleVersion values, with preference given to the lesser value.

    • phase

      LCM phase, in which a module configuration must be executed. The only supported value is reconfigure.

Configuration example:

spec:
   machineSelector:
      matchLabels:
        label-name: "label-value"
   configs:
   - description: Brief description of the configuration
     module: mirantis-provided-module-name
     moduleVersion: 1.0.0
     order: 1
     phase: "reconfigure"
     values:
       foo: 1
       bar: "baz"

HostOSConfiguration status

The status field of the HostOSConfiguration object contains the current state of the object:

  • configs

    List of configurations statuses, indicating results of application of each configuration. Every entry has the following fields:

    • moduleName

      Existing module name from the list defined in the spec:modules section of the related HostOSConfigurationModules object.

    • moduleVersion

      Existing module version defined in the spec:modules section of the related HostOSConfigurationModules object.

    • modulesReference

      Name of the HostOSConfigurationModules object that contains the related module configuration.

    • modulePlaybook

      Name of the Ansible playbook of the module. The value is taken from the related HostOSConfigurationModules object where this module is defined.

    • moduleURL

      URL to the module package in the FQDN format. The value is taken from the related HostOSConfigurationModules object where this module is defined.

    • moduleHashsum

      Hash sum of the module. The value is taken from the related HostOSConfigurationModules object where this module is defined.

    • lastDesignatedConfiguration

      Key-value pairs representing the latest designated configuration data for modules. Each key corresponds to a machine name, while the associated value contains the configuration data encoded in the gzip+base64 format.

    • lastValidatedSpec

      Last validated module configuration encoded in the gzip+base64 format.

    • valuesValid

      Validation state of the configuration and secret values defined in the object spec against the module valuesValidationSchema. Always true when valuesValidationSchema is empty.

    • error

      Details of an error, if any, that occurs during the object processing by host-os-modules-controller.

HostOSConfiguration status example:

status:
  configs:
  - lastValidatedSpec: <gzip+base64 encoded data>
    lastDesignatedConfiguration:
      machine1: <gzip+base64 encoded data>
      machine2: <gzip+base64 encoded data>
    moduleName: mirantis-provided-module-name
    moduleVersion: 1.0.0
    modulesReference: host-os-configuration-modules-sample
    modulePlaybook: main.yml
    moduleURL: https://binary.mirantis.com/bm/bin/host-os-modules/mirantis-provided-module-name-1.0.0.tgz
    moduleHashsum: <sha256sum>
    valuesValid: true