question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helm setup refuses to load YAML file from ConfigMap mount

See original GitHub issue

B"H

Hi,

I’m trying to run a helm setup based on the example, except I’m using an external ConfigMap outside the helm chart to store CASC configs and mounting them into the Jenkins container.

(The docs in your example suggest making a custom configmap, but the implementation of that isn’t so clean in the stable/jenkins chart, and during upgrades it’ll require me to monkeypatch any future changes they make to their reference configmap content.)

I’m seeing very strange behaviour: the CASC plugin recognizes the config file on the disk, but doesn’t seem to load it. Here’s what my http://jenkins/configuration-as-code/ screen shows:

Configuration as Code

Configuration loaded from :

/var/jenkins_home/casc_configs/jenkins.yaml

Last time applied : 1-Jan-1970 12:00:00 UTC AM

Even clicking Reload doesn’t work. I entered the container and verified that that file is readable to the Jenkins user:

$ kubectl exec -it jenkins-5b644b574f-vkcsf -- bash
root@jenkins-5b644b574f-vkcsf:/# su - jenkins
jenkins@jenkins-5b644b574f-vkcsf:~$ cd /var/jenkins_home/casc_configs
jenkins@jenkins-5b644b574f-vkcsf:~/casc_configs$ ls -lah
total 32K
drwxrwxrwx.  3 root root 4.0K Aug  6 16:35 .
drwxrwxrwx. 15 root root 4.0K Aug  6 16:38 ..
drwxr-xr-x.  2 root root 4.0K Aug  6 16:35 ..2018_08_06_16_35_45.759292262
lrwxrwxrwx.  1 root root   31 Aug  6 16:35 ..data -> ..2018_08_06_16_35_45.759292262
lrwxrwxrwx.  1 root root   19 Aug  6 16:35 jenkins.yaml -> ..data/jenkins.yaml
jenkins@jenkins-5b644b574f-vkcsf:~/casc_configs$ cat jenkins.yaml 
jenkins:
  systemMessage: "CASC Jenkins is cool"
  numExecutors: 1
jenkins@jenkins-5b644b574f-vkcsf:~/casc_configs$

Any help would be appreciated. Here’s my full helm config and jenkins log:

jenkins-casc-config.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: jenkins-casc-config
data:
  jenkins.yaml: |
    jenkins:
      systemMessage: "CASC Jenkins is cool"
      numExecutors: 1

jenkins-helm-chart-values.yaml

Master:
  ImageTag: 2.121.2
  UseSecurity: false
  ServiceType: ClusterIP
  ServicePort: 80

  # Enable the experimental update center (needed for the configuration-as-code
  # plugin):
  ContainerEnv:
  - name: JENKINS_UC
    value: https://updates.jenkins.io
  - name: JENKINS_UC_EXPERIMENTAL
    value: https://updates.jenkins.io/experimental
  - name: JENKINS_INCREMENTALS_REPO_MIRROR
    value: https://repo.jenkins-ci.org/incrementals
  - name: CASC_JENKINS_CONFIG
    value: /var/jenkins_home/casc_configs/jenkins.yaml
  InitContainerEnv:
  - name: JENKINS_UC
    value: https://updates.jenkins.io
  - name: JENKINS_UC_EXPERIMENTAL
    value: https://updates.jenkins.io/experimental
  - name: JENKINS_INCREMENTALS_REPO_MIRROR
    value: https://repo.jenkins-ci.org/incrementals

  InstallPlugins:
  - kubernetes:1.12.0
  - workflow-aggregator:2.5
  - workflow-job:2.23
  - credentials-binding:1.16
  - git:3.9.1
  - configuration-as-code:0.11-alpha

Persistence:
  Enabled: false

  volumes:
  - name: casc-config
    configMap:
      name: jenkins-casc-config
  mounts:
  - mountPath: /var/jenkins_home/casc_configs
    name: casc-config
    readOnly: true

rbac:
  install: true

jenkins-container.log

Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Aug 06, 2018 4:36:22 PM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @1601ms to org.eclipse.jetty.util.log.JavaUtilLog
Aug 06, 2018 4:36:23 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Aug 06, 2018 4:36:28 PM org.eclipse.jetty.server.handler.ContextHandler setContextPath
WARNING: Empty contextPath
Aug 06, 2018 4:36:28 PM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.4.z-SNAPSHOT, build timestamp: 2017-11-21T21:27:37Z, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
Aug 06, 2018 4:36:29 PM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Aug 06, 2018 4:36:29 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
INFO: DefaultSessionIdManager workerName=node0
Aug 06, 2018 4:36:29 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
INFO: No SessionScavenger set, using defaults
Aug 06, 2018 4:36:29 PM org.eclipse.jetty.server.session.HouseKeeper startScavenging
INFO: Scavenging every 600000ms
Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Aug 06, 2018 4:36:31 PM org.eclipse.jetty.server.handler.ContextHandler doStart
INFO: Started w.@66971f6b{/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
Aug 06, 2018 4:36:31 PM org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started ServerConnector@770d0ea6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
Aug 06, 2018 4:36:31 PM org.eclipse.jetty.server.Server doStart
INFO: Started @10329ms
Aug 06, 2018 4:36:31 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v4.0 running: controlPort=disabled
Aug 06, 2018 4:36:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Aug 06, 2018 4:36:44 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Aug 06, 2018 4:37:22 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Aug 06, 2018 4:37:22 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Aug 06, 2018 4:37:33 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Aug 06, 2018 4:37:34 PM jenkins.model.Jenkins setBuildsAndWorkspacesDir
INFO: Using non default workspaces directories: ${JENKINS_HOME}/workspace/${ITEM_FULLNAME}.
Aug 06, 2018 4:37:34 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Aug 06, 2018 4:37:34 PM jenkins.util.groovy.GroovyHookScript execute
INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy
Aug 06, 2018 4:37:34 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Started Download metadata
Aug 06, 2018 4:37:34 PM hudson.model.AllView migrateLegacyPrimaryAllViewLocalizedName
INFO: JENKINS-38606 detected for AllView in hudson.model.Hudson@122c90e8; renaming view from All to all
Aug 06, 2018 4:37:38 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Aug 06, 2018 4:37:38 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running
--> setting agent port for jnlp
--> setting agent port for jnlp... done
Aug 06, 2018 4:38:12 PM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Aug 06, 2018 4:38:17 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
Aug 06, 2018 4:38:17 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 43,171 ms

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
dbendelmancommented, Aug 14, 2018

@HerrmannHinz done 😃

1reaction
HerrmannHinzcommented, Aug 8, 2018

@dbendelman mind adding your approach (which is totally valid and which i will follow as well in the future) as PR to the documentation?

Read more comments on GitHub >

github_iconTop Results From Across the Web

helm: how to mount configMap if not supported by values.yaml?
So create a .yml file with Deployment, Replicaset or Statefulset and add the ConfigMap configuration (just check which Kubernetes object ...
Read more >
Mounting a file with Helm into a Kubernetes pod using a ...
The ConfigMap is still necessary, as we need to mount the config file into the docker container. The only difference is that we...
Read more >
Mount files into Kubernetes Deployment via ConfigMaps
General Setup. / |- deployment.yaml |- configmap.yaml. At the end of this example, there will be two YAML files. The deployment.yaml defining the...
Read more >
Why can't k8s find my configmap to mount it as a file?
Your configmap volume is named config , not the-thing . Separately, it seems highly unlikely you want to mount it on / ;...
Read more >
Configure a Pod to Use a ConfigMap - Kubernetes
Create ConfigMaps from directories. You can use kubectl create configmap to create a ConfigMap from multiple files in the same directory. When ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found