Add Environments support to the GitLab Agent
DRI from grouprelease: @shinya.maeda
Release notes
Problem to solve
- As an Application Operator, I want to see what is currently running in my namespaces/clusters.
- As an Application Operator, I want to control and monitor rollouts.
- As a Release Manager, I want to control and monitor rollouts.
Add Environment support to deployments managed by the GitLab Agent for Kubernetes.
Proposal
By @marshall007
:
I think a more logical short-term fit for the Agent is for it to facilitate the creation and teardown of "environments" within GitLab via the Kubernetes API (in the form of CRDs and/or annotations on the ConfigMap
inventory object). In other words, let the cluster be the authoritative source of "environments" and "deployments" and have the Agent act as a shim for syncing that cluster state back to GitLab.
This would be awesome because users would no longer need to explicitly implement a CI job for tearing down environments. Tearing down an environment becomes synonymous with pruning all the resources associated with an inventory object/id. This could now be done either via the GitLab UI or manually in the cluster to the same effect. Currently if you manually delete the namespace in the cluster associated with a review app, GitLab is unaware that this environment has been deleted.
A ton of discussion happened in #350697 (comment 833047627)
apiVersion: k8s.gitlab.io/v1
kind: Environment
metadata:
name: review-023f1bce01-my-review-branch
spec:
name: review/my-review-branch
externalUrl: https://023f1bce01-my-review-branch.review.example.com
autoStop: "1 week"
scope:
inventoryId: 01243567789-my-inventory-id
labels:
customLabel: customValue
namespace: my-environment-namespace
The UI could show the Kubernetes resources returned based on the scope
filters:
-
inventoryId
: return the resources owned by the given inventory id and their siblings -
labels
: return the resources that match the given labels -
namespace
: return the resources from the given namespace only -
these filters are
AND
-ed together -
The list of filters can be extended later if needed.
-
An
Environment
with aninventoryId
filter could be auto-created by specifying the other parts ofspec
as part of thegitops.manifest_projects
configuration to simplify the integration setup.
Intended users
Metrics
-
Any ideas for MAU based metrics?
-
Number of environments updated / month
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.