From 02cfba3002e1a3686600e31cd38cb1637737db8c Mon Sep 17 00:00:00 2001 From: fakarakas Date: Tue, 18 Dec 2018 23:50:13 +0100 Subject: [PATCH] Allow the override of the preconfigure command (#10081) Goal When deploying gocd in a kubernetes cluster, we would like to preconfigure the server with custom settings. This can be done by a script shell or by a python script. Before we could only specify if we want the server to be preconfigured but there was no way to override the configuration script. With this change, one can write a script, put it in a configmap, mount this configmap on the pod and override the preconfigure command using 'preconfigureCommand'. For example : preconfigureCommand: - "/usr/bin/python" - "/preconfigure.py" Signed-off-by: Fatih KARAKAS --- stable/gocd/CHANGELOG.md | 4 ++++ stable/gocd/Chart.yaml | 2 +- stable/gocd/README.md | 1 + stable/gocd/templates/gocd-server-deployment.yaml | 3 ++- stable/gocd/values.yaml | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/stable/gocd/CHANGELOG.md b/stable/gocd/CHANGELOG.md index 67f4a622ea..b158a9f958 100644 --- a/stable/gocd/CHANGELOG.md +++ b/stable/gocd/CHANGELOG.md @@ -1,3 +1,7 @@ +### 1.5.10 +* [87b3a755](https://github.com/kubernetes/charts/commit/87b3a755): + - Allow the override of the preconfigure command + ### 1.5.9 * [6547ba84](https://github.com/kubernetes/charts/commit/6547ba84): - Introduces the ability to configure agent service accounts diff --git a/stable/gocd/Chart.yaml b/stable/gocd/Chart.yaml index 7d8fe1fa43..49724bb1ac 100644 --- a/stable/gocd/Chart.yaml +++ b/stable/gocd/Chart.yaml @@ -1,6 +1,6 @@ name: gocd home: https://www.gocd.org/ -version: 1.5.9 +version: 1.5.10 appVersion: 18.11.0 description: GoCD is an open-source continuous delivery server to model and visualize complex workflows with ease. icon: https://gocd.github.io/assets/images/go-icon-black-192x192.png diff --git a/stable/gocd/README.md b/stable/gocd/README.md index 377d8fb31d..df15fe8536 100644 --- a/stable/gocd/README.md +++ b/stable/gocd/README.md @@ -71,6 +71,7 @@ The following tables list the configurable parameters of the GoCD chart and thei | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------------------- | | `server.enabled` | Enable GoCD Server. Supported values are `true`, `false`. When enabled, the GoCD server deployment is done on helm install. | `true` | | `server.shouldPreconfigure` | Preconfigure GoCD Server to have a default elastic agent profile and Kubernetes elastic agent plugin settings. Supported values are `true`, `false`. | `true` | +| `server.preconfigureCommand` | Preconfigure GOCD Server with a custom command (shell,python, etc ...). Supported value is a list. | `["/bin/bash", "/preconfigure_server.sh"]`| | `server.image.repository` | GoCD server image | `gocd/gocd-server` | | `server.image.tag` | GoCD server image tag | `.Chart.appVersion` | | `server.image.pullPolicy` | Image pull policy | `IfNotPresent` | diff --git a/stable/gocd/templates/gocd-server-deployment.yaml b/stable/gocd/templates/gocd-server-deployment.yaml index ec6a49d66e..6ade390be4 100644 --- a/stable/gocd/templates/gocd-server-deployment.yaml +++ b/stable/gocd/templates/gocd-server-deployment.yaml @@ -111,7 +111,8 @@ spec: lifecycle: postStart: exec: - command: ["/bin/bash","/preconfigure_server.sh"] + command: +{{ toYaml .Values.server.preconfigureCommand | indent 18 }} {{- end }} resources: {{ toYaml .Values.server.resources | indent 12 }} diff --git a/stable/gocd/values.yaml b/stable/gocd/values.yaml index db1d430069..b1731b3afc 100644 --- a/stable/gocd/values.yaml +++ b/stable/gocd/values.yaml @@ -25,6 +25,9 @@ server: # Note: If this value is set to true, then, the serviceAccount.name is configured for the GoCD server pod. The service account token is mounted as a secret and is used in the lifecycle hook. # Note: An attempt to preconfigure the GoCD server is made. There are cases where the pre-configuration can fail and the GoCD server starts with an empty config. shouldPreconfigure: true + preconfigureCommand: + - "/bin/bash" + - "/preconfigure_server.sh" image: # server.image.repository is the GoCD Server image name repository: "gocd/gocd-server"