GitOps
Introduction
In Devtron, you can either use Helm or GitOps (Argo CD) to deploy your applications and charts. GitOps is a branch of DevOps that focuses on using Git repositories to manage infrastructure and application code deployments.
If you use the GitOps approach, Devtron will store Kubernetes configuration files and the desired state of your applications in Git repositories.
Steps to Configure GitOps
Go to Global Configurations → GitOps
Select any one of the supported Git providers to configure GitOps.
The Git provider you select for configuring GitOps might impact the following sections:
Fill all the mandatory fields. Refer supported Git providers to know more about the respective fields.
In the Directory Management in Git section, you get the following options:
Use default git repository structure:
This option lets Devtron automatically create a GitOps repository within your organization. The repository name will match your application name, and it cannot be changed. Since Devtron needs admin access to create the repository, ensure the Git credentials you provided in Step 3 have administrator rights.
Allow changing git repository for application:
Select this option if you wish to use your own GitOps repo. This is ideal if there are any confidentiality/security concerns that prevent you from giving us admin access. Therefore, the onus is on you to create a GitOps repo with your Git provider, and then add it to the specific application on Devtron. Make sure the Git credentials you provided in Step 3 have at least read/write access. Choosing this option will unlock a GitOps Configuration page under the App Configuration tab.
Click Save/Update. A green tick will appear on the active Git provider.
Feature Flag
Alternatively, you may use the feature flag FEATURE_USER_DEFINED_GITOPS_REPO_ENABLE to enable or disable custom GitOps repo.
For disabling - FEATURE_USER_DEFINED_GITOPS_REPO_ENABLE: "false"
For enabling - FEATURE_USER_DEFINED_GITOPS_REPO_ENABLE: "true"
How to Use Feature Flag
Go to Devtron's Resource Browser.
Select the cluster where Devtron is running, i.e.,
default_cluster
.Go to the Config & Storage dropdown on the left.
Click ConfigMap.
Use the namespace filter (located on the right-hand side) to select
devtroncd
namespace. Therefore, it will show only the ConfigMaps related to Devtron, and filter out the rest.Find the ConfigMap meant for the dashboard of your Devtron instance, i.e.,
dashboard-cm
(with an optional suffix).Click Edit Live Manifest.
Add the feature flag (with the intended boolean value) within the
data
dictionaryClick Apply Changes.
Supported Git Providers
Below are the Git providers supported in Devtron for storing configuration files.
GitHub
Prerequisite
A GitHub account
A GitHub organization. If you don't have one, refer Creating Organization in GitHub.
Fill the following mandatory fields:
Git Host
Shows the URL of GitHub, e.g., https://github.com/
GitHub Organisation Name
Enter the GitHub organization name. If you do not have one, refer How to create organization in GitHub.
GitHub Username
Provide the username of your GitHub account
Personal Access Token
Provide your personal access token (PAT). It is used as an alternate password to authenticate your GitHub account.
If you do not have one, create a GitHub PAT here.
Access Required:
repo
- Full control of private repositories (able to access commit status, deployment status, and public repositories).
admin:org
- Full control of organizations and teams (Read and Write access). May not be required if you are using user-defined git repo.
delete_repo
- Grants delete repo access on private repositories.
GitLab
Prerequisite
A GitLab account
A GitLab group. If you don't have one, refer Creating Group in GitLab.
Fill the following mandatory fields:
Git Host
Shows the URL of GitLab, e.g., https://gitlab.com/
GitLab Group ID
Enter the GitLab group ID. If you do not have one, refer GitLab Group ID.
GitLab Username
Provide the username of your GitLab account
Personal Access Token
Provide your personal access token (PAT). It is used as an alternate password to authenticate your GitLab account.
If you do not have one, create a GitLab PAT here.
Access Required:
api
- Grants complete read/write access to the scoped project API.
write_repository
- Allows read/write access (pull, push) to the repository.
Azure
Prerequisite
An organization on Azure DevOps. If you don't have one, refer this link.
A project in your Azure DevOps organization. Refer Creating Project in Azure.
Fill the following mandatory fields:
Azure DevOps Organisation Url*
Enter the Org URL of Azure DevOps. Format should be https://dev.azure.com/<org-name>
, where <org-name>
represents the organization name, e.g., https://dev.azure.com/devtron-test
Azure DevOps Project Name
Enter the Azure DevOps project name. If you do not have one, refer Azure DevOps Project Name.
Azure DevOps Username*
Provide the username of your Azure DevOps account
Azure DevOps Access Token*
Provide your Azure DevOps access token. It is used as an alternate password to authenticate your Azure DevOps account.
If you do not have one, create a Azure DevOps access token here.
Access Required:
code
- Grants the ability to read source code and metadata about commits, change sets, branches, and other version control artifacts. More information on scopes in Azure DevOps.
Bitbucket
Here, you get 2 options:
Bitbucket Cloud - Select this if you wish to store GitOps configuration in a web-based Git repository hosting service offered by Bitbucket.
Bitbucket Data Center - Select this if you wish to store GitOps configuration in a git repository hosted on a self-managed Bitbucket Data Center (on-prem).
Bitbucket Cloud
Prerequisite
A Bitbucket account
A workspace in your Bitbucket account. Refer Creating Workspace in Bitbucket.
Fill the following mandatory fields:
Bitbucket Host
Shows the URL of Bitbucket Cloud, e.g., https://bitbucket.org/
Bitbucket Workspace ID
Enter the Bitbucket workspace ID. If you do not have one, refer Bitbucket Workspace ID
Bitbucket Project Key
Enter the Bitbucket project key. If you do not have one, refer Bitbucket Project Key. Note: If the project is not provided, the repository is automatically assigned to the oldest project in the workspace.
Bitbucket Username*
Provide the username of your Bitbucket account
Personal Access Token
Provide your personal access token (PAT). It is used as an alternate password to authenticate your Bitbucket Cloud account.
If you do not have one, create a Bitbucket Cloud PAT here.
Access Required:
repo
- Full control of repositories (Read, Write, Admin, Delete) access.
Bitbucket Data Center
Fill the following mandatory fields:
Bitbucket Host
Enter the URL address of your Bitbucket Data Center, e.g., https://bitbucket.mycompany.com
Bitbucket Project Key
Enter the Bitbucket project key. Refer Bitbucket Project Key.
Bitbucket Username*
Provide the username of your Bitbucket Data Center account
Password
Provide the password to authenticate your Bitbucket Data Center account
Miscellaneous
Creating Organization in GitHub
We do NOT recommend using GitHub organization that contains your source code.
Create a new account on GitHub (if you do not have one).
On the upper-right corner of your GitHub page, click your profile photo, then click Settings.
On the
Access
section, click Organizations.On the
Organizations
section, click New organization.Pick a plan for your organization. You have the option to select
create free organization
also.On the
Set up your organization
page,Enter the
organization account name
,contact email
.Select the option your organization belongs to.
Verify your account and click Next.
Your
GitHub organization name
will be created.
Go to your profile and click Your organizations to view all the organizations you created.
Additional References
For more information about the plans available for your team, see GitHub's products. You can also refer GitHub organization official doc page for more detail.
Creating Group in GitLab
Create a new account on GitLab (if you do not have one).
You can create a group by going to the 'Groups' tab on the GitLab dashboard and click
New group
.Select
Create group
.Enter the group name (required) and select the optional descriptions if required, and click Create group.
Your group will be created and your group name will be assigned with a new
Group ID
(e.g. 61512475).
Creating Project in Azure DevOps
Go to Azure DevOps and navigate to Projects.
Select your organization and click
New project
.On the
Create new project
page,Enter the
project name
and description of the project.Select the visibility option (private or public), initial source control type, and work item process.
Click Create.
Azure DevOps displays the project welcome page with the
project name
.
Additional References
You can also refer Azure DevOps - Project Creation official page for more details.
Creating Workspace in Bitbucket
Create a new individual account on Bitbucket (if you do not have one).
Select your profile and settings avatar on the upper-right corner of the top navigation bar.
Select
All workspaces
from the dropdown menu.Select the
Create workspace
on the upper-right corner of theWorkspaces
page.On the
Create a Workspace
page:
Enter a
Workspace name
.Enter a
Workspace ID
. Your ID cannot have any spaces or special characters, but numbers and capital letters are fine. This ID becomes part of the URL for the workspace and anywhere else where there is a label that identifies the team (APIs, permission groups, OAuth, etc.).Click Create.
Your
Workspace name
andWorkspace ID
will be created.
Additional References
You can also refer official Bitbucket Workspace page for more details.
Last updated