Improve Gitaly cgroup error handling
Context
Gitaly can be configured to use cgroups to impose CPU and memory limits on forked processes, e.g. git
invocations.
The cgroups manager is initialised when the Gitaly server is started, at which point it creates a parent cgroup. It does not, however, create a repository-scoped cgroup.
Proposal
Improve the cgroup initialisation logic by verifying that a repository-scoped cgroup can be created on startup. This is particularly important to Gitaly deployments on Kubernetes, as there are more configuration-related issues which may occur that prevents cgroups from being created. Gitaly should be run with cgroups enabled on Kubernetes so resources can be managed inline with the Gitaly pod spec.
Edited by James Liu