mirror of
https://github.com/holos-run/holos.git
synced 2026-03-19 08:44:58 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c76061b0d |
@@ -1,7 +1,7 @@
|
||||
# Want kube api objects in the apiObjects output.
|
||||
exec holos build .
|
||||
stdout '^kind: SecretStore$'
|
||||
stdout '# Source: holos component cue api objects SecretStore/default'
|
||||
stdout '# Source: CUE apiObjects.SecretStore.default'
|
||||
|
||||
-- cue.mod --
|
||||
package holos
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Want kube api objects in the apiObjects output.
|
||||
exec holos build .
|
||||
stdout '^kind: SecretStore$'
|
||||
stdout '# Source: holos component cue api objects SecretStore/default'
|
||||
stdout '# Source: CUE apiObjects.SecretStore.default'
|
||||
stderr 'skipping helm: no chart name specified'
|
||||
|
||||
-- cue.mod --
|
||||
|
||||
@@ -33,9 +33,13 @@ _apiVersion: "holos.run/v1alpha1"
|
||||
|
||||
// #CommonLabels are mixed into every kubernetes api object.
|
||||
#CommonLabels: {
|
||||
"holos.run/stage.name": #InputKeys.stage
|
||||
"holos.run/project.name": #InputKeys.project
|
||||
"holos.run/component.name": #InputKeys.component
|
||||
"holos.run/stage.name": #InputKeys.stage
|
||||
"holos.run/project.name": #InputKeys.project
|
||||
"holos.run/component.name": #InputKeys.component
|
||||
"app.kubernetes.io/part-of": #InputKeys.stage
|
||||
"app.kubernetes.io/name": #InputKeys.project
|
||||
"app.kubernetes.io/component": #InputKeys.component
|
||||
"app.kubernetes.io/instance": #InstanceName
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"cuelang.org/go/cue/load"
|
||||
@@ -131,11 +132,27 @@ func (r *Result) FinalOutput() string {
|
||||
// addAPIObjects adds the overlay api objects to finalOutput.
|
||||
func (r *Result) addOverlayObjects(log *slog.Logger) {
|
||||
b := []byte(r.FinalOutput())
|
||||
for kind, v := range r.APIObjectMap {
|
||||
for name, yamlString := range v {
|
||||
kinds := make([]string, 0, len(r.APIObjectMap))
|
||||
// Sort the keys
|
||||
for kind := range r.APIObjectMap {
|
||||
kinds = append(kinds, kind)
|
||||
}
|
||||
slices.Sort(kinds)
|
||||
|
||||
for _, kind := range kinds {
|
||||
v := r.APIObjectMap[kind]
|
||||
// Sort the keys
|
||||
names := make([]string, 0, len(v))
|
||||
for name := range v {
|
||||
names = append(names, name)
|
||||
}
|
||||
slices.Sort(names)
|
||||
|
||||
for _, name := range names {
|
||||
yamlString := v[name]
|
||||
log.Debug(fmt.Sprintf("%s/%s", kind, name), "kind", kind, "name", name)
|
||||
util.EnsureNewline(b)
|
||||
header := fmt.Sprintf("---\n# Source: holos component cue api objects %s/%s\n", kind, name)
|
||||
header := fmt.Sprintf("---\n# Source: CUE apiObjects.%s.%s\n", kind, name)
|
||||
b = append(b, []byte(header+yamlString)...)
|
||||
util.EnsureNewline(b)
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
0
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user