Draft: Support configuring continuous profiling for Workhorse
What does this MR do?
We want to enable GitLab Continuous Profiling (via Google Cloud Profiler) for 2 different services running on a webservice
pod:
- Workhorse
- GitLab Metrics Exporter
This requires setting an environment variable read by labkit
. However, this environment variable is currently only settable at the pod level, for example: https://gitlab.com/gitlab-com/gl-infra/k8s-workloads/gitlab-com/-/blob/6eb21a527fda39f3b9b0bf5414795685eb59895f/releases/gitlab/values/values.yaml.gotmpl#L660
This prevents us from discerning between different configurations for different services all running on the same pod.
With this MR, we allow this variable to be configured specifically for the Workhorse container. This will allow us to use extraEnv
to configure it for services running in the webservice
container.
Related issues
- Original problem to solve: gitlab-org/gitlab-metrics-exporter#21
- How we detected the clash: gitlab-com/gl-infra/k8s-workloads/gitlab-com!2262 (closed)
Test plan
Deploy chart with the workhorse.continuousProfiling
key, e.g.:
$ helm upgrade gitlab . \
--set global.hosts.domain=<ip>.nip.io \
--set global.hosts.externalIP=<ip> \
--set certmanager-issuer.email=me@example.com \
--set global.image.pullPolicy=Always \
--set gitlab.webservice.workhorse.continuousProfiling="stackdriver?service=mk-cp-test&project-id=<gcp_proj_id>"
Verify env in gitlab-workhorse
container:
git@gitlab-webservice-default-74dcc74987-pzn69:/$ env | grep PROFILING
GITLAB_CONTINUOUS_PROFILING=stackdriver?service=mk-cp-test&project-id=group-memory-testbed-c2c979
I also verified this actually works:
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
Merge Request Title and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added -
Integration tests added to GitLab QA -
Does not apply. Equivalent MR/issue for omnibus-gitlab opened -
Validate potential values for new configuration settings. Formats such as integer 10
, duration10s
, URIscheme://user:passwd@host:port
may require quotation or other special handling when rendered in a template and written to a configuration file.