Invalid merge of `command` & `args` fields in PodTemplate

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • Component/s: kubernetes-plugin
    • Environment:
      Latest kubernetes-plugin, master branch - commit 46e33be7aef41862bd6c5cf9ecbbf6135ff052d0
    • 4203.v1dd44f5b_1cf9

      When parent PodTemplate specifies command & args for container and child container doesn't, then these fields are overridden by empty values. This is current behavior:

        15.505 [id=19]    FINEST    o.c.j.p.k.PodTemplateUtils#combine: Combining pods, parent: ---
      apiVersion: "v1"
      kind: "Pod"
      metadata: {}
      spec:
        containers:
        - args:
          - "argument1"
          - "argument2"
          command:
          - "parent command"
          image: "parent-image"
          name: "docker"
       
      template: ---
      apiVersion: "v1"
      kind: "Pod"
      metadata: {}
      spec:
        containers:
        - name: "docker"
          resources:
            requests:
              cpu: "300m"
              memory: "300Mi"  
      
      15.522 [id=19]    FINEST    o.c.j.p.k.PodTemplateUtils#combine
      Pods combined: ---
      apiVersion: "v1"
      kind: "Pod"
      metadata: {}
      spec:
        containers:
        - image: "parent-image"
          name: "docker"
          resources:
            requests:
              cpu: "300m"
              memory: "300Mi"
          workingDir: "/home/jenkins/agent" 

      In the pods combined we expect command and args to be present.

      This issue occurs because of null check at this line. this.args is initialized as an empty list by default in Container class, so it's not null. That's why this check is always false.

      I suggest to use getArgs().isEmpty() to check if args are present in container template.

       

            Assignee:
            Pavel
            Reporter:
            Pavel
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: