2

I want to pass some JAVA_ARGS in a jenkins kubernetes instance created using the official helm chart.

Example of such values are:

JAVA_ARGS="-Djava.awt.headless=true -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400

etc...

Where in values.yaml is the place to do so?

Is this javaOpts or this javaOpts the place to do so?

pkaramol
  • 16,451
  • 43
  • 149
  • 324

3 Answers3

2

The Chart uses Jenkins docker image , which says:

You might need to customize the JVM running Jenkins, typically to pass system properties (list of props) or tweak heap memory settings. Use JAVA_OPTS environment variable for this purpose.

In the chart this is set with Values.master.javaOpts from vaues.yaml

Filip Nikolov
  • 1,687
  • 15
  • 22
0

I spent a good amount of time searching for an answer and managed to logic through to a solution that satisfied me. I know this is already answered, but perhaps it will help someone who is looking for this.

The below is an excerpt from my job.yaml:

template:
    spec:
      containers:
      - name: some-job
        command: ["/somewhere/jre/bin/java", "-Djava.abc.handler.pkgs=util.connection", "-Dcom.abc.properties=/opt/abc/def/deployment.properties", "-cp", "/opt/abc/def/lib/jar/somejava.jar:*:.", "com.abc.def.Deployer"]

As you can see, the -Dargs need to be specified as a whole unit, with each one separated from the other. I had to have them at the front of the command also, but that may not be required. Afterwards the rest of your command must follow the standard format.

seshadri_c
  • 6,906
  • 2
  • 10
  • 24
Andrew L
  • 1
  • 2
0

The correct way to pass system properties into the Jenkins controller VM is to use the controller.containerEnv value to pass in JENKINS_JAVA_OPTS. This variable is not set by default and hence you are safe to provide your own value for it without risking overwriting something important.

Example:

controller:
  containerEnv:
    - name: JENKINS_JAVA_OPTS
      value: "-Dcom.cloudbees.jenkins.plugins.kubernetes_credentials_provider.KubernetesCredentialProvider.labelSelector=\"owner=jenkins\""
Andy Brown
  • 11,766
  • 2
  • 42
  • 61