Documentation
¶
Overview ¶
Package layout places the documents of a rendered order into a GitOps repository by the paths the order names itself.
Under the source-path layout the order decides where it goes, not the CLI (stuttgart-things/claims#92, stuttgart-things/stuttgart-things#4296):
- a document annotated stuttgart-things.com/target-path goes to that file
- a document annotated stuttgart-things.com/source-path goes to that file (the annotation names the file the document lives in; the repository's check-xr-source-path holds it to that)
- a document with neither goes to the file of the document before it
Paths are relative to the repository root. If a kustomization.yaml sits next to a written file, the file's entry is appended to its resources.
Index ¶
Constants ¶
const ( // AnnotationSourcePath names the file a document lives in. AnnotationSourcePath = "stuttgart-things.com/source-path" // AnnotationTargetPath names the file a client writes a document to when // it is not the order's own file (e.g. a dev VM's ScrapeConfig). AnnotationTargetPath = "stuttgart-things.com/target-path" // AnnotationManagementCluster names the cluster that applies the order. AnnotationManagementCluster = "stuttgart-things.com/management-cluster" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
Document is one YAML document of a rendered order.
func SplitDocuments ¶
SplitDocuments splits a YAML stream into its non-empty documents.
type File ¶
File is one file of an order: its repository-relative path and the documents it holds, in render order.
type KustomizationChange ¶
type KustomizationChange struct {
Path string // repository-relative path of the kustomization
Lines []string // the appended lines, as written
Before string
After string
}
KustomizationChange is what an order appends to one kustomization.yaml.
func Kustomizations ¶
func Kustomizations(repoRoot string, files []File) ([]*KustomizationChange, error)
Kustomizations appends each file's entry to the kustomization next to it, the way the Backstage templates do: one line " - <file>" at the end of the kustomization, which needs resources: to be its last key. A directory without a kustomization is applied as a whole and gets nothing; an entry that is there already is left alone. Several files in one directory make one change.