github.com/xchangeee/syslet/schema@v0.2.0

core/sysdef.cue raw

 1package core
 2
 3// Sysdef collects containers, networks, volumes, builds, secrets by name and
 4// provides an 'enabled' flag to quickly remove items without deleting them from
 5// code
 6#Sysdef: {
 7	// Containers by name, the key is set as the spec name
 8	containers!: [Name=string]: #SysdefContainerUnit & {spec: name: Name}
 9
10	// Networks by name, the key is set as the spec name
11	networks!: [Name=string]: #SysdefNetworkUnit & {spec: name: Name}
12
13	// Volumes by name, the key is set as the spec name
14	volumes!: [Name=string]: #SysdefVolumeUnit & {spec: name: Name}
15
16	// Image builds by name, the key is set as the spec name
17	builds!: [Name=string]: #SysdefBuildUnit & {spec: name: Name}
18
19	// Secrets by name, the key is set as the spec name
20	secrets!: [Name=string]: #SysdefSecret & {spec: name: Name}
21}
22
23// Fields shared by every Sysdef entry
24#SysdefUnit: {
25	// Disabled entries are left out of the output
26	enabled!: bool
27}
28
29// Sysdef entry wrapping a container spec
30#SysdefContainerUnit: {
31	#SysdefUnit
32
33	// Container spec
34	spec!: #ContainerSpec
35}
36
37// Sysdef entry wrapping a network spec
38#SysdefNetworkUnit: {
39	#SysdefUnit
40
41	// Network spec
42	spec!: #NetworkSpec
43}
44
45// Sysdef entry wrapping a volume spec
46#SysdefVolumeUnit: {
47	#SysdefUnit
48
49	// Volume spec
50	spec!: #VolumeSpec
51}
52
53// Sysdef entry wrapping a build spec
54#SysdefBuildUnit: {
55	#SysdefUnit
56
57	// Build spec
58	spec!: #BuildSpec
59}
60
61// Sysdef entry wrapping a secret spec
62#SysdefSecret: {
63	#SysdefUnit
64
65	// Secret spec
66	spec!: #SecretSpec
67}
68
69// Reasonable default values to sysdef
70#SysdefDefaults: {
71	containers: {
72		[string]: enabled: bool | *true
73		[string]: spec: removalAllowed: bool | *true
74		[string]: spec: desiredState:   string | *#ContainerDesiredStateRunning
75	}
76
77	networks: {
78		[string]: enabled: bool | *true
79		[string]: spec: removalAllowed: bool | *true
80		[string]: spec: reclaimPolicy:  string | *#ReclaimPolicyDelete
81	}
82
83	volumes: {
84		[string]: enabled: bool | *true
85		[string]: spec: removalAllowed: bool | *true
86		[string]: spec: reclaimPolicy:  string | *#ReclaimPolicyDelete
87	}
88
89	builds: {
90		[string]: enabled: bool | *true
91		[string]: spec: reclaimPolicy: string | *#ReclaimPolicyDelete
92	}
93
94	secrets: {
95		[string]: enabled: bool | *true
96	}
97}