-
Notifications
You must be signed in to change notification settings - Fork 1.3k
priorityClassName specified in yaml not appplied with yamlMergeStrategy: merge #2813
Description
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:
nodeSelectorwith required filterpriorityClassNamewith 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.
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