6.7. Import

The import object can be placed into a pipeline’s operators list in-place of an operator declaration. When the pipeline document is loaded, the import object will be replaced by the operator definition contained in the file referenced by the path property.

Similarly, import object can be used in operator::services property lists to import service definitions from external files.

See Overriding Values on Import below

6.7.1. Properties

6.7.1.1. path

type: string

Is the relative path, from the document the import is declared, to the the external definition file.

Notice: path values are expected to not be rooted (i.e. not begin with a ‘/’ character). Effect of rooted path values is undefined.

6.7.1.2. args

type: object

Used to pass name-value pairs to the definition loader which will be used to resolve the external file’s template.

Notice: service definitions are not derived from template, and therefore will ignore arguments passed to them.

6.7.2. Overriding Values on Import

When a definition file is imported by another definition file, properties of the imported file can be overridden by declaring values for the properties of the imported definition as part of the import declaration.

It is important to note that overriding a property replaces the value of the property. The original value and the overriding value cannot be merged in any way. For example, if a pipeline attempted to override the tag value of an operator’s container property, there is no way to retain the original container’s image value. Therefore, the overriding definition would need to supply the entire container property’s value.

6.7.2.1. Example

name: example-import-overrides
description: This pipeline definition exists solely to provide an example of how the propery values of an operator can be overridden during import.
operators:
  - name: first-operator ## The operator definition most certainly comes with its name value already declared, however the pipeline can override that value by declaring the name valu here. This make ensuring that all of the names of a pipeline's operators are unique.
    import:
      path: operators/data-reader.yml
  - name: smooth-operator
    requests:
      cpu: 4
    import:
      path: operators/data-writer.yml