Marcel van Lohuizen | 3e592b4 | 2019-01-11 20:31:29 +0100 | [diff] [blame] | 1 | [TOC](Readme.md) [Prev](templates.md) [Next](packages.md) |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 2 | |
| 3 | # Modules, Packages, and Instances |
| 4 | |
| 5 | ## Packages |
| 6 | |
| 7 | A CUE file is a standalone file by default. |
| 8 | A `package` clause allows a single configuration to be split across multiple |
| 9 | files. |
| 10 | |
Marcel van Lohuizen | 75cb003 | 2019-01-11 12:10:48 +0100 | [diff] [blame] | 11 | ## Instances |
| 12 | |
| 13 | All files within a directory hierarchy with the same package identifier belong |
| 14 | to the same package. |
| 15 | Each directory within this hierarchy provides a different "view" of this package |
| 16 | called an _instance_. |
| 17 | An instance of a package for a directory is defined by all CUE files in that |
| 18 | directory and all of its ancestor directories, belonging to the same package. |
| 19 | This allows common configuration to be shared and policies to be enforced |
| 20 | across a collection of related configurations. |
| 21 | |
| 22 | See the [Kubernetes Tutorial](../kubernetes/Readme.md) for a concrete example |
| 23 | of instances. |
| 24 | |
| 25 | |
| 26 | ## Modules |
| 27 | |
| 28 | A _module_ is the directory hierarchy containing the CUE files of a package. |
| 29 | The root of this directory hierarchy is the _module root_. |
| 30 | It may be explicitly marked with a `cue.mod` file. |
| 31 | |
| 32 | <!-- TODO: |
| 33 | The module root may contain a `pkg` directory containing packages that are |
| 34 | importable with import. |
| 35 | The convention is to use the URL from which the package is retrieved. |
| 36 | --> |
| 37 | |