When setting up the `gitops` functionality, set the current project by default
Release notes
You can start using the GitLab agent for Kubernetes in two steps: (1) register the agent on the GitLab UI, (2) apply the provided command to your Kubernetes cluster. These two steps create an agent without a configuration file. To get the full benefits of the agent, like pull-based deployments, a configuration file is required.
Specifically for pull-based deployments, you always had to specify the project where the manifests are stored. This required changing the file from project to project. From today, omitting the project id will look for manifests in the current project. This should simplify setting up new agents across several projects following the same conventions for storing their manifests.
Problem to solve
Simplify getting started and single-repo setup.
Proposal
Given that the agent is configured in project gitlab-org/cluster-integration/gitlab-agent
simplify this
gitops:
manifest_projects:
- id: gitlab-org/cluster-integration/gitlab-agent
paths:
- glob: '/team1/app1/*.yaml'
to this
gitops:
manifest_projects:
- paths:
- glob: '/team1/app1/*.yaml'
If no id
is given, treat it as the same project.
This would enable us to create project templates with agent configurations and could simplify many setups.
Implementation proposal
- Make the config field optional (i.e. remove validation, add a test for that). See where the field is used and ensure no invariants are broken by the change, maybe add tests if you find something interesting.
- Make the field, used in the gRPC request, optional (i.e. remove validation, add a test for that). See where the field is used and ensure no invariants are broken by the change, maybe add tests if you find something interesting.
- Change logic in the GitOps server to use
GitalyInfo
andgitalypb.Repository
fromapi.AgentInfo
(rather than fromProjectInfo
) in case project id is an empty string. Add some tests for the change to protect against regressions.
Definition of done
-
Default Kas to reference current project instead of ID if ID is not present -
Document this default and use in example projects