From b87a2a09d0749951f79fbb93cbe96855861de5ac Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 11 May 2019 16:30:26 -0500 Subject: [PATCH 01/13] Add initial Helm Chart for gitlab-monitor This depends on https://gitlab.com/gitlab-org/build/CNG/merge_requests/227. --- .../unreleased/sh-add-gitlab-monitor.yml | 5 + .../gitlab/charts/gitlab-monitor/Chart.yaml | 17 +++ .../gitlab-monitor/templates/configmap.yaml | 61 ++++++++ .../gitlab-monitor/templates/deployment.yaml | 140 ++++++++++++++++++ .../charts/gitlab-monitor/templates/hpa.yaml | 21 +++ .../charts/gitlab-monitor/templates/pdb.yaml | 15 ++ .../gitlab-monitor/templates/service.yaml | 21 +++ .../gitlab/charts/gitlab-monitor/values.yaml | 52 +++++++ charts/gitlab/values.yaml | 4 + doc/charts/gitlab/gitlab-monitor/index.md | 91 ++++++++++++ templates/_helpers.tpl | 2 +- 11 files changed, 428 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/sh-add-gitlab-monitor.yml create mode 100644 charts/gitlab/charts/gitlab-monitor/Chart.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/templates/service.yaml create mode 100644 charts/gitlab/charts/gitlab-monitor/values.yaml create mode 100644 doc/charts/gitlab/gitlab-monitor/index.md diff --git a/changelogs/unreleased/sh-add-gitlab-monitor.yml b/changelogs/unreleased/sh-add-gitlab-monitor.yml new file mode 100644 index 0000000000..e935f4a0d2 --- /dev/null +++ b/changelogs/unreleased/sh-add-gitlab-monitor.yml @@ -0,0 +1,5 @@ +--- +title: Add support for gitlab-monitor +merge_request: 787 +author: +type: added diff --git a/charts/gitlab/charts/gitlab-monitor/Chart.yaml b/charts/gitlab/charts/gitlab-monitor/Chart.yaml new file mode 100644 index 0000000000..3d56a42179 --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/Chart.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +name: gitlab-monitor +version: 1.8.4 +appVersion: master +description: Exporter for GitLab Prometheus metrics (e.g. CI, pull mirrors) +keywords: +- gitlab +- gitlab-monitor +home: https://about.gitlab.com/ +icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.svg +sources: +- https://gitlab.com/charts/gitlab/tree/master/charts/gitlab/charts/gitlab-monitor +- https://gitlab.com/gitlab-org/build/CNG/tree/master/gitlab-monitor +maintainers: +- name: GitLab Inc. + email: support@gitlab.com diff --git a/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml new file mode 100644 index 0000000000..dedad925c6 --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml @@ -0,0 +1,61 @@ +{{- if .Values.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: +{{ include "gitlab.standardLabels" . | indent 4 }} +data: + gitlab-monitor.yml.erb: | + server: + listen_address: 0.0.0.0 + listen_port: 9168 + + probes: + db_common: &db_common + methods: + - probe_db + opts: + connection_string: dbname={{ template "gitlab.psql.database" . }} user={{ template "gitlab.psql.username" . }} host={{ template "gitlab.psql.host" . }} port={{ template "gitlab.psql.port" . }} password=<%= File.read("/etc/gitlab/postgres/psql-password") %> + database: + multiple: true + ci_builds: + class_name: Database::CiBuildsProber + <<: *db_common + tuple_stats: + class_name: Database::TuplesProber + <<: *db_common + rows_count: + class_name: Database::RowCountProber + <<: *db_common + + sidekiq: &sidekiq + methods: + - probe_queues + - probe_jobs + - probe_workers + - probe_retries + - probe_dead + opts: + redis_url: {{ template "gitlab.redis.url" . }} + redis_enable_client: false + + metrics: + multiple: true + sidekiq: + <<: *sidekiq + ci_builds: + class_name: Database::CiBuildsProber + <<: *db_common + tuple_stats: + class_name: Database::TuplesProber + <<: *db_common + rows_count: + class_name: Database::RowCountProber + <<: *db_common + + configure: | + {{- include "gitlab.scripts.configure.secrets" (dict "required" "postgres" "optional" "redis") | nindent 4 }} +# Leave this here - This line denotes end of block to the parser. +{{- end }} diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml new file mode 100644 index 0000000000..d279d67fbd --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -0,0 +1,140 @@ +{{- if .Values.enabled }} +{{- $metricsEnabled := .Values.metrics.enabled -}} +{{- $metricsAnnotations := .Values.metrics.annotations -}} + +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: +{{ include "gitlab.standardLabels" . | indent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} +{{- if $metricsEnabled }} +{{ toYaml $metricsAnnotations | indent 8 }} +{{- end }} + spec: + securityContext: + runAsUser: 1000 + fsGroup: 1000 + {{- if eq (default .Values.global.antiAffinity .antiAffinity) "hard" }} + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + {{- else if eq (default .Values.global.antiAffinity .antiAffinity) "soft" }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: kubernetes.io/hostname + labelSelector: + matchLabels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + {{- end }} + initContainers: +{{ include "gitlab.extraInitContainers" . | indent 8 }} +{{ include "gitlab.certificates.initContainer" . | indent 8 }} + - name: configure + command: ['sh', '/config/configure'] + image: {{ .Values.init.image }}:{{ .Values.init.tag }} + volumeMounts: +{{ include "gitlab.extraVolumeMounts" . | indent 10 }} +{{ include "gitlab.psql.ssl.volumeMount" . | indent 10 }} + - name: gitlab-monitor-config + mountPath: /config + readOnly: true + - name: init-gitlab-monitor-secrets + mountPath: /init-config + readOnly: true + - name: gitlab-monitor-secrets + mountPath: /init-secrets + readOnly: false + resources: +{{ toYaml .Values.init.resources | indent 12 }} +{{- include "pullsecrets" .Values.image | indent 6}} + containers: +{{ include "gitlab.extraContainers" . | indent 8 }} + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + {{ template "gitlab.imagePullPolicy" . }} + env: + - name: CONFIG_TEMPLATE_DIRECTORY + value: '/var/opt/gitlab-monitor/templates' + - name: CONFIG_DIRECTORY + value: '/etc/gitlab-monitor' + volumeMounts: + - name: gitlab-monitor-config + mountPath: /var/opt/gitlab-monitor/templates/gitlab-monitor.yml.erb + subPath: gitlab-monitor.yml.erb + - name: gitlab-monitor-secrets + mountPath: '/etc/gitlab' + readOnly: true +{{ include "gitlab.extraVolumeMounts" . | indent 12 }} +{{ include "gitlab.certificates.volumeMount" . | indent 12 }} + livenessProbe: + exec: + command: + - pgrep + - -f + - gitlab-mon + readinessProbe: + exec: + command: + - pgrep + - -f + - gitlab-mon + lifecycle: + preStop: + exec: + command: ["/bin/bash", "-c", "pkill -f 'gitlab-mon'"] + resources: +{{ toYaml .Values.resources | indent 12 }} + volumes: +{{ include "gitlab.extraVolumes" . | indent 6 }} + - name: gitlab-monitor-config + configMap: + name: {{ template "fullname" . }} + - name: init-gitlab-monitor-secrets + projected: + defaultMode: 0400 + sources: + - secret: + name: {{ template "gitlab.psql.password.secret" . }} + items: + - key: {{ template "gitlab.psql.password.key" . }} + path: postgres/psql-password + {{- if .Values.global.redis.password.enabled }} + - secret: + name: {{ template "gitlab.redis.password.secret" . }} + items: + - key: {{ template "gitlab.redis.password.key" . }} + path: redis/password + {{- end }} + - name: gitlab-monitor-secrets + emptyDir: + medium: "Memory" +{{ include "gitlab.certificates.volumes" . | indent 6 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} +{{- end }} diff --git a/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml b/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml new file mode 100644 index 0000000000..e13b1f821b --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml @@ -0,0 +1,21 @@ +{{- if .Values.enabled -}} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: +{{ include "gitlab.standardLabels" . | indent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1beta2 + kind: Deployment + name: {{ template "fullname" . }} + minReplicas: {{ .Values.minReplicas }} + maxReplicas: {{ .Values.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + targetAverageValue: {{ .Values.hpa.targetAverageValue }} +{{- end -}} diff --git a/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml b/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml new file mode 100644 index 0000000000..acac844f0f --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml @@ -0,0 +1,15 @@ +{{- if .Values.enabled -}} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: +{{ include "gitlab.standardLabels" . | indent 4 }} +spec: + maxUnavailable: {{ .Values.maxUnavailable }} + selector: + matchLabels: + app: {{ template "name" . }} + release: {{ .Release.Name }} +{{- end -}} diff --git a/charts/gitlab/charts/gitlab-monitor/templates/service.yaml b/charts/gitlab/charts/gitlab-monitor/templates/service.yaml new file mode 100644 index 0000000000..41d547a322 --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/templates/service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: +{{ include "gitlab.standardLabels" . | indent 4 }} + annotations: +{{ include "gitlab.serviceAnnotations" . | indent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: gitlab-monitor + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} +{{- end }} diff --git a/charts/gitlab/charts/gitlab-monitor/values.yaml b/charts/gitlab/charts/gitlab-monitor/values.yaml new file mode 100644 index 0000000000..da6fb7e587 --- /dev/null +++ b/charts/gitlab/charts/gitlab-monitor/values.yaml @@ -0,0 +1,52 @@ +# Default values for gitlab-monitor. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor + pullSecrets: [] + pullPolicy: IfNotPresent + tag: latest + +service: + name: gitlab-monitor + type: ClusterIP + externalPort: 9168 + internalPort: 9168 + +metrics: + enabled: true + port: 9168 + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9168" + prometheus.io/path: "/metrics" + +enabled: true + +init: + image: busybox + tag: latest + resources: + requests: + cpu: 50m + +global: + # imagePullPolicy: IfNotPresent + redis: + password: {} + +redis: + password: {} + +resources: + # limits: + # cpu: 1 + # memory: 2G + requests: + cpu: 50m + memory: 150M +maxUnavailable: 1 +minReplicas: 1 +maxReplicas: 2 +hpa: + targetAverageValue: 100m diff --git a/charts/gitlab/values.yaml b/charts/gitlab/values.yaml index 72d12591f2..6c0f6a4665 100644 --- a/charts/gitlab/values.yaml +++ b/charts/gitlab/values.yaml @@ -15,6 +15,8 @@ global: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee task-runner: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-task-runner-ee + gitlab-monitor: + repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor unicorn: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-unicorn-ee workhorse: @@ -28,6 +30,8 @@ global: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ce task-runner: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-task-runner-ce + gitlab-monitor: + repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor unicorn: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-unicorn-ce workhorse: diff --git a/doc/charts/gitlab/gitlab-monitor/index.md b/doc/charts/gitlab/gitlab-monitor/index.md new file mode 100644 index 0000000000..80084a2f4a --- /dev/null +++ b/doc/charts/gitlab/gitlab-monitor/index.md @@ -0,0 +1,91 @@ +# Using the GitLab-Monitor Chart + +The `gitlab-monitor` sub-chart provides Prometheus metrics for GitLab +application-specific data. It talks to PostgreSQL directly to perform +queries to retrieve data for CI builds, pull mirrors, etc. In addition, +it uses the Sidekiq API, which talks to Redis to gather different +metrics around the state of the Sidekiq queues (e.g. number of jobs). + +## Requirements + +This chart depends on Redis and PostgreSQL services, either as part of +the complete GitLab chart or provided as external services reachable +from the Kubernetes cluster on which this chart is deployed. + +## Configuration + +The `gitlab-monitor` chart is configured as follows: [Global +Settings](#global-settings) and [Chart Settings](#chart-settings). + +## Installation command line options + +The table below contains all the possible chart configurations that can be supplied +to the `helm install` command using the `--set` flags. + +| Parameter | Default | Description | +| -------------------------------- | --------------------- | ---------------------------------------------- | +| `annotations` | | Pod annotations | +| `enabled` | `true` | gitlab-monitor enabled flag | +| `extraContainers` | | List of extra containers to include | +| `extraInitContainers` | | List of extra init containers to include | +| `extraVolumeMounts` | | List of extra volumes mountes to do | +| `extraVolumes` | | List of extra volumes to create | +| `hpa.targetAverageValue` | `100m` | Set the autoscaling target value | +| `image.pullPolicy` | `IfNotPresent` | GitLab image pull policy | +| `image.pullSecrets` | | Secrets for the image repository | +| `image.repository` | `registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor` | Unicorn image repository | +| `image.tag` | | Unicorn image tag | +| `init.image` | `busybox` | initContainer image | +| `init.tag` | `latest` | initContainer image tag | +| `metrics.enabled` | `true` | Toggle Prometheus metrics exporter | +| `resources.requests.cpu` | `50m` | gitlab-monitor minimum cpu | +| `resources.requests.memory` | `150M` | gitlab-monitor minimum memory | +| `service.externalPort` | `8080` | gitlab-monitor exposed port | +| `service.internalPort` | `8080` | gitlab-monitor internal port | +| `service.name` | `unicorn` | gitlab-monitor service name | +| `service.type` | `ClusterIP` | gitlab-monitor service type | + +## Chart configuration examples + +### image.pullSecrets + +`pullSecrets` allows you to authenticate to a private registry to pull images for a pod. + +Additional details about private registries and their authentication methods can be +found in [the Kubernetes documentation](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod). + +Below is an example use of `pullSecrets`: + +```YAML +image: + repository: my.unicorn.repository + pullPolicy: Always + pullSecrets: + - name: my-secret-name + - name: my-secondary-secret-name +``` + +### annotations + +`annotations` allows you to add annotations to the unicorn pods. For example: + +```YAML +annotations: + kubernetes.io/example-annotation: annotation-value +``` + +## Global Settings + +We share some common global settings among our charts. See the [Globals Documentation](../../globals.md) +for common configuration options, such as GitLab and Registry hostnames. + +## Chart Settings + +The following values are used to configure the gitlab-monitor Pods. + +### metrics.enabled + +By default, each pod exposes a metrics endpoint at `/metrics`. When +metrics are enabled, annotations are added to each pod allowing a +Prometheus server to discover and scrape the exposed metrics. + diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 5bb1bd6b0d..16206589df 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -144,7 +144,7 @@ Alias of gitlab.psql.host Return the db database name */}} {{- define "gitlab.psql.database" -}} -{{- coalesce .Values.global.psql.database "gitlabhq_production" | quote -}} +{{- coalesce .Values.global.psql.database "gitlabhq_production" | squote -}} {{- end -}} {{/* -- GitLab From 6afd73c0a9aeddc8558f50d3969b17420c0d336f Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 20 May 2019 16:28:51 -0700 Subject: [PATCH 02/13] Address review comments Remove HPA/PDB config --- .../unreleased/sh-add-gitlab-monitor.yml | 2 +- .../gitlab-monitor/templates/configmap.yaml | 2 +- .../gitlab-monitor/templates/deployment.yaml | 6 ++---- .../charts/gitlab-monitor/templates/hpa.yaml | 21 ------------------- .../charts/gitlab-monitor/templates/pdb.yaml | 15 ------------- .../gitlab/charts/gitlab-monitor/values.yaml | 5 ----- charts/gitlab/values.yaml | 4 ---- doc/charts/gitlab/gitlab-monitor/index.md | 8 +++---- 8 files changed, 8 insertions(+), 55 deletions(-) delete mode 100644 charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml delete mode 100644 charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml diff --git a/changelogs/unreleased/sh-add-gitlab-monitor.yml b/changelogs/unreleased/sh-add-gitlab-monitor.yml index e935f4a0d2..0ce8541601 100644 --- a/changelogs/unreleased/sh-add-gitlab-monitor.yml +++ b/changelogs/unreleased/sh-add-gitlab-monitor.yml @@ -1,5 +1,5 @@ --- -title: Add support for gitlab-monitor +title: Add gitlab-monitor to Helm Chart merge_request: 787 author: type: added diff --git a/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml index dedad925c6..0758bea8d1 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml @@ -10,7 +10,7 @@ data: gitlab-monitor.yml.erb: | server: listen_address: 0.0.0.0 - listen_port: 9168 + listen_port: {{ .Values.service.internalPort }} probes: db_common: &db_common diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml index d279d67fbd..edd7ac6818 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -1,6 +1,4 @@ {{- if .Values.enabled }} -{{- $metricsEnabled := .Values.metrics.enabled -}} -{{- $metricsAnnotations := .Values.metrics.annotations -}} apiVersion: apps/v1beta2 kind: Deployment @@ -22,8 +20,8 @@ spec: release: {{ .Release.Name }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} -{{- if $metricsEnabled }} -{{ toYaml $metricsAnnotations | indent 8 }} +{{- if .Values.metrics.enabled }} +{{ toYaml .Values.metrics.annotations | indent 8 }} {{- end }} spec: securityContext: diff --git a/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml b/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml deleted file mode 100644 index e13b1f821b..0000000000 --- a/charts/gitlab/charts/gitlab-monitor/templates/hpa.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{{- if .Values.enabled -}} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "fullname" . }} - namespace: {{ $.Release.Namespace }} - labels: -{{ include "gitlab.standardLabels" . | indent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1beta2 - kind: Deployment - name: {{ template "fullname" . }} - minReplicas: {{ .Values.minReplicas }} - maxReplicas: {{ .Values.maxReplicas }} - metrics: - - type: Resource - resource: - name: cpu - targetAverageValue: {{ .Values.hpa.targetAverageValue }} -{{- end -}} diff --git a/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml b/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml deleted file mode 100644 index acac844f0f..0000000000 --- a/charts/gitlab/charts/gitlab-monitor/templates/pdb.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- if .Values.enabled -}} -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: {{ template "fullname" . }} - namespace: {{ $.Release.Namespace }} - labels: -{{ include "gitlab.standardLabels" . | indent 4 }} -spec: - maxUnavailable: {{ .Values.maxUnavailable }} - selector: - matchLabels: - app: {{ template "name" . }} - release: {{ .Release.Name }} -{{- end -}} diff --git a/charts/gitlab/charts/gitlab-monitor/values.yaml b/charts/gitlab/charts/gitlab-monitor/values.yaml index da6fb7e587..8fff9d5cb2 100644 --- a/charts/gitlab/charts/gitlab-monitor/values.yaml +++ b/charts/gitlab/charts/gitlab-monitor/values.yaml @@ -45,8 +45,3 @@ resources: requests: cpu: 50m memory: 150M -maxUnavailable: 1 -minReplicas: 1 -maxReplicas: 2 -hpa: - targetAverageValue: 100m diff --git a/charts/gitlab/values.yaml b/charts/gitlab/values.yaml index 6c0f6a4665..72d12591f2 100644 --- a/charts/gitlab/values.yaml +++ b/charts/gitlab/values.yaml @@ -15,8 +15,6 @@ global: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee task-runner: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-task-runner-ee - gitlab-monitor: - repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor unicorn: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-unicorn-ee workhorse: @@ -30,8 +28,6 @@ global: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ce task-runner: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-task-runner-ce - gitlab-monitor: - repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor unicorn: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-unicorn-ce workhorse: diff --git a/doc/charts/gitlab/gitlab-monitor/index.md b/doc/charts/gitlab/gitlab-monitor/index.md index 80084a2f4a..c5380205ca 100644 --- a/doc/charts/gitlab/gitlab-monitor/index.md +++ b/doc/charts/gitlab/gitlab-monitor/index.md @@ -30,7 +30,6 @@ to the `helm install` command using the `--set` flags. | `extraInitContainers` | | List of extra init containers to include | | `extraVolumeMounts` | | List of extra volumes mountes to do | | `extraVolumes` | | List of extra volumes to create | -| `hpa.targetAverageValue` | `100m` | Set the autoscaling target value | | `image.pullPolicy` | `IfNotPresent` | GitLab image pull policy | | `image.pullSecrets` | | Secrets for the image repository | | `image.repository` | `registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor` | Unicorn image repository | @@ -38,11 +37,12 @@ to the `helm install` command using the `--set` flags. | `init.image` | `busybox` | initContainer image | | `init.tag` | `latest` | initContainer image tag | | `metrics.enabled` | `true` | Toggle Prometheus metrics exporter | +| `metrics.port` | `9168` | Listen port for the Prometheus metrics exporter | | `resources.requests.cpu` | `50m` | gitlab-monitor minimum cpu | | `resources.requests.memory` | `150M` | gitlab-monitor minimum memory | -| `service.externalPort` | `8080` | gitlab-monitor exposed port | -| `service.internalPort` | `8080` | gitlab-monitor internal port | -| `service.name` | `unicorn` | gitlab-monitor service name | +| `service.externalPort` | `9168` | gitlab-monitor exposed port | +| `service.internalPort` | `9168` | gitlab-monitor internal port | +| `service.name` | `gitlab-monitor` | gitlab-monitor service name | | `service.type` | `ClusterIP` | gitlab-monitor service type | ## Chart configuration examples -- GitLab From b99d9ab306cb93b0c07c4e63269a1f6168ad8df1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 24 May 2019 15:49:35 -0700 Subject: [PATCH 03/13] Fix mentions of unicorn -> gitlab-monitor --- doc/charts/gitlab/gitlab-monitor/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/charts/gitlab/gitlab-monitor/index.md b/doc/charts/gitlab/gitlab-monitor/index.md index c5380205ca..a34a6e1f65 100644 --- a/doc/charts/gitlab/gitlab-monitor/index.md +++ b/doc/charts/gitlab/gitlab-monitor/index.md @@ -32,7 +32,7 @@ to the `helm install` command using the `--set` flags. | `extraVolumes` | | List of extra volumes to create | | `image.pullPolicy` | `IfNotPresent` | GitLab image pull policy | | `image.pullSecrets` | | Secrets for the image repository | -| `image.repository` | `registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor` | Unicorn image repository | +| `image.repository` | `registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor` | gitlab-monitor image repository | | `image.tag` | | Unicorn image tag | | `init.image` | `busybox` | initContainer image | | `init.tag` | `latest` | initContainer image tag | @@ -67,7 +67,7 @@ image: ### annotations -`annotations` allows you to add annotations to the unicorn pods. For example: +`annotations` allows you to add annotations to the gitlab-monitor pods. For example: ```YAML annotations: -- GitLab From fda8d7ff220b9a4a2a4f2b87e8369e30ef201ad0 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 31 May 2019 23:15:12 -0700 Subject: [PATCH 04/13] Add quotes around password and remove not-working squote --- charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml | 2 +- templates/_helpers.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml index 0758bea8d1..5e60785823 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/configmap.yaml @@ -17,7 +17,7 @@ data: methods: - probe_db opts: - connection_string: dbname={{ template "gitlab.psql.database" . }} user={{ template "gitlab.psql.username" . }} host={{ template "gitlab.psql.host" . }} port={{ template "gitlab.psql.port" . }} password=<%= File.read("/etc/gitlab/postgres/psql-password") %> + connection_string: dbname={{ template "gitlab.psql.database" . }} user={{ template "gitlab.psql.username" . }} host={{ template "gitlab.psql.host" . }} port={{ template "gitlab.psql.port" . }} password='<%= File.read("/etc/gitlab/postgres/psql-password") %>' database: multiple: true ci_builds: diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 16206589df..c4094d7e66 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -144,7 +144,7 @@ Alias of gitlab.psql.host Return the db database name */}} {{- define "gitlab.psql.database" -}} -{{- coalesce .Values.global.psql.database "gitlabhq_production" | squote -}} +{{- coalesce .Values.global.psql.database "gitlabhq_production" -}} {{- end -}} {{/* -- GitLab From d84472443a72dfc73bc97ad0a8735623d824c2d6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 12:22:52 +0000 Subject: [PATCH 05/13] Apply suggestion to charts/gitlab/charts/gitlab-monitor/values.yaml --- charts/gitlab/charts/gitlab-monitor/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/gitlab/charts/gitlab-monitor/values.yaml b/charts/gitlab/charts/gitlab-monitor/values.yaml index 8fff9d5cb2..892e6f0b63 100644 --- a/charts/gitlab/charts/gitlab-monitor/values.yaml +++ b/charts/gitlab/charts/gitlab-monitor/values.yaml @@ -4,8 +4,8 @@ image: repository: registry.gitlab.com/gitlab-org/build/cng/gitlab-monitor pullSecrets: [] - pullPolicy: IfNotPresent - tag: latest + # pullPolicy: IfNotPresent + # tag: latest service: name: gitlab-monitor -- GitLab From bad02ab46b221c8514fac6d0f78927555b9ef719 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 12:23:11 +0000 Subject: [PATCH 06/13] Apply suggestion to charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml --- charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml index edd7ac6818..874c974522 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -1,6 +1,5 @@ {{- if .Values.enabled }} - -apiVersion: apps/v1beta2 +apiVersion: app/v1beta2 kind: Deployment metadata: name: {{ template "fullname" . }} -- GitLab From 6609410ab8b318ccea5e53e91aabb7c8182d0395 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 05:24:27 -0700 Subject: [PATCH 07/13] Tag version of gitlab-monitor to 4.0.0 --- charts/gitlab/charts/gitlab-monitor/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitlab/charts/gitlab-monitor/Chart.yaml b/charts/gitlab/charts/gitlab-monitor/Chart.yaml index 3d56a42179..e8820e7eb2 100644 --- a/charts/gitlab/charts/gitlab-monitor/Chart.yaml +++ b/charts/gitlab/charts/gitlab-monitor/Chart.yaml @@ -1,7 +1,7 @@ --- apiVersion: v1 name: gitlab-monitor -version: 1.8.4 +version: 4.0.0 appVersion: master description: Exporter for GitLab Prometheus metrics (e.g. CI, pull mirrors) keywords: -- GitLab From 7bf63732a69f2e621c9ee0db0825115f410e18a1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 05:25:12 -0700 Subject: [PATCH 08/13] Link gitlab-monitor source --- charts/gitlab/charts/gitlab-monitor/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/gitlab/charts/gitlab-monitor/Chart.yaml b/charts/gitlab/charts/gitlab-monitor/Chart.yaml index e8820e7eb2..36f51b0a94 100644 --- a/charts/gitlab/charts/gitlab-monitor/Chart.yaml +++ b/charts/gitlab/charts/gitlab-monitor/Chart.yaml @@ -12,6 +12,7 @@ icon: https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-square.s sources: - https://gitlab.com/charts/gitlab/tree/master/charts/gitlab/charts/gitlab-monitor - https://gitlab.com/gitlab-org/build/CNG/tree/master/gitlab-monitor +- https://gitlab.com/gitlab-org/gitlab-monitor maintainers: - name: GitLab Inc. email: support@gitlab.com -- GitLab From 4afd3d801202795b96cbedb5e27972253249c45b Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 05:25:35 -0700 Subject: [PATCH 09/13] Remove spurious - --- charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml index 874c974522..83f0bdcb58 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -67,7 +67,7 @@ spec: readOnly: false resources: {{ toYaml .Values.init.resources | indent 12 }} -{{- include "pullsecrets" .Values.image | indent 6}} +{{ include "pullsecrets" .Values.image | indent 6}} containers: {{ include "gitlab.extraContainers" . | indent 8 }} - name: {{ .Chart.Name }} -- GitLab From da931d7442189dff8da13a23d259c9d690684825 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 05:29:20 -0700 Subject: [PATCH 10/13] Fix typo with appVersion --- charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml index 83f0bdcb58..fc9147f3ae 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -1,5 +1,5 @@ {{- if .Values.enabled }} -apiVersion: app/v1beta2 +apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "fullname" . }} -- GitLab From 7ad79caf8aa6aea481ade568845ebca98d029b6e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 4 Jun 2019 14:56:27 -0700 Subject: [PATCH 11/13] Use singular pod and remove trailing newline --- doc/charts/gitlab/gitlab-monitor/index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/charts/gitlab/gitlab-monitor/index.md b/doc/charts/gitlab/gitlab-monitor/index.md index a34a6e1f65..3a2587d493 100644 --- a/doc/charts/gitlab/gitlab-monitor/index.md +++ b/doc/charts/gitlab/gitlab-monitor/index.md @@ -81,11 +81,10 @@ for common configuration options, such as GitLab and Registry hostnames. ## Chart Settings -The following values are used to configure the gitlab-monitor Pods. +The following values are used to configure the gitlab-monitor pod. ### metrics.enabled -By default, each pod exposes a metrics endpoint at `/metrics`. When +By default, the pod exposes a metrics endpoint at `/metrics`. When metrics are enabled, annotations are added to each pod allowing a Prometheus server to discover and scrape the exposed metrics. - -- GitLab From 24d29e997a15f8eef42b3714ab306af78a35e355 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 6 Jun 2019 06:35:37 -0700 Subject: [PATCH 12/13] Fix version and port definitions --- .../gitlab/charts/gitlab-monitor/templates/deployment.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml index fc9147f3ae..ee75548a98 100644 --- a/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml +++ b/charts/gitlab/charts/gitlab-monitor/templates/deployment.yaml @@ -71,13 +71,16 @@ spec: containers: {{ include "gitlab.extraContainers" . | indent 8 }} - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.image.repository }}:{{ coalesce .Values.image.tag (include "gitlab.versionTag" . ) }}" {{ template "gitlab.imagePullPolicy" . }} env: - name: CONFIG_TEMPLATE_DIRECTORY value: '/var/opt/gitlab-monitor/templates' - name: CONFIG_DIRECTORY value: '/etc/gitlab-monitor' + ports: + - containerPort: {{ .Values.service.internalPort }} + name: gitlab-monitor volumeMounts: - name: gitlab-monitor-config mountPath: /var/opt/gitlab-monitor/templates/gitlab-monitor.yml.erb -- GitLab From 6e00f7240496eceb8dd700ee0df8a299dd876bbd Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 6 Jun 2019 06:37:55 -0700 Subject: [PATCH 13/13] Lower memory from 150M to 100M --- charts/gitlab/charts/gitlab-monitor/values.yaml | 2 +- doc/charts/gitlab/gitlab-monitor/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/gitlab/charts/gitlab-monitor/values.yaml b/charts/gitlab/charts/gitlab-monitor/values.yaml index 892e6f0b63..2c3d4daa72 100644 --- a/charts/gitlab/charts/gitlab-monitor/values.yaml +++ b/charts/gitlab/charts/gitlab-monitor/values.yaml @@ -44,4 +44,4 @@ resources: # memory: 2G requests: cpu: 50m - memory: 150M + memory: 100M diff --git a/doc/charts/gitlab/gitlab-monitor/index.md b/doc/charts/gitlab/gitlab-monitor/index.md index 3a2587d493..8872581041 100644 --- a/doc/charts/gitlab/gitlab-monitor/index.md +++ b/doc/charts/gitlab/gitlab-monitor/index.md @@ -39,7 +39,7 @@ to the `helm install` command using the `--set` flags. | `metrics.enabled` | `true` | Toggle Prometheus metrics exporter | | `metrics.port` | `9168` | Listen port for the Prometheus metrics exporter | | `resources.requests.cpu` | `50m` | gitlab-monitor minimum cpu | -| `resources.requests.memory` | `150M` | gitlab-monitor minimum memory | +| `resources.requests.memory` | `100M` | gitlab-monitor minimum memory | | `service.externalPort` | `9168` | gitlab-monitor exposed port | | `service.internalPort` | `9168` | gitlab-monitor internal port | | `service.name` | `gitlab-monitor` | gitlab-monitor service name | -- GitLab