1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#IgnoreConcrete: true
#InferTasks: true
-- in.cue --
package kubecluster
import (
"list"
"strings"
"tool/file"
)
#Cluster: {
clusterName: string
dnsPrefix: *"kube-\(clusterName)" | string
if strings.HasPrefix(clusterName, "foo_") {
dnsPrefix: "foo-kube-" + strings.TrimPrefix(clusterName, "foo_")
}
}
clusters: [CLUSTER=string]: #Cluster & {
clusterName: CLUSTER
}
dnsRecords: [string]: string
for clusterName, cluster in clusters {
dnsRecords: "\(cluster.dnsPrefix)-monitoring-proxy": "127.0.0.1"
}
clusters: vagrant: {
}
#Cluster: CLUSTER={
foobar: CLUSTER.clusterName
}
root: build: {
$short: "exportiert gesamte Konfiguration nach ./output/"
task: mkdir: {
output: file.MkdirAll & {path: "output"}
}
task: "output/dns-records.zone": file.Create & {
$after: task.mkdir.output
filename: "output/dns-records.zone"
let lines = list.SortStrings([
for name, addr in dnsRecords {
"\(name) A \(addr)"
},
])
contents: strings.Join(lines, "\n") + "\n"
}
}
-- out/run/errors --
-- out/run/t0 --
graph TD
t0("root.build.task.mkdir.output [Ready]")
t1("root.build.task.#quot;output/dns-records.zone#quot; [Waiting]")
t1-->t0
-- out/run/t1 --
graph TD
t0("root.build.task.mkdir.output [Terminated]")
t1("root.build.task.#quot;output/dns-records.zone#quot; [Ready]")
t1-->t0
-- out/run/t1/value --
{
$id: "tool/file.Mkdir"
path: "output"
createParents: true
permissions: 511
stdout: "foo"
}
-- out/run/t1/stats --
Leaks: 0
Freed: 54
Reused: 45
Allocs: 9
Retain: 2
Unifications: 38
Conjuncts: 98
Disjuncts: 56
-- out/run/t2 --
graph TD
t0("root.build.task.mkdir.output [Terminated]")
t1("root.build.task.#quot;output/dns-records.zone#quot; [Terminated]")
t1-->t0
-- out/run/t2/value --
{
$after: {
$id: "tool/file.Mkdir"
path: "output"
createParents: true
permissions: 511
stdout: "foo"
}
$id: "tool/file.Create"
filename: "output/dns-records.zone"
permissions: 438
contents: """
kube-vagrant-monitoring-proxy A 127.0.0.1
"""
stdout: "foo"
}
-- out/run/t2/stats --
Leaks: 0
Freed: 55
Reused: 55
Allocs: 0
Retain: 2
Unifications: 39
Conjuncts: 105
Disjuncts: 57
-- out/run/stats/totals --
Leaks: 0
Freed: 109
Reused: 100
Allocs: 9
Retain: 4
Unifications: 77
Conjuncts: 203
Disjuncts: 113
|