Allow replacement of Jenkins config with configMap. (#7450)

Currently, the configMap is only used to write the initial
config.xml, etc to /var/jenkins_home.  Any changes to the
config are not used by Jenkins, because the `cp` operation
uses `--no-clobber`.

This adds a new `.Values.Master.OverwriteConfig` option to
allow a user to specify that the configMap should always
overwrite the config.xml, jenkins.CLI.xml, and
jenkins.model.JenkinsLocationConfiguration.xml
files.

By default, the `.Values.Master.OverwriteConfig` option is `false`
to preserve the current behavior.

Fixes #3133.

Signed-off-by: Logan Owen <logan@s1network.com>
This commit is contained in:
lsowen
2018-09-05 10:04:04 -07:00
committed by k8s-ci-robot
parent e10f060a11
commit c766da3ded
4 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: jenkins
home: https://jenkins.io/
version: 0.17.0
version: 0.18.0
appVersion: 2.121.3
description: Open source continuous integration server. It supports multiple SCM tools
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
+1
View File
@@ -63,6 +63,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
| `Master.LoadBalancerIP` | Optional fixed external IP | Not set |
| `Master.JMXPort` | Open a port, for JMX stats | Not set |
| `Master.CustomConfigMap` | Use a custom ConfigMap | `false` |
| `Master.OverwriteConfig` | Replace config w/ ConfigMap on boot | `false` |
| `Master.Ingress.Annotations` | Ingress annotations | `{}` |
| `Master.Ingress.TLS` | Ingress TLS configuration | `[]` |
| `Master.InitScripts` | List of Jenkins init scripts | Not set |
+9 -3
View File
@@ -192,9 +192,15 @@ data:
apply_config.sh: |-
mkdir -p /usr/share/jenkins/ref/secrets/;
echo "false" > /usr/share/jenkins/ref/secrets/slave-to-master-security-kill-switch;
cp -n /var/jenkins_config/config.xml /var/jenkins_home;
cp -n /var/jenkins_config/jenkins.CLI.xml /var/jenkins_home;
cp -n /var/jenkins_config/jenkins.model.JenkinsLocationConfiguration.xml /var/jenkins_home;
{{- if .Values.Master.OverwriteConfig }}
cp /var/jenkins_config/config.xml /var/jenkins_home;
cp /var/jenkins_config/jenkins.CLI.xml /var/jenkins_home;
cp /var/jenkins_config/jenkins.model.JenkinsLocationConfiguration.xml /var/jenkins_home;
{{- else }}
cp --no-clobber /var/jenkins_config/config.xml /var/jenkins_home;
cp --no-clobber /var/jenkins_config/jenkins.CLI.xml /var/jenkins_home;
cp --no-clobber /var/jenkins_config/jenkins.model.JenkinsLocationConfiguration.xml /var/jenkins_home;
{{- end }}
{{- if .Values.Master.InstallPlugins }}
# Install missing plugins
cp /var/jenkins_config/plugins.txt /var/jenkins_home;
+4
View File
@@ -109,6 +109,10 @@ Master:
# test: |-
# <<xml here>>
CustomConfigMap: false
# By default, the configMap is only used to set the initial config the first time
# that the chart is installed. Setting `OverwriteConfig` to `true` will overwrite
# the jenkins config with the contents of the configMap every time the pod starts.
OverwriteConfig: false
# Node labels and tolerations for pod assignment
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature