From ff8d98aaa3fa88353b5544d8747c572cd93cc35a Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Thu, 28 May 2020 09:44:48 +0200 Subject: [PATCH 1/6] Adds extraVolumeMounts for pods --- changelogs/unreleased/jarv-extra-volume-pods.yml | 5 +++++ charts/gitlab/charts/sidekiq/templates/deployment.yaml | 6 ++++++ charts/gitlab/charts/sidekiq/values.yaml | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 changelogs/unreleased/jarv-extra-volume-pods.yml diff --git a/changelogs/unreleased/jarv-extra-volume-pods.yml b/changelogs/unreleased/jarv-extra-volume-pods.yml new file mode 100644 index 0000000000..26b64b65d9 --- /dev/null +++ b/changelogs/unreleased/jarv-extra-volume-pods.yml @@ -0,0 +1,5 @@ +--- +title: Adds extraVolumeMounts for pods +merge_request: +author: +type: added diff --git a/charts/gitlab/charts/sidekiq/templates/deployment.yaml b/charts/gitlab/charts/sidekiq/templates/deployment.yaml index debf2a8bf1..ade5ad5d6d 100644 --- a/charts/gitlab/charts/sidekiq/templates/deployment.yaml +++ b/charts/gitlab/charts/sidekiq/templates/deployment.yaml @@ -30,6 +30,8 @@ {{- range .Values.pods -}} {{- $queueName := printf "%s-%s" $fullname .name | trunc 63}} {{- $podNodeSelector := default $nodeSelector .nodeSelector -}} +{{- $extraVolumes := default "" .extraVolumes -}} +{{- $extraVolumeMounts := default "" .extraVolumeMounts -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -109,6 +111,7 @@ spec: {{- end }} {{- end }} volumeMounts: + {{- toYaml $extraVolumeMounts | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- include "gitlab.psql.ssl.volumeMount" $ | nindent 10 }} {{- include "gitlab.geo.psql.ssl.volumeMount" $ | nindent 10 }} @@ -154,6 +157,7 @@ spec: {{- end }} {{- end }} volumeMounts: + {{- toYaml $extraVolumeMounts | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} - name: sidekiq-config mountPath: '/var/opt/gitlab/templates' @@ -226,6 +230,7 @@ spec: name: metrics {{- end }} volumeMounts: + {{- toYaml $extraVolumeMounts | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- if $metricsEnabled }} - name: sidekiq-metrics @@ -277,6 +282,7 @@ spec: resources: {{- toYaml ( default $resources .resources ) | nindent 12 }} volumes: + {{- toYaml $extraVolumes | nindent 6 }} {{- include "gitlab.extraVolumes" $ | nindent 6 }} {{- include "gitlab.psql.ssl.volume" $ | nindent 6 }} {{- include "gitlab.geo.psql.ssl.volume" $ | nindent 6 }} diff --git a/charts/gitlab/charts/sidekiq/values.yaml b/charts/gitlab/charts/sidekiq/values.yaml index 9453b01958..a7e02e1eb4 100644 --- a/charts/gitlab/charts/sidekiq/values.yaml +++ b/charts/gitlab/charts/sidekiq/values.yaml @@ -248,6 +248,8 @@ pods: # maxReplicas: 10 # updateStrategy: {} # queues: '' + # extraVolumes + # extraVolumeMounts ## Allow to overwrite under which User and Group we're running. securityContext: -- GitLab From 07d1e80fd3880ef473972b36a4623c7286ccbff3 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Thu, 28 May 2020 15:26:17 +0200 Subject: [PATCH 2/6] Wrap extravolumes for when not set --- .../charts/sidekiq/templates/deployment.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/charts/gitlab/charts/sidekiq/templates/deployment.yaml b/charts/gitlab/charts/sidekiq/templates/deployment.yaml index ade5ad5d6d..c6e76b33ad 100644 --- a/charts/gitlab/charts/sidekiq/templates/deployment.yaml +++ b/charts/gitlab/charts/sidekiq/templates/deployment.yaml @@ -30,8 +30,6 @@ {{- range .Values.pods -}} {{- $queueName := printf "%s-%s" $fullname .name | trunc 63}} {{- $podNodeSelector := default $nodeSelector .nodeSelector -}} -{{- $extraVolumes := default "" .extraVolumes -}} -{{- $extraVolumeMounts := default "" .extraVolumeMounts -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -111,7 +109,9 @@ spec: {{- end }} {{- end }} volumeMounts: - {{- toYaml $extraVolumeMounts | nindent 10 }} + {{- if .extraVolumeMounts }} + {{- toYaml .extraVolumeMounts | nindent 10 }} + {{- end }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- include "gitlab.psql.ssl.volumeMount" $ | nindent 10 }} {{- include "gitlab.geo.psql.ssl.volumeMount" $ | nindent 10 }} @@ -157,7 +157,9 @@ spec: {{- end }} {{- end }} volumeMounts: - {{- toYaml $extraVolumeMounts | nindent 10 }} + {{- if .extraVolumeMounts }} + {{- toYaml .extraVolumeMounts | nindent 10 }} + {{- end }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} - name: sidekiq-config mountPath: '/var/opt/gitlab/templates' @@ -230,7 +232,9 @@ spec: name: metrics {{- end }} volumeMounts: - {{- toYaml $extraVolumeMounts | nindent 10 }} + {{- if .extraVolumeMounts }} + {{- toYaml .extraVolumeMounts | nindent 10 }} + {{- end }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- if $metricsEnabled }} - name: sidekiq-metrics @@ -282,7 +286,9 @@ spec: resources: {{- toYaml ( default $resources .resources ) | nindent 12 }} volumes: - {{- toYaml $extraVolumes | nindent 6 }} + {{- if .extraVolumes }} + {{- toYaml .extraVolumes | nindent 6 }} + {{- end -}} {{- include "gitlab.extraVolumes" $ | nindent 6 }} {{- include "gitlab.psql.ssl.volume" $ | nindent 6 }} {{- include "gitlab.geo.psql.ssl.volume" $ | nindent 6 }} -- GitLab From 2759312a3a0e4a4d6a115d592c567bcbfc0eac10 Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Thu, 28 May 2020 12:19:31 -0400 Subject: [PATCH 3/6] Replace toYaml with tpl for consistency --- .../charts/sidekiq/templates/deployment.yaml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/charts/gitlab/charts/sidekiq/templates/deployment.yaml b/charts/gitlab/charts/sidekiq/templates/deployment.yaml index c6e76b33ad..abc97f3492 100644 --- a/charts/gitlab/charts/sidekiq/templates/deployment.yaml +++ b/charts/gitlab/charts/sidekiq/templates/deployment.yaml @@ -109,9 +109,7 @@ spec: {{- end }} {{- end }} volumeMounts: - {{- if .extraVolumeMounts }} - {{- toYaml .extraVolumeMounts | nindent 10 }} - {{- end }} + {{- tpl (default "" .extraVolumeMounts) $ | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- include "gitlab.psql.ssl.volumeMount" $ | nindent 10 }} {{- include "gitlab.geo.psql.ssl.volumeMount" $ | nindent 10 }} @@ -157,9 +155,7 @@ spec: {{- end }} {{- end }} volumeMounts: - {{- if .extraVolumeMounts }} - {{- toYaml .extraVolumeMounts | nindent 10 }} - {{- end }} + {{- tpl (default "" .extraVolumeMounts) $ | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} - name: sidekiq-config mountPath: '/var/opt/gitlab/templates' @@ -232,9 +228,7 @@ spec: name: metrics {{- end }} volumeMounts: - {{- if .extraVolumeMounts }} - {{- toYaml .extraVolumeMounts | nindent 10 }} - {{- end }} + {{- tpl (default "" .extraVolumeMounts) $ | nindent 10 }} {{- include "gitlab.extraVolumeMounts" $ | nindent 10 }} {{- if $metricsEnabled }} - name: sidekiq-metrics @@ -286,9 +280,7 @@ spec: resources: {{- toYaml ( default $resources .resources ) | nindent 12 }} volumes: - {{- if .extraVolumes }} - {{- toYaml .extraVolumes | nindent 6 }} - {{- end -}} + {{- tpl (default "" .extraVolumeMounts) $ | nindent 6 }} {{- include "gitlab.extraVolumes" $ | nindent 6 }} {{- include "gitlab.psql.ssl.volume" $ | nindent 6 }} {{- include "gitlab.geo.psql.ssl.volume" $ | nindent 6 }} -- GitLab From 4db8568b3d14bc0fd23cff848b33fc4d3376721f Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Thu, 28 May 2020 12:57:41 -0400 Subject: [PATCH 4/6] Document extraVolume and extraVolumes (per-chart and per-cluster) --- doc/charts/gitlab/sidekiq/index.md | 38 ++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/doc/charts/gitlab/sidekiq/index.md b/doc/charts/gitlab/sidekiq/index.md index 5b7f2350ab..a39dd354a5 100644 --- a/doc/charts/gitlab/sidekiq/index.md +++ b/doc/charts/gitlab/sidekiq/index.md @@ -39,8 +39,8 @@ to the `helm install` command using the `--set` flags: | `enabled` | `true` | Sidekiq 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 | +| `extraVolumeMounts` | | String template of extra volume mounts to configure | +| `extraVolumes` | | String template of extra volumes to configure | | `extraEnv` | | List of extra environment variables to expose | | `gitaly.serviceName` | `gitaly` | Gitaly service name | | `hpa.targetAverageValue` | `350m` | Set the autoscaling target value | @@ -105,6 +105,31 @@ SOME_KEY=some_value SOME_OTHER_KEY=some_other_value ``` +### extraVolumes + +`extraVolumes` allows you to configure extra volumes chart-wide. + +Below is an example use of `extraVolumes`: + +```yaml +extraVolumes: | + - name: example-volume + persistentVolumeClaim: + claimName: example-pvc +``` + +### extraVolumeMounts + +`extraVolumeMounts` allows you to configure extra volumeMounts on all containers chart-wide. + +Below is an example use of `extraVolumeMounts`: + +```yaml +extraVolumeMounts: | + - name: example-volume-mount + mountPath: /etc/example +``` + ### image.pullSecrets `pullSecrets` allows you to authenticate to a private registry to pull images for a pod. @@ -302,6 +327,8 @@ a different pod configuration. It will not add a new pod in addition to the defa | `maxReplicas` | Integer | `10` | Maximum number of replicas | | `maxUnavailable` | Integer | `1` | Limit of maximum number of Pods to be unavailable | | `updateStrategy` | | `{}` | Allows one to configure the update strategy utilized by the deployment | +| `extraVolumes` | String | | Configures extra volumes for the given pod. | +| `extraVolumeMounts` | String | | Configures extra volume mounts for the given pod. | ### queues @@ -364,6 +391,13 @@ pods: - [process_commit, 3] - [new_note, 2] - [new_issue, 2] + extraVolumeMounts: | + - name: example-volume-mount + mountPath: /etc/example + extraVolumes: | + - name: example-volume + persistentVolumeClaim: + claimName: example-pvc resources: limits: cpu: 800m -- GitLab From 8d535759bb9b20dd756899a9e3d14c537ac3d655 Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Tue, 2 Jun 2020 11:58:19 -0400 Subject: [PATCH 5/6] Bump kubectl minimum version to 1.13 --- doc/installation/index.md | 6 +++--- doc/installation/tools.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/installation/index.md b/doc/installation/index.md index f1a34b232a..f72c29846a 100644 --- a/doc/installation/index.md +++ b/doc/installation/index.md @@ -10,10 +10,10 @@ Install GitLab on Kubernetes with the cloud native GitLab Helm chart. In order to deploy GitLab on Kubernetes, the following are required: -1. kubectl 1.12 or higher, compatible with your cluster +1. kubectl 1.13 or higher, compatible with your cluster ([+/- 1 minor release from your cluster](https://kubernetes.io/docs/tasks/tools/install-kubectl/#before-you-begin)). 1. Helm v2 (2.12 or higher, excluding 2.15) or v3 (3.0.2 or higher). -1. A Kubernetes cluster, version 1.12 or higher. 8vCPU and 30GB of RAM is recommended. +1. A Kubernetes cluster, version 1.13 or higher. 8vCPU and 30GB of RAM is recommended. NOTE: **Note**: Helm is released as v2 and v3 versions. While Helm v2 is still in @@ -33,7 +33,7 @@ Before proceeding to deploying GitLab, you need to prepare your environment. ### Cloud cluster preparation NOTE: **Note**: -[Kubernetes 1.12 or higher is required](#requirements), due to the usage of certain +[Kubernetes 1.13 or higher is required](#requirements), due to the usage of certain Kubernetes features. Follow the instructions to create and connect to the Kubernetes cluster of your diff --git a/doc/installation/tools.md b/doc/installation/tools.md index d1ece95dd3..0c833cd3a2 100644 --- a/doc/installation/tools.md +++ b/doc/installation/tools.md @@ -5,7 +5,7 @@ must have installed locally. ## kubectl -kubectl is the tool that talks to the Kubernetes API. kubectl 1.12 or higher is +kubectl is the tool that talks to the Kubernetes API. kubectl 1.13 or higher is required and it needs to be compatible with your cluster ([+/- 1 minor release from your cluster](https://kubernetes.io/docs/tasks/tools/install-kubectl/#before-you-begin)). -- GitLab From 97cc6fdf4f6612b0620e337cb6b64b6d7776f5d2 Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Tue, 2 Jun 2020 12:00:20 -0400 Subject: [PATCH 6/6] Add changelog entry --- changelogs/unreleased/kubernetes-v1-13 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/kubernetes-v1-13 diff --git a/changelogs/unreleased/kubernetes-v1-13 b/changelogs/unreleased/kubernetes-v1-13 new file mode 100644 index 0000000000..65a02cdcfa --- /dev/null +++ b/changelogs/unreleased/kubernetes-v1-13 @@ -0,0 +1,5 @@ +--- +title: Specify Kubernetes 1.13 as minimum required version and use v1.13 tools and libraries +merge_request: 1388 +author: +type: changed -- GitLab