From 8f4cb428f4612042b9e467104d023898ec0055eb Mon Sep 17 00:00:00 2001 From: Erik Jutemar Date: Tue, 12 Nov 2019 11:28:06 +0100 Subject: [PATCH] [stable/gocd] - GoCD agents should run postStart lifecycle hooks (#18768) * [stable/gocd] - GoCD agents should run postStart lifecycle hooks Signed-off-by: Erik Jutemar * [stable/gocd] - Update changelog with 1.19.2 GoCD agents postStart Signed-off-by: Erik Jutemar * [stable/gocd] - Updated documentation for agent.postStart and agent.preStop Signed-off-by: Erik Jutemar --- stable/gocd/CHANGELOG.md | 3 +++ stable/gocd/Chart.yaml | 2 +- stable/gocd/README.md | 1 + stable/gocd/templates/gocd-agent-deployment.yaml | 10 +++++++++- stable/gocd/values.yaml | 6 +++++- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/stable/gocd/CHANGELOG.md b/stable/gocd/CHANGELOG.md index 76a9b12ec6..2251a5f79c 100644 --- a/stable/gocd/CHANGELOG.md +++ b/stable/gocd/CHANGELOG.md @@ -1,3 +1,6 @@ +### 1.19.2 +* [cacab5e62](https://github.com/kubernetes/charts/commit/cacab5e62): GoCD agents postStart lifecycle hooks + ### 1.19.1 * [00e10170c](https://github.com/kubernetes/charts/commit/00e10170c): Add support for specifying tolerations on both the GoCD server and agent pods diff --git a/stable/gocd/Chart.yaml b/stable/gocd/Chart.yaml index eb1ce78493..ac0c4fa387 100644 --- a/stable/gocd/Chart.yaml +++ b/stable/gocd/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: gocd home: https://www.gocd.org/ -version: 1.19.1 +version: 1.19.2 appVersion: 19.10.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 1c6e46b3fc..70c6c306b2 100644 --- a/stable/gocd/README.md +++ b/stable/gocd/README.md @@ -172,6 +172,7 @@ $ kubectl create secret generic gocd-server-ssh \ | `agent.annotations.pod ` | GoCD Agent Pod annotations. | `{}` | | `agent.replicaCount` | GoCD Agent replicas Count. By default, no agents are provided. | `0` | | `agent.preStop ` | Perform cleanup and backup before stopping the gocd server. Supported value is a list. | `nil` | +| `agent.postStart` | Commands to run after agent startup. | `nil` | | `agent.terminationGracePeriodSeconds` | Optional duration in seconds the gocd agent pods need to terminate gracefully. | `nil` | | `agent.deployStrategy` | GoCD Agent [deployment strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy). | `{}` | | `agent.image.repository` | GoCD agent image | `gocd/gocd-agent-alpine-3.6` | diff --git a/stable/gocd/templates/gocd-agent-deployment.yaml b/stable/gocd/templates/gocd-agent-deployment.yaml index bc3a4f2ecf..8e97a58eee 100644 --- a/stable/gocd/templates/gocd-agent-deployment.yaml +++ b/stable/gocd/templates/gocd-agent-deployment.yaml @@ -144,12 +144,20 @@ spec: readOnly: true mountPath: /home/go/.ssh {{- end }} - {{- if .Values.agent.preStop }} + {{- if or .Values.agent.preStop .Values.agent.postStart }} lifecycle: + {{- if .Values.agent.preStop }} preStop: exec: command: {{ toYaml .Values.agent.preStop | indent 18 }} + {{- end }} + {{- if .Values.agent.postStart }} + postStart: + exec: + command: +{{ toYaml .Values.agent.postStart | indent 18 }} + {{- end }} {{- end }} securityContext: privileged: {{ .Values.agent.privileged }} diff --git a/stable/gocd/values.yaml b/stable/gocd/values.yaml index 77006c8a72..d825f107ed 100644 --- a/stable/gocd/values.yaml +++ b/stable/gocd/values.yaml @@ -242,10 +242,14 @@ agent: fsGroup: 0 # agent.replicaCount is the GoCD Agent replicas Count. Specify the number of GoCD agents to run replicaCount: 0 - # agent.preStop - array of commands to use in the agent pre-stop lifecycle hook + # agent.preStop - array of command and arguments to run in the agent pre-stop lifecycle hook # preStop: # - "/bin/bash" # - "/disable_and_stop.sh" + # agent.postStart - array of command and arguments to run in agent post-start lifecycle hook + # postStart: + # - "/bin/bash" + # - "/agent_startup.sh" # agent.deployStrategy is the strategy explained in detail at https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy # agent.terminationGracePeriodSeconds is the optional duration in seconds the gocd agent pods need to terminate gracefully. # Note: SIGTERM is issued immediately after the pod deletion request is sent. If the pod doesn't terminate, k8s waits for terminationGracePeriodSeconds before issuing SIGKILL.