<p>I'm using Jenkins configuration as code (JCASC).</p>
<p>I'm having a pod template and I want to add NodeSelector + Tolerations.
podTemplate doesn't support key of tolerations and NodeSelector so I need to add pod YAML spec...</p>
<pre><code>      agent:
        enabled: true
        podTemplates:
     podTemplates:
          jenkins-slave-pod: |
            - name: jenkins-slave-pod
              label: global-slave
              serviceAccount: jenkins
              idleMinutes: &quot;15&quot;
              containers:
                - name: main
                  image: 'xxxxxx.dkr.ecr.us-west-2.amazonaws.com/jenkins-slave:ecs-global'
                  command: &quot;sleep&quot;
                  args: &quot;30d&quot;
                  privileged: true
</code></pre>
<p>I was thinking of adding yaml: and just configuring the spec of the pod...
But when I'm adding yaml: and adding yamlStrategy: merge/overrid it ignores the YAML it and only uses my podTemplate instead.</p>
<p>How can I merge/override my podTemplate and add pod with tolerations/nodeSelecotr?</p>
<p>Thats the YAML I want to have inside my podTemplate:</p>
<pre><code>
          apiVersion: v1
          kind: Pod
          serviceAccount: jenkins-non-prod
          idleMinutes: &quot;15&quot;
          containers:
          - name: main
            image: 'xxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/jenkins-slave:ecs-global'
            command: &quot;sleep&quot;
            args: &quot;30d&quot;
            privileged: true
          spec:
            nodeSelector:
              karpenter.sh/provisioner-name: jenkins-provisioner
            tolerations:
            - key: &quot;jenkins&quot;
              operator: &quot;Exists&quot;
              effect: &quot;NoSchedule&quot;
</code></pre>
<p><a href="https://i.stack.imgur.com/NVjt4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NVjt4.png" alt="enter image description here" /></a></p>

<p>I try to give you a little suggestion, let me know if it works.</p>
<p>If you have an up&amp;running Jenkins instance (with the Kubernetes plugin installed), you can go to “Manage Jenkins”/“Configure Clouds” and prepare your Pod Templates as you see fit.
There you will also find the definition of nodeSelector and Toleration.</p>
<p>Once you have saved the setup you prefer, go to “Manage Jenkins”/“Configuration as Code” and save the JCASC as Code configuration of your Jenkins (click “Download Configuration”).</p>
<p>You can replicate this working mode for any new configuration you want to add to your Jenkins.</p>
