• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • kubernetes-plugin
    • None

      Hello.

      The kubernetes object `serviceAccountName` cannot apply to the pod if it sets via yaml.

      Reproduce:

        {code:java}
           agent {
              kubernetes{
                  yaml '''
                      apiVersion: v1
                      kind: Pod
                      metadata:
                      spec:
                        serviceAccountName: "jenkins v1"
                  '''
              }
          }
      

      Result:

      ---
      apiVersion: "v1"
      kind: "Pod"
      ...
      spec:
      ...
        serviceAccountName: "default"
      ... 
      Result:
      {code:java}
      ---
      apiVersion: "v1"
      kind: "Pod"
      ...
      spec:
      ...
        serviceAccountName: "default"
      ... 

       

      Version:
      Jenkins 2.375.2
      Kubernetes plugin Version 3896.v19b_160fd9589

          [JENKINS-70819] serviceAccountName for yaml pod template

          Neeraj added a comment - - edited

          aura_aman Pls check

          We are also facing the same issue.

          Running Jenkins 2.361.4-lts-alpine on helm chart 4.2.15

          K8s Plugin: 
          kubernetes:3896.v19b_160fd9589
          Yaml:

           
          apiVersion: v1
          kind: Pod
          spec:
          serviceAccount: jenkins-packer
          serviceAccountName: jenkins-packer
          command:

          • sleep
            args:
          • 99s
            securityContext:
            fsGroup: 1337
            tolerations:
          • key: role
            operator: Equal
            value: mgmt
            effect: NoSchedule

          Neeraj added a comment - - edited aura_aman Pls check We are also facing the same issue. Running Jenkins 2.361.4-lts-alpine on helm chart 4.2.15 K8s Plugin:  kubernetes:3896.v19b_160fd9589 Yaml:   apiVersion: v1 kind: Pod spec: serviceAccount: jenkins-packer serviceAccountName: jenkins-packer command: sleep args: 99s securityContext: fsGroup: 1337 tolerations: key: role operator: Equal value: mgmt effect: NoSchedule

            aura_aman Aman
            aliaksandr_shamchonak Aliaksandr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: