Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59937

Container and Pod template runAsGroup and runAsUser default to root on config roundtrip

    Details

    • Similar Issues:
    • Released As:
      kubernetes-1.21.0

      Description

      version 1.20.2 introduced runAsUser and runAsGroup properties but the config round trip defaults the value to 0 which is the root user. This is probably not what is intended and happens to breaks certain environments where the containers are expected to run with default user and group ids. This can be demonstrated with a simple test in KubernetesCloudTest.java

      @Test
          public void defaultRoundTrip() throws Exception {
              KubernetesCloud cloud = new KubernetesCloud("kubernetes");
              ContainerTemplate ct = new ContainerTemplate("jnlp", "jenkins:jnlp");
              assertNull(ct.getRunAsUser());
              assertNull(ct.getRunAsGroup());
              PodTemplate pt = new PodTemplate("default", new ArrayList<>(), Arrays.asList(ct));
              cloud.addTemplate(pt);
              j.jenkins.clouds.add(cloud);
              j.jenkins.save();
              // roundtrip
              j.configRoundtrip();
              cloud = j.jenkins.clouds.get(KubernetesCloud.class);
              PodTemplate podTemplate = cloud.getTemplates().get(0);
              assertNull(podTemplate.getRunAsGroup());
              assertNull(podTemplate.getRunAsUser());
              ContainerTemplate containerTemplate = podTemplate.getContainers().get(0);
              assertNull(podTemplate.getRunAsUser());
              assertNull(containerTemplate.getRunAsUser());
          }
      

        Attachments

          Issue Links

            Activity

            kylecronin Kyle Cronin created issue -
            kylecronin Kyle Cronin made changes -
            Field Original Value New Value
            Link This issue is caused by JENKINS-47827 [ JENKINS-47827 ]
            vlatombe Vincent Latombe made changes -
            Remote Link This issue links to "PR #630 (Web Link)" [ 23907 ]
            vlatombe Vincent Latombe made changes -
            Assignee Vincent Latombe [ vlatombe ]
            vlatombe Vincent Latombe made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Released As kubernetes-1.21.0

              People

              • Assignee:
                vlatombe Vincent Latombe
                Reporter:
                kylecronin Kyle Cronin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: