Manage GitOps
This page is dedicated to the GitOps
section of the Configuration
tab, the process of establishing the GitOps repository, outline benefits it extends to users within the platform capabilities. GitOps, short for "Git Operations", is a modern approach to managing and automating infrastructure and application deployments. In GitOps, the desired state of your environment is declared and stored in a Git repository. With GitOps, you can ensure that your infrastructure and applications are always in sync with your intended configurations and readily adapt to changing requirements.
Overviewβ
The purpose of the GitOps
section is to provide users with the ability to customize the state of their environments with the help of GitOps approach that enables you to store your entire deployment configuration in a Git repository, providing version control for changes, consistent collaboration, and automated deployments. Enforcing GitOps allows you to declaratively define and automate your configurations, ensuring consistency, version control, and collaboration within your team.
Add GitOps Repositoryβ
GitOps repository is added in two steps:
-
Navigate to Configuration -> Deployment-> GitOps and click the + Add GitOps Repository button:
-
Choose one of the Git servers, fill in the required fields and click Save:
-
Check the GitOps repository connected to the platform:
As the result, the
Codebase
ofsystem
type will be added to the Codebase list of the Components section:
The platform allows only one GitOps repository at a time.
GitOps Usageβ
Once the GitOps repository is added to the platform, you can set custom parameters for the deployed Helm Chart. To redefine the parameters, follow the steps below:
-
Within the GitOps repository, follow the naming convention
<deployment-flow>/<environment>/<application-name>-values.yaml
to create the chart values file, e.g.mypipe/dev/fastapi-demo-values.yaml
. -
Add the necessary custom values to the
mypipe/dev/fastapi-demo-values.yaml
file, and then commit the file to the default branch of the GitOps repository. -
Navigate to the Environments section. Open the created environment, open its stage and deploy it with the Values override checkbox selected as it is shown below:
Customize Yamllint Scan Rulesβ
Ability to customize yamllint rules is available starting from platform version 3.11.
Review and build pipelines for a GitOps repository use yamllint
to scan YAML files. By default, predefined rules are applied automatically. However, it is possible to customize and extend the default rules by adding a .yamllint
configuration file to the root of the GitOps repository. This file should define the required rules and parameters. For example:
# yamllint configuration file
# Extends the default configuration:
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
extends: default
ignore:
- '.yamllint'
rules:
line-length: disable # Disable line-length rule
document-start: disable # Disable rule for requiring '---' at the document start
In this example, the line-length
and document-start
rules are disabled. For more details on available rules and their configurations, refer to the yamllint documentation.
After creating the .yamllint
file, commit it to the main branch of the GitOps repository. Once the changes are applied, the yamllint
scan in review and build pipelines will use the custom rules defined in the .yamllint
file.
Delete GitOps Repositoryβ
In case you need to delete the GitOps repository, do the following:
-
Delete the GitOps repository in the Git provider.
-
Delete the Codebase custom resource using the
kubectl delete
command:kubectl delete Codebase krci-gitops -n krci