Jenkins and plugins versions report
Environment
Jenkins: 2.541.1
OS: Linux - 6.8.0-100-generic
Java: 25.0.1 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
configuration-as-code:2037.v8e5349845172
...
kubernetes:4423.vb_59f230b_ce53
kubernetes-client-api:7.3.1-256.v788a_0b_787114
kubernetes-credentials:207.v492f58828b_ed
...
What Operating System are you using (both controller, and any agents involved in the problem)?
All deployed on RKE2 kubernetes cluster with version v1.32.7+rke2r1.
Jenkins controller version: 2.541.1-lts-jdk25-3
Agents base on: inbound-agent:3355.v388858a_47b_33-12-jdk25
Jenkins image is prebuilt with by installing plugins. Agent images are patched by custom CA etc.
Reproduction steps
- Create pod templates in casc which will inherit from other as below:
- name: base
label: base
containers:
- name: jnlp
image: some.repository/agent:1
ttyEnabled: true
alwaysPullImage: true
command: "/home/build/entrypoint.sh"
args: "/bin/bash -c \"jenkins-agent && cat\""
imagePullSecrets:
- name: docker-registry
- name: custom
label: custom
inheritFrom: base
yamlMergeStrategy: merge
yaml: |-
spec:
nodeSelector:
role: deployment
priorityClassName: high-priority
- Create pipeline which will run on pod based on label
custom: Example pipeline definition:
node('custom') {
sh "whoami"
}
- Review pod definition created for above pipeline
Expected Results
Expected is that created POD template definition will contain:
nodeSelector with required filter
priorityClassName with required value
Actual Results
POD template contain nodeSelector with proper filter but priorityClassName is not added to pod template which result that priority assigned to pod is default - 0.
Anything else?
yamlMergeStrategy: merge does not merge ALL fields from yaml - merge only fields which are covered in code.
https://github.com/jenkinsci/kubernetes-plugin/blob/4423.vb_59f230b_ce53/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateUtils.java#L328-L342
There is need to add function which will cover merge of priorityClassName field.
Are you interested in contributing a fix?
Yes.
Suggestion - allow to not only specify it in yaml section but as variable - same as nodeSelector, volumes and many others options.
PR prepared: #2814
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
All deployed on RKE2 kubernetes cluster with version v1.32.7+rke2r1.
Jenkins controller version: 2.541.1-lts-jdk25-3
Agents base on: inbound-agent:3355.v388858a_47b_33-12-jdk25
Jenkins image is prebuilt with by installing plugins. Agent images are patched by custom CA etc.
Reproduction steps
custom: Example pipeline definition:Expected Results
Expected is that created POD template definition will contain:
nodeSelectorwith required filterpriorityClassNamewith required valueActual Results
POD template contain
nodeSelectorwith proper filter butpriorityClassNameis not added to pod template which result thatpriorityassigned to pod is default - 0.Anything else?
yamlMergeStrategy: mergedoes not merge ALL fields fromyaml- merge only fields which are covered in code.https://github.com/jenkinsci/kubernetes-plugin/blob/4423.vb_59f230b_ce53/src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateUtils.java#L328-L342
There is need to add function which will cover merge of
priorityClassNamefield.Are you interested in contributing a fix?
Yes.
Suggestion - allow to not only specify it in
yamlsection but as variable - same asnodeSelector,volumesand many others options.PR prepared: #2814