Resolution
In CloudBees CI on Modern Platforms, the Java Options are passed to the JVM running Jenkins via the JAVA_OPTS
Environment variable set in the Pod spec. The Pod is managed by a StatefulSet and it is therefore the StatefulSet that must be updated. When the StatefulSet is updated, the managed Pod is deleted and a new pod is created with the updated values.
-
For Operations Center, the configuration is managed via Helm or manually via the
cloudbees-core.yaml
:-
the Java Options must be updated in the configuration file (i.e.
values.yaml
with helm,cloudbees-core.yaml
if manually) -
the configuration must be applied (i.e.
helm upgrade
with helm,kubectl apply
if manually): this will update the Operations Center StatefulSet and apply the changes made
-
-
For Managed controllers, the configuration is managed by Operations Center:
-
the Java Options must be updated in the Managed controller’s item configuration
-
the configuration must be applied by restarting the Managed controller from Operations Center: this will recreate the controller’s StatefulSet and apply the changes made
-
Operation Center
The Java Options of the Operations Center must be added to the JAVA_OPTS
environment variable of the cjoc
statefulset.
With Helm
You need to add the Java arguments to the OperationsCenter.JavaOpts
attribute (e.g., --set OperationsCenter.JavaOpts
). For example:
OperationsCenter: JavaOpts: >- -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.DNSMultiCast.disabled=true ...
Then apply the update configuration - for example helm upgrade cloudbees-core cloudbees/cloudbees-core -f values.yaml --version 3.15.0
.
With .yaml modifications
In the cloudbees-core.yml
locate the cjoc
StatefulSet and add the argument to the existing, i.e:
... spec: containers: - env: ... - name: JAVA_OPTS value: >- -XshowSettings:vm -Dcb.IMProp.warProfiles.cje=kubernetes.json -Dcom.cloudbees.masterprovisioning.kubernetes.KubernetesMasterProvisioning.fsGroup=1000 -Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle -Dcom.cloudbees.jce.masterprovisioning.DockerImageDefinitionConfiguration.disableAutoConfiguration=true -Dcom.cloudbees.jce.masterprovisioning.DockerImageDefinitionConfiguration.masterImageName="CloudBees Core - Managed controller 2.176.1.4" -Dcom.cloudbees.jce.masterprovisioning.DockerImageDefinitionConfiguration.masterImage=cloudbees/cloudbees-core-mm:2.176.1.4
Then apply the update configuration - for example kubectl apply -f cloudbees-core.yml
.
Alternatively, you can also edit directly JAVA_OPTS
using kubectl edit statefulset/cjoc
.
Managed controllers
The Java Options of Managed controllers can be set in different ways:
-
Java Options in the Managed controller configuration (per controller configuration)
-
System Properties in the Managed controller configuration (per controller configuration)
When managing many controllers, a better strategy is to configure or enforce defaults:
-
Default Java Options in the Kubernetes controller Provisioning global configuration (default options for newly created controllers)
-
Default System Properties in the Kubernetes controller Provisioning global configuration (default system properties for newly created controllers)
-
Global Java Options in the Kubernetes controller Provisioning global configuration (enforced options for all provisioned controllers)
Java Options may contain System Properties, they are prefixed with -D . System Properties cannot contain Java Arguments such as -XshowSettings:vm or -XX:*
|
controller Java Options
Go to Operations Center Dashboard and click on Configure
on the Managed controller you want to add the Java argument.
Once here, you can add your Java arguments under Provisioning > Java Options
(separated with blank spaces, not line breaks).
controller System Properties
Go to Operations Center Dashboard and click on Configure
on the Managed controller you want to add the Java argument.
Once here, you can add your System Properties under Provisioning > System Properties
(separated with line breaks, not blank spaces). For example:
hudson.slaves.NodeProvisioner.initialDelay=0 hudson.DNSMultiCast.disabled=true
controller Default Java Options
controller Default Java Options are the default Java Options added to a Managed controller configuration when it is created. They are configurable in Operations Center.
Changes made to the Default Java Options are not reflected in the configuration of existing Managed controller |
Configure the controller Default Java Options
To configure those Default Java Options, go under
> Default Java Options].Enforce the controller Default Java Options
To enforce those Default Java Options, add the environment variable MASTER_JAVA_OPTIONS
to the Operations Center StatefulSet. In that case the options will not be configurable from the UI.
With Helm
This is currently not supported via Helm.
With .yaml modifications
In the cloudbees-core.yml
locate the cjoc
StatefulSet and add the argument to an environment variable named MASTER_GLOBAL_JAVA_OPTIONS
, i.e:
... spec: containers: - env: - name: MASTER_JAVA_OPTIONS value: >- -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.DNSMultiCast.disabled=true ...
Then apply the update configuration - for example kubectl apply -f cloudbees-core.yml
.
controller Default System Properties
controller Default System Properties are the default System Properties added to a Managed controller configuration when it is created. They are configurable in Operations Center.
To configure those Default System Properties Options, go under
> Default System Properties].Changes made to the Default System Properties are not reflected in the configuration of existing Managed controller |
controller Global Java Options
controller Global Java Options are Java options that are enforcibly added to every Managed controller deployment and not configurable from the UI. Those Java Options are automatically appended to the Managed controller’s JAVA_OPTS
environment variable during provisioning. They are enforced to all managed controllers and not configurable from the UI.
Changes made to the Global Java Options are reflected to every Managed controller when re-provisioned |
Configure the controller Global Java Options
To configure those Global Java Options, go under
> Global Java Options].Enforce the controller Global Java Options
To enforce those Global Java Options, add the environment variable MASTER_GLOBAL_JAVA_OPTIONS
to the Operations Center StatefulSet. In that case the options will not be configurable from the UI.
With Helm
You need to add the Java arguments to the Master.JavaOpts
attribute (e.g., --set Master.JavaOpts
). For example:
Master: JavaOpts: >- -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.DNSMultiCast.disabled=true ...
Then apply the update configuration - for example helm upgrade cloudbees-core cloudbees/cloudbees-core -f values.yaml --version 3.15.0
.
With .yaml modifications
In the cloudbees-core.yml
locate the cjoc
StatefulSet and add the argument to an environment variable named MASTER_GLOBAL_JAVA_OPTIONS
, i.e:
... spec: containers: - env: - name: MASTER_GLOBAL_JAVA_OPTIONS value: >- -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Dhudson.DNSMultiCast.disabled=true ...
Then apply the update configuration - for example kubectl apply -f cloudbees-core.yml
.