[stable/gocd] optional init containers (#10397)

* [stable/gocd] init containers and restart policy for server and agent

Signed-off-by: Matthias Kümmerer <matthias@matthias-k.org>

* [stable/gocd] bump version

Signed-off-by: Matthias Kümmerer <matthias@matthias-k.org>
This commit is contained in:
matthias-k
2019-01-07 14:11:36 -08:00
committed by Kubernetes Prow Robot
parent 863ead8db9
commit afa391769a
6 changed files with 84 additions and 1 deletions
+4
View File
@@ -1,3 +1,7 @@
### 1.6.0
* [7002dac](https://github.com/kubernetes/charts/commit/7002dac):
- add option to specify init containers and restart policy for server and agent
### 1.5.13
* [223b59f](https://github.com/kubernetes/charts/commit/223b59f):
- Fix typo in README.
+1 -1
View File
@@ -1,6 +1,6 @@
name: gocd
home: https://www.gocd.org/
version: 1.5.13
version: 1.6.0
appVersion: 18.12.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
+35
View File
@@ -76,6 +76,8 @@ The following tables list the configurable parameters of the GoCD chart and thei
| `server.image.tag` | GoCD server image tag | `.Chart.appVersion` |
| `server.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `server.resources` | GoCD server resource requests and limits | `{}` |
| `server.initContainers` | GoCD server init containers | `[]` |
| `server.restartPolicy` | GoCD server restart policy | `Always` |
| `server.nodeSelector` | GoCD server nodeSelector for pod labels | `{}` |
| `server.affinity` | GoCD server affinity | `{}` |
| `server.env.goServerSystemProperties` | GoCD Server system properties | `nil` |
@@ -162,6 +164,8 @@ $ kubectl create secret generic gocd-server-ssh \
| `agent.image.tag` | GoCD agent image tag | `.Chart.appVersion` |
| `agent.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `agent.resources` | GoCD agent resource requests and limits | `{}` |
| `agent.initContainers` | GoCD agent init containers | `[]` |
| `agent.restartPolicy` | GoCD agent restart policy | `Always` |
| `agent.nodeSelector` | GoCD agent nodeSelector for pod labels | `{}` |
| `agent.affinity` | GoCD agent affinity | `{}` |
| `agent.env.goServerUrl` | GoCD Server Url. If nil, discovers the GoCD server service if its available on the Kubernetes cluster | `nil` |
@@ -307,6 +311,37 @@ To mount a `ConfigMap` containing `/docker-entrypoint.d/` scripts:
1. That packages being cached here is shared between all the agents.
2. That all the agents sharing this directory are privy to all the secrets in `/home/go`
## Init containers
The GoCD helm chart supports specifying init containers for server and agents. This can for example be used to download `kubectl` or any other necessary ressources before starting GoCD:
```
agent:
persistence:
extraVolumes:
- name: kubectl
emptyDir: {}
extraVolumeMounts:
- name: kubectl
mountPath: /usr/local/bin/kubectl
subPath: kubectl
initContainers:
- name: download-kubectl
image: "ellerbrock/alpine-bash-curl-ssl:latest"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: kubectl
mountPath: /download
workingDir: /download
command: ["/bin/bash"]
args:
- "-c"
- 'curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl'
u
```
Depending on how long the init containers take to complete, it might be necessary to tweak the values of `server.healthCheck.initialDelaySeconds` or `agent.healthCheck.initialDelaySeconds`.
## RBAC and Service Accounts
The RBAC section is for users who want to use the Kubernetes Elastic Agent Plugin with GoCD. The Kubernetes elastic agent plugin for GoCD brings up pods on demand while running a job.
@@ -43,6 +43,10 @@ spec:
secret:
secretName: {{ .Values.agent.security.ssh.secretName }}
{{- end }}
{{- if .Values.agent.initContainers }}
initContainers:
{{ toYaml .Values.agent.initContainers | indent 8 }}
{{- end }}
containers:
- name: {{ template "gocd.name" . }}-agent
{{- if .Values.agent.image.tag }}
@@ -127,6 +131,7 @@ spec:
{{- end }}
securityContext:
privileged: {{ .Values.agent.privileged }}
restartPolicy: {{ .Values.agent.restartPolicy }}
{{- if .Values.agent.nodeSelector }}
nodeSelector:
{{ toYaml .Values.agent.nodeSelector | indent 8 }}
@@ -47,6 +47,10 @@ spec:
secret:
secretName: {{ .Values.server.security.ssh.secretName }}
{{- end }}
{{- if .Values.server.initContainers }}
initContainers:
{{ toYaml .Values.server.initContainers | indent 8 }}
{{- end }}
containers:
- name: {{ template "gocd.name" . }}-server
{{- if .Values.server.image.tag }}
@@ -116,6 +120,7 @@ spec:
{{- end }}
resources:
{{ toYaml .Values.server.resources | indent 12 }}
restartPolicy: {{ .Values.server.restartPolicy }}
{{- if .Values.server.nodeSelector }}
nodeSelector:
{{ toYaml .Values.server.nodeSelector | indent 8 }}
+34
View File
@@ -47,6 +47,23 @@ server:
# cpu: 100m
# memory: 1024Mi
# specify init containers, e.g. to prepopulate home directories etc
initContainers: []
# - name: download-kubectl
# image: "ellerbrock/alpine-bash-curl-ssl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: kubectl
# mountPath: /download
# workingDir: /download
# command: ["/bin/bash"]
# args:
# - "-c"
# - 'curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl'
# specify restart policy for server
restartPolicy: Always
## Additional GoCD server pod labels
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
nodeSelector: {}
@@ -255,6 +272,23 @@ agent:
# - name: gocd-agent-init-scripts
# mountPath: /docker-entrypoint.d/
# specify init containers, e.g. to prepopulate home directories etc
initContainers: []
# - name: download-kubectl
# image: "ellerbrock/alpine-bash-curl-ssl:latest"
# imagePullPolicy: "IfNotPresent"
# volumeMounts:
# - name: kubectl
# mountPath: /download
# workingDir: /download
# command: ["/bin/bash"]
# args:
# - "-c"
# - 'curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl'
# specify restart policy for agents
restartPolicy: Always
# agent.privileged is needed for running Docker-in-Docker (DinD) agents
privileged: false