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