This is a Krateo Provider that clones git repositories (eventually applying templates).
Git Provider clones git repositories and may apply Mustache templates. It then pushes the cloned and modified repository to a different location. The templating values are retrieved in a configmap referenced in the custom resource. It provides automatic reconciliation when changes are retrieved from the original repository.
Git Provider leverages Krateo provider-runtime a production-grade version of the controller-runtime.
$ helm repo add krateo https://charts.krateo.io
$ helm repo update krateo
$ helm install git-provider krateo/git-providerAs a first step, you need to create a kind: Repo Manifest as shown below and a ConfigMap which will contain the templating values.
git-provider uses the Mustache library (see custom delimiter reference) to apply templating. Therefore, you need to specify the custom delimiter you want to use in the first line of the file you want to template. You can see an example here.
If you need to template the filename of a file, you can only use the delimiters {{ }} (e.g., {{ your-prop }}.yaml).
apiVersion: git.krateo.io/v1alpha1
kind: Repo
metadata:
name: test-repo
spec:
enableUpdate: false
configMapKeyRef:
key: values
name: filename-replace-values
namespace: default
fromRepo:
authMethod: generic
branch: main
path: skeleton
usernameRef:
key: username
name: git-username
namespace: default
secretRef:
key: token
name: git-secret
namespace: default
url: https://github.com/your-organization/fromRepo
toRepo:
authMethod: generic
branch: main
cloneFromBranch: main
path: /
secretRef:
key: token
name: git-secret
namespace: default
usernameRef:
key: username
name: git-username
namespace: default
url: https://github.com/your-organization/toRepo
unsupportedCapabilities: trueapiVersion: v1
kind: ConfigMap
metadata:
name: filename-replace-values
data:
values: |
{
"organizationName": "krateo",
"repositoryName": "testfilename",
"serviceType": "type",
"servicePort": "8080",
"testTemplate": "tplKrateo"
}| Environment Variable | Type | Default Value | Description |
|---|---|---|---|
GIT_PROVIDER_DEBUG |
bool | false |
Run with debug logging |
GIT_PROVIDER_SYNC_PERIOD |
duration | 1h |
Controller manager sync period (e.g., 300ms, 1.5h, or 2h45m) |
GIT_PROVIDER_POLL_INTERVAL |
duration | 2m |
Poll interval controls how often an individual resource should be checked for drift |
GIT_PROVIDER_MAX_RECONCILE_RATE |
int | 5 |
The number of concurrent reconciles for each controller. Maximum number of resources that can be reconciled at the same time |
GIT_PROVIDER_LEADER_ELECTION |
bool | false |
Use leader election for the controller manager |
GIT_PROVIDER_MAX_ERROR_RETRY_INTERVAL |
duration | 1m |
The maximum interval between retries when an error occurs. Should be less than half of the poll interval |
GIT_PROVIDER_MIN_ERROR_RETRY_INTERVAL |
duration | 1s |
The minimum interval between retries when an error occurs. Should be less than max-error-retry-interval |
To view the CR configuration visit this link.