Fix dependency proxy object storage config.
Environment
GitLab chart 4.3.2
This only happens when enabling dependency proxy storage.
Problem
I noticed Init:CrashLoopBackOff
on the sidekiq and webservice pods and found this in it's logs:
+ /scripts/set-config /var/opt/gitlab/templates /srv/gitlab/config
/usr/lib/ruby/2.6.0/psych.rb:577:in `initialize': No such file or directory @ rb_sysopen - /etc/gitlab/objectstorage/dependencyProxy (Errno::ENOENT)
from /usr/lib/ruby/2.6.0/psych.rb:577:in `open'
from /usr/lib/ruby/2.6.0/psych.rb:577:in `load_file'
from (erb):122:in `<main>'
from /usr/lib/ruby/2.6.0/erb.rb:901:in `eval'
from /usr/lib/ruby/2.6.0/erb.rb:901:in `result'
from /scripts/set-config:22:in `block in <main>'
from /scripts/set-config:18:in `each'
from /scripts/set-config:18:in `<main>'
Begin parsing .erb files from /var/opt/gitlab/templates
By digging deeper I found a misconfiguration where this connection file is not mounted properly. The config at charts/gitlab/templates/_dependencyProxy.tp
diverges with charts/gitlab/charts/sidekiq/templates/deployment.yaml #L337
:
{{- include "gitlab.appConfig.objectStorage.configuration" (dict "name" "dependencyProxy" "config" .config "context" .context) | nindent 2 }}
^^^^^^^^^^^^^^^
Compiled output
...
dependency_proxy:
enabled: true
object_store:
enabled: true
remote_directory: gitlab-dependency-proxy
direct_upload: true
background_upload: false
proxy_download: true
connection: <%= YAML.load_file("/etc/gitlab/objectstorage/dependencyProxy").to_json() %>
...
Source: charts/gitlab/templates/_dependencyProxy.tpl #L15
{{- include "gitlab.appConfig.objectStorage.mountSecrets" (dict "name" "dependency_proxy" "config" $.Values.global.appConfig.dependencyProxy) | nindent 10 }}
^^^^^^^^^^^^^^^^
Compiled output
...
- secret:
name: object-storage
items:
- key: connection
path: objectstorage/dependency_proxy
...
Source: charts/gitlab/charts/sidekiq/templates/deployment.yaml #L337
Solution
The solution I applied is using the snake case version in the helper template. After fixing this our deployment of GitLab went as expected.