The RDU3 Jenkins deployment is the new Jenkins environment running in the RDU3 OpenShift cluster. Located in RedHat RDU3 lab
Jenkins URL:
https://jenkins.apps.prod-scale-spoke1-dc-rdu3.itup.redhat.com
OpenShift cluster:
prod-scale-spoke1-dc-rdu3.itup.redhat.com
OpenShift Console:
https://console-openshift-console.apps.prod-scale-spoke1-dc-rdu3.itup.redhat.com
Production OpenShift project:
ceph-downstream-tenant–pipeline
The Jenkins environment consists of:
Unlike a traditional Kubernetes Jenkins deployment, builds are not executed inside Kubernetes pods. Dedicated KubeVirt VMs are created on demand and used as Jenkins agents.
This provides Jenkins jobs with a full RHEL virtual machine while still allowing the builders to be dynamically created and removed as required.
The Jenkins configuration is maintained in the following Git repository:
git@gitlab.cee.redhat.com:ccit/jenkins-csb-customers/storage-casc-ceph-downstream.git
During the RDU3 migration, the new Jenkins instance is using the following branch:
rdu3-migration
This is a temporary migration branch used for the RDU3 Jenkins configuration while the existing Jenkins environment is still in use.
Changes specific to the new RDU3 Jenkins deployment should currently be made against the rdu3-migration branch.
Once the migration to the RDU3 Jenkins instance is complete, the temporary migration branch can be retired and the normal production configuration workflow can be used.
Jobs are Jenkins Job Builder YAML in:
https://gitlab.cee.redhat.com/ceph/rhcs-jenkins-jobs
<job>/config/definitions/<job>.yaml<job>/build/buildTo change a job:
master, edit, open an MR.jenkins-job-builder job runs on every push to master and updates all jobs.To test a branch before merging:
jenkins-job-builder with GITLAB_BRANCH=<branch> and JOB_NAME=<job>.master run.
Do not edit jobs in the Jenkins UI. The next master run overwrites them.
Login is Red Hat SSO. Permissions are roles in casc.yaml in the configuration repository, under jenkins.authorizationStrategy.
Roles: admin, admin_read, ceph-dev-qe-config, schedule_build, readonly.
To give someone access:
- user: "<kerberos id>" under the role's entries. Use - group: "<name>" for an SSO group.main. Merge.Notes:
The Jenkins build agents are RHEL 9 virtual machines running through OpenShift Virtualization.
Builders/OCP VM's subnet is 10.5.225.0/24
Example agent types include:
These builders are not expected to be permanently running Jenkins nodes. They are provisioned on demand when Jenkins needs capacity to execute a job.
Each VM is configured as a Jenkins agent and connects back to:
https://jenkins.apps.prod-scale-spoke1-dc-rdu3.itup.redhat.com
The Jenkins agent uses WebSocket connectivity rather than the traditional JNLP TCP agent port.
The RDU3 Jenkins builders are dynamically created using OpenShift Virtualization.
Instead of maintaining a large pool of permanently running builder VMs, Jenkins creates builders when jobs require them and removes the builders when they are no longer needed.
The lifecycle of a builder is:
This makes the builders effectively disposable.
A builder exists only for the period in which Jenkins requires the capacity. A later job can cause a new clean VM to be created instead of depending on the state left behind by an older build.
When Jenkins determines that additional capacity is required, it requests a new builder based on the configuration for the requested node type.
For example, a job requiring a rhel9large builder causes Jenkins to request a VM matching the rhel9large configuration.
OpenShift Virtualization then creates the VM and allocates the configured resources, including:
The VM boots from the configured RHEL 9 image.
As part of provisioning, the VM is configured with the Jenkins agent information required to connect back to the controller.
Inside the VM, the Jenkins agent is started using agent.jar.
An example of the agent command is:
java -jar /home/jenkins-build/agent.jar \ -url https://jenkins.apps.prod-scale-spoke1-dc-rdu3.itup.redhat.com \ -secret @/etc/jenkins-agent/secret \ -name <node-name> \ -webSocket \ -workDir /home/jenkins-build
The important part of the RDU3 configuration is:
-webSocket
The agent establishes an outbound WebSocket connection to the Jenkins controller over HTTPS.
Once the connection is established, Jenkins marks the node online and can schedule the waiting job onto it.
Once the builder is online, Jenkins assigns the queued job to the VM.
From the Jenkins job's perspective, the VM behaves like a regular Jenkins node.
The build has access to the RHEL environment and any tools installed as part of the builder provisioning process.
The builders are disposable and are not intended to remain running indefinitely after their work has completed.
After Jenkins determines that the dynamically created agent is no longer required, the agent is removed and the associated KubeVirt VM is deleted.
Deleting the VM also releases the compute resources that were allocated to it.
This is particularly important in RDU3 because the OpenShift tenants have resource limits. Dynamically removing unused builders prevents idle Jenkins nodes from continuously consuming the tenant's CPU and memory allocation.
The Jenkins integration uses customized logic for managing the KubeVirt builder nodes.
The Sorter Jenkins plugin contains Java customizations used as part of the KubeVirt Jenkins agent implementation.
The integration allows Jenkins to dynamically request KubeVirt builder VMs when jobs require additional capacity and remove those VMs when they are no longer needed.
The following diagram shows the lifecycle of an on-demand Jenkins builder:
+-----------------------+
| Jenkins Job |
| enters the queue |
+-----------+-----------+
|
v
+-----------------------+
| Jenkins Controller |
| |
| Builder capacity |
| required |
+-----------+-----------+
|
v
+-----------------------+
| Sorter / KubeVirt |
| Integration |
+-----------+-----------+
|
| Create VM
v
+------------------------------------------------+
| OpenShift RDU3 |
| |
| ceph-downstream-tenant--pipeline |
| |
| +-----------------------------+ |
| | OpenShift Virtualization | |
| | / KubeVirt | |
| +-------------+---------------+ |
| | |
| | Start VM |
| v |
| +-----------------------------+ |
| | RHEL 9 Builder VM | |
| | | |
| | rhel9medium / rhel9large | |
| +-------------+---------------+ |
| | |
+---------------------|--------------------------+
|
| WebSocket / HTTPS
v
+-----------------------+
| Jenkins Controller |
| |
| Agent becomes online |
+-----------+-----------+
|
v
+-----------------------+
| Job Runs |
| on the Builder VM |
+-----------+-----------+
|
v
+-----------------------+
| Job Completes |
+-----------+-----------+
|
v
+-----------------------+
| Jenkins removes the |
| dynamic agent |
+-----------+-----------+
|
| Delete VM
v
+-----------------------+
| KubeVirt VM Destroyed |
| |
| CPU / Memory released |
+-----------------------+
The important point is that the builder VM is temporary:
Job queued
|
v
VM created
|
v
VM boots
|
v
Agent connects to Jenkins
|
v
Job runs
|
v
Job finishes
|
v
Agent removed
|
v
VM destroyed
Outbound traffic from the RDU3 tenant is restricted.
When Jenkins or its builder VMs require access to a new external destination, that destination must be allowed by the tenant egress configuration.
The tenant uses egress rules to control which external networks and services workloads are allowed to reach.
For example, if Jenkins builders need to reach a service at:
192.0.2.50
on TCP port 22, an EgressFirewall rule can be added:
apiVersion: network.openshift.io/v1 kind: EgressFirewall metadata: name: default namespace: ceph-downstream-tenant--pipeline spec: egress: - type: Allow to: cidrSelector: 192.0.2.50/32 ports: - protocol: TCP port: 22
For an HTTPS service:
- type: Allow to: cidrSelector: 192.0.2.50/32 ports: - protocol: TCP port: 443
The destination should be restricted as much as possible. Prefer allowing the specific destination IP/network and required port instead of opening broad outbound access.
Before adding a new external dependency, identify:
The appropriate egress rule can then be added to the tenant configuration.
After the rule is applied, connectivity can be verified from a Jenkins builder VM.
The RDU3 environment provides four tenants for our use.
Each tenant has limited CPU, memory, and other resources, so workloads should be placed in the appropriate tenant.
The two primary tenants used by Jenkins are:
ceph-downstream-tenant–pipeline - Production Jenkins workloads.ceph-downstream-tenant–runtime-int - Staging and testing environment.
The ceph-downstream-tenant–pipeline tenant hosts the production Jenkins environment and production builder workloads.
The ceph-downstream-tenant–runtime-int tenant should be used for testing changes before they are introduced into production.
Examples include:
Changes should first be validated in ceph-downstream-tenant–runtime-int before being applied to ceph-downstream-tenant–pipeline.
Jenkins builders run as KubeVirt Virtual Machines (VMs) in the RDU3 OpenShift cluster. Developers can access running builders via SSH using virtctl port-forward.
Log in to the RDU3 OpenShift cluster and select the Jenkins tenant namespace.
oc project ceph-downstream-tenant--pipeline oc get vmi
Example output:
NAME AGE PHASE IP NODENAME READY rhel8medium-rdu3-c36e1a98 8h Running 172.17.44.37 worker07.itup-003.prod.rdu3.dc.redhat.com True rhel9large-rdu3-8f20a52c 5h38m Running 172.19.12.11 worker26.itup-003.prod.rdu3.dc.redhat.com True
Identify the running builder you want to access.
Open a terminal and run:
virtctl port-forward \ vmi/rhel8medium-rdu3-c36e1a98 \ 2222:22
This forwards local TCP port 2222 to SSH port 22 on the selected VM.
Keep this terminal running while connected to the builder.
Open a second terminal and run:
ssh -i jenkins-build.id \ -o IdentitiesOnly=yes \ -p 2222 \ jenkins-build@127.0.0.1
Replace jenkins-build.id with the path to your authorized SSH private key.
oc get vmi to find the current running builder.ceph-downstream-tenant–pipeline. Select the namespace containing your target VM.jenkins-build user.Ctrl+C when finished.ERROR.java.lang.NullPointerException with no stack trace: open the first failed build after the last green one. It has the trace.rhcs-jenkins-jobs and storage-casc-ceph-downstream.<jenkins url>/job/<job>/config.xml and compare it with master. The job may be running a test branch (see Job Definitions).Known signatures:
NullPointerException in SecretBuildWrapper.buildEnvVars: a credential binding in the job has no variable.Permission denied (publickey) from GitHub: the credential is named in the [ssh-agent] Using credentials line. Check the key is still on the GitHub account at https://github.com/<account>.keys.ErrExceededQuota: the storage quota is full. No new builder starts until a running one finishes. Check the quota.oc -n ceph-downstream-tenant--pipeline get vm,vmi,dv,pvc oc -n ceph-downstream-tenant--pipeline get events --sort-by=.lastTimestamp | tail -40 oc -n ceph-downstream-tenant--pipeline get appliedclusterresourcequota -o yaml oc -n ceph-downstream-tenant--pipeline logs deploy/ceph-downstream-jenkins | grep -iE 'kubevirt|Timed out waiting'
Jenkins secrets are stored encrypted in the storage-casc-ceph-downstream repository using git-crypt. Never commit a secret in plaintext.
Create a new branch from main:
git switch main git pull --ff-only git switch -c update-jenkins-secret
Verify that git-crypt is unlocked and that the secret is configured for encryption:
git-crypt status git check-attr filter diff -- secrets/ceph-jenkins-api-token
Update the secret without putting its value in the shell history:
read -s SECRET_VALUE echo printf '%s' "$SECRET_VALUE" > secrets/ceph-jenkins-api-token unset SECRET_VALUE
Verify the file is still managed by git-crypt:
git check-attr filter diff -- secrets/ceph-jenkins-api-token git-crypt status
Stage and review the change:
git add secrets/ceph-jenkins-api-token git status git diff --cached --stat
Commit and push the feature branch:
git commit -m "Update Jenkins API token" git push -u origin update-jenkins-secret
Create an MR to main after verifying that no plaintext secret was committed.
Create the new secret under secrets/:
read -s SECRET_VALUE echo printf '%s' "$SECRET_VALUE" > secrets/<secret-name> unset SECRET_VALUE
Make sure the new file is covered by the git-crypt rules in secrets/.gitattributes.
Verify encryption before committing:
git check-attr filter diff -- secrets/<secret-name> git-crypt status
Then stage secrets/.gitattributes if it was changed, along with the new secret:
git add secrets/.gitattributes secrets/<secret-name> git status git diff --cached --stat
Commit and push the feature branch, then create an MR to main.
<note important> Never paste secret values into Git commit messages, merge requests, Slack, tickets, or command-line arguments. Always verify that git-crypt recognizes a new secret before pushing it. </note>