From 384d6f156de72d79ab97bd90d58e266660687c9c Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Tue, 27 Sep 2022 18:27:28 +0200 Subject: [PATCH 1/9] Add custom config for uploader --- diag.yaml | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 diag.yaml diff --git a/diag.yaml b/diag.yaml new file mode 100644 index 0000000000..0abf5d783d --- /dev/null +++ b/diag.yaml @@ -0,0 +1,91 @@ +global: + gitlabVersion: 372242-toolbox-script + diagnostics: + image: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-toolbox-ee + tag: 372242-toolbox-script ## If only testing this one container difference + gcloud: + secret: diagnostics-gcloud + key: gcloud.json + enterpriseImages: + # Default repositories used to pull Gitlab Enterprise Edition images. + # See the image.repository and workhorse.repository template helpers. + migrations: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-toolbox-ee + sidekiq: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-sidekiq-ee + toolbox: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-toolbox-ee + webservice: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-webservice-ee + workhorse: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-workhorse-ee + geo-logcursor: + repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-geo-logcursor + +gitlab: + webservice: + extraVolumes: |- + - name: gitlab-diagnostics + emptyDir: + sizeLimit: 1Gi + # Secret containing Google `gcloud.json` credentials file + - name: diagnostics-gcloud + secret: + secretName: {{ .Values.global.diagnostics.gcloud.secret }} + items: + - key: {{ .Values.global.diagnostics.gcloud.key }} + path: gcloud.json + extraVolumeMounts: |- + - mountPath: /var/tmp/gitlab/diagnostics + name: gitlab-diagnostics + extraContainers: |- + - name: toolbox-uploader + args: + - /bin/bash + - -c + - while sleep 5; do ls -lah; done + env: + - name: ENABLE_BOOTSNAP + value: "1" + - name: CONFIG_TEMPLATE_DIRECTORY + value: /var/opt/gitlab/templates + - name: CONFIG_DIRECTORY + value: /srv/gitlab/config + - name: UNSTRUCTURED_RAILS_LOG + value: "false" + - name: USE_GITLAB_LOGGER + value: "1" + - name: GOOGLE_APPLICATION_CREDENTIALS + value: /etc/gitlab/objectstorage/gcloud.json + - name: DIAGNOSTICS_PROJECT + value: some-project-9999 + image: "{{ coalesce .Values.global.diagnostics.image.repository (include "image.repository" .) }}:{{ coalesce .Values.global.diagnostics.image.tag (include "gitlab.versionTag" . ) }}" + imagePullPolicy: IfNotPresent + resources: + requests: + cpu: 50m + memory: 200M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + # Shared mount, via emptyDir + - mountPath: /var/tmp/gitlab/diagnostics + name: gitlab-diagnostics + # Secret with gcloud configuration + - mountPath: /etc/gitlab/objectstorage + name: diagnostics-gcloud + - mountPath: /var/opt/gitlab/templates + name: webservice-config + - mountPath: /srv/gitlab/config/initializers/smtp_settings.rb + name: webservice-config + subPath: smtp_settings.rb + - mountPath: /etc/gitlab + name: webservice-secrets + readOnly: true + - mountPath: /srv/gitlab/config/secrets.yml + name: webservice-secrets + subPath: rails-secrets/secrets.yml + - mountPath: /etc/ssl/certs/ + name: etc-ssl-certs + readOnly: true -- GitLab From cd6d76d466a45412584394475dc85475571eff06 Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Wed, 28 Sep 2022 14:21:03 +0200 Subject: [PATCH 2/9] Remove readOnly to prevent error --- diag.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/diag.yaml b/diag.yaml index 0abf5d783d..222fe161e9 100644 --- a/diag.yaml +++ b/diag.yaml @@ -82,10 +82,8 @@ gitlab: subPath: smtp_settings.rb - mountPath: /etc/gitlab name: webservice-secrets - readOnly: true - mountPath: /srv/gitlab/config/secrets.yml name: webservice-secrets subPath: rails-secrets/secrets.yml - mountPath: /etc/ssl/certs/ name: etc-ssl-certs - readOnly: true -- GitLab From 7b9a413ea75a4ecf9c7965f5c4255539ff2c782f Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Wed, 28 Sep 2022 15:14:22 +0200 Subject: [PATCH 3/9] Update the project id, the script --- diag.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diag.yaml b/diag.yaml index 222fe161e9..87d0a65f98 100644 --- a/diag.yaml +++ b/diag.yaml @@ -44,7 +44,7 @@ gitlab: args: - /bin/bash - -c - - while sleep 5; do ls -lah; done + - printf "$GOOGLE_APPLICATION_CREDENTIALS\nN\n$DIAGNOSTICS_PROJECT\nN\n" | gsutil config -e; while sleep 3; do date; ls -t /var/tmp/gitlab/diagnostics; done env: - name: ENABLE_BOOTSNAP value: "1" @@ -59,7 +59,7 @@ gitlab: - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/gitlab/objectstorage/gcloud.json - name: DIAGNOSTICS_PROJECT - value: some-project-9999 + value: alipniagov-c14e6039 image: "{{ coalesce .Values.global.diagnostics.image.repository (include "image.repository" .) }}:{{ coalesce .Values.global.diagnostics.image.tag (include "gitlab.versionTag" . ) }}" imagePullPolicy: IfNotPresent resources: -- GitLab From 2a03aa6d7e3b35d9783068a021477aa89e96d75f Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Thu, 29 Sep 2022 17:16:26 +0200 Subject: [PATCH 4/9] Latest config changes --- diag.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/diag.yaml b/diag.yaml index 87d0a65f98..dac0016f95 100644 --- a/diag.yaml +++ b/diag.yaml @@ -1,4 +1,6 @@ global: + image: + pullPolicy: Always ## For dev purposes, to use the same branch gitlabVersion: 372242-toolbox-script diagnostics: image: @@ -44,7 +46,7 @@ gitlab: args: - /bin/bash - -c - - printf "$GOOGLE_APPLICATION_CREDENTIALS\nN\n$DIAGNOSTICS_PROJECT\nN\n" | gsutil config -e; while sleep 3; do date; ls -t /var/tmp/gitlab/diagnostics; done + - gitlab-rails runner /srv/gitlab/bin/diagnostic-reports-uploader env: - name: ENABLE_BOOTSNAP value: "1" @@ -59,7 +61,11 @@ gitlab: - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/gitlab/objectstorage/gcloud.json - name: DIAGNOSTICS_PROJECT - value: alipniagov-c14e6039 + value: "alipniagov-c14e6039" + - name: GITLAB_DIAGNOSTIC_REPORTS_PATH + value: /var/tmp/gitlab/diagnostics + - name: DIAGNOSTICS_BUCKET + value: "diag_reports" image: "{{ coalesce .Values.global.diagnostics.image.repository (include "image.repository" .) }}:{{ coalesce .Values.global.diagnostics.image.tag (include "gitlab.versionTag" . ) }}" imagePullPolicy: IfNotPresent resources: -- GitLab From 737c2424d807a31897595de9bfd0c7c86fec208c Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Fri, 30 Sep 2022 12:19:11 +0000 Subject: [PATCH 5/9] Apply 2 suggestion(s) to 1 file(s) --- diag.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diag.yaml b/diag.yaml index dac0016f95..2df86832cf 100644 --- a/diag.yaml +++ b/diag.yaml @@ -60,11 +60,11 @@ gitlab: value: "1" - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/gitlab/objectstorage/gcloud.json - - name: DIAGNOSTICS_PROJECT + - name: GITLAB_DIAGNOSTIC_REPORTS_PROJECT value: "alipniagov-c14e6039" - name: GITLAB_DIAGNOSTIC_REPORTS_PATH value: /var/tmp/gitlab/diagnostics - - name: DIAGNOSTICS_BUCKET + - name: GITLAB_DIAGNOSTIC_REPORTS_BUCKET value: "diag_reports" image: "{{ coalesce .Values.global.diagnostics.image.repository (include "image.repository" .) }}:{{ coalesce .Values.global.diagnostics.image.tag (include "gitlab.versionTag" . ) }}" imagePullPolicy: IfNotPresent -- GitLab From 688c9c6b43893b6fbc8e346fb922613c63de5e06 Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Mon, 10 Oct 2022 10:55:51 +0000 Subject: [PATCH 6/9] Apply 1 suggestion(s) to 1 file(s) --- diag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diag.yaml b/diag.yaml index 2df86832cf..dde275bd19 100644 --- a/diag.yaml +++ b/diag.yaml @@ -58,7 +58,7 @@ gitlab: value: "false" - name: USE_GITLAB_LOGGER value: "1" - - name: GOOGLE_APPLICATION_CREDENTIALS + - name: GITLAB_GCP_KEY_PATH value: /etc/gitlab/objectstorage/gcloud.json - name: GITLAB_DIAGNOSTIC_REPORTS_PROJECT value: "alipniagov-c14e6039" -- GitLab From 43799665af86d863344c12e6ee7773a6c14373b3 Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Tue, 11 Oct 2022 17:35:11 +0200 Subject: [PATCH 7/9] Run without preloading whole app --- diag.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/diag.yaml b/diag.yaml index dde275bd19..1a1adb4860 100644 --- a/diag.yaml +++ b/diag.yaml @@ -1,11 +1,11 @@ global: image: pullPolicy: Always ## For dev purposes, to use the same branch - gitlabVersion: 372242-toolbox-script + gitlabVersion: 372242-toolbox-script-ruby-script diagnostics: image: repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-toolbox-ee - tag: 372242-toolbox-script ## If only testing this one container difference + tag: 372242-toolbox-script-ruby-script ## If only testing this one container difference gcloud: secret: diagnostics-gcloud key: gcloud.json @@ -46,7 +46,7 @@ gitlab: args: - /bin/bash - -c - - gitlab-rails runner /srv/gitlab/bin/diagnostic-reports-uploader + - bundle exec /srv/gitlab/bin/diagnostic-reports-uploader env: - name: ENABLE_BOOTSNAP value: "1" @@ -66,6 +66,8 @@ gitlab: value: /var/tmp/gitlab/diagnostics - name: GITLAB_DIAGNOSTIC_REPORTS_BUCKET value: "diag_reports" + - name: GITLAB_DIAGNOSTIC_REPORTS_UPLOADER_SLEEP_S + value: "5" image: "{{ coalesce .Values.global.diagnostics.image.repository (include "image.repository" .) }}:{{ coalesce .Values.global.diagnostics.image.tag (include "gitlab.versionTag" . ) }}" imagePullPolicy: IfNotPresent resources: -- GitLab From a8b006a5107af184d21088608657fbf08ebd5419 Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Wed, 12 Oct 2022 16:01:49 +0000 Subject: [PATCH 8/9] Apply 1 suggestion(s) to 1 file(s) --- diag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diag.yaml b/diag.yaml index 1a1adb4860..62a97c4872 100644 --- a/diag.yaml +++ b/diag.yaml @@ -46,7 +46,7 @@ gitlab: args: - /bin/bash - -c - - bundle exec /srv/gitlab/bin/diagnostic-reports-uploader + - ruby /srv/gitlab/bin/diagnostic-reports-uploader env: - name: ENABLE_BOOTSNAP value: "1" -- GitLab From 03646992d7b25e8ede6d977a02e1e2f5c217500d Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Thu, 13 Oct 2022 15:31:47 +0200 Subject: [PATCH 9/9] Use bundle exec to run the script --- diag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diag.yaml b/diag.yaml index 62a97c4872..c1d7381d21 100644 --- a/diag.yaml +++ b/diag.yaml @@ -46,7 +46,7 @@ gitlab: args: - /bin/bash - -c - - ruby /srv/gitlab/bin/diagnostic-reports-uploader + - bundle exec ruby /srv/gitlab/bin/diagnostic-reports-uploader env: - name: ENABLE_BOOTSNAP value: "1" -- GitLab