GitProjector API defines projections of Git repositories.
Projection of Git repositories means that the content of selected branches and selected files are loaded into Kubernetes,
accessible through the status of the
The projected branches and files can then be used as matrix inputs for an
apiVersion: templates.kluctl.io/v1alpha1 kind: GitProjector metadata: name: preview namespace: default spec: interval: 1m url: https://github.com/kluctl/kluctl-examples.git # In case you use a private repository secretRef: name: git-credentials ref: branch: main files: - glob: "preview-envs/preview-*.yaml" parseYaml: true
The above example creates a
GitProjector that will periodically clone the kluctl-examples repo, look for the
branch and all files matching the given glob. It will then parse all yamls and make them available through the
apiVersion: templates.kluctl.io/v1alpha1 kind: GitProjector metadata: name: preview namespace: default spec: ... status: allRefsHash: 104d3dc9b5ffabf5ba3c76532fb71da58757c494acdcb7dff3665d256f516612 conditions: - lastTransitionTime: "2022-12-14T09:09:51Z" message: Success observedGeneration: 1 reason: Success status: "True" type: Ready result: - files: - parsed: - envName: preview-env1 replicas: 3 path: preview-envs/preview-env1.yaml - parsed: - envName: preview-env2 replicas: 1 path: preview-envs/preview-env2.yaml ref: branch: main
The following fields are supported in
Specifies the interval at which the
GitProjector is reconciled.
If set to
true, reconciliation is suspended.
The git url of the repository to project. Can either be a https or a git/ssh url.
The git reference to project. Either
spec.ref.tag must be set.
Both tags and refs can be regular expressions. In case of a regular expression, the controller will include all matching
refs in the
Same as in the Kluctl Controllers KluctlDeployment
List of file to project into the status. Must be of the format:
... spec: ... files: - glob: "my-file.yaml" parseYaml: true
Each entry must at least contain a
glob which is used to match files. The controller uses the
library for pattern matching.
parseYaml is set to
true, the controller will try to parse matching files as yaml and include the parsed structured
data in the resulting status. Parsing of yaml is done with the assumption that all files possibly contain multiple yaml
documents, meaning that even yaml files with just a single document will result in a parsed list of one document.
Consider the following matching yaml file:
envName: preview-env1 replicas: 3
This will result in the following projection:
... status: result: - files: - parsed: - envName: preview-env1 replicas: 3 path: preview-envs/preview-env1.yaml ref: branch: main
false, the result will contain a raw string representation of the matching files:
... status: result: - files: - path: preview-envs/preview-env1.yaml raw: |- envName: preview-env1 replicas: 3 ref: branch: main