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

Kubernetes plugin to provide option to overwrite hostname in podtemplate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: kubernetes-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.60.3
      Kubernetes plugin - 1.8.4
    • Similar Issues:

      Description

      if hostname is a added to the specs, container shell couldn't locate the hostname. Since jenkins slave sets pod name as hostname. Keeping both same as same. Is there a way to overwrite only hostname within a podname. Kubernetes support it where podname and hostname can be different. usecase is to have different podname and hostname. Trying to keep hostname as consistent for a build activity trying to avoid rebuild as build records hostname information in its objects.

      Detail of the podtemplate used

      ------------
      def label = "mypod-${UUID.randomUUID().toString()}"
      podTemplate(name: "myname", label: label, defaultContainer: "busybox", namespace: "noormohamed", yaml: """
      apiVersion: v1
      kind: Pod
      metadata:
      labels:
      label: build
      spec:
      hostname: myhostname
      containers:

      • name: maven
        image: maven:alpine
        command:
      • cat
        tty: true
      • name: busybox
        image: busybox
        command:
      • cat
        tty: true
        """
        ) {
        node (label)
        Unknown macro: { container('maven') { sh 'hostname' sh 'mvn -version' } container('busybox') { sh 'hostname' sh '/bin/busybox' } }

        }

        Attachments

          Activity

          Hide
          vlatombe Vincent Latombe added a comment -

          Can't reproduce on a recent version. This probably was fixed a long time ago.

          Show
          vlatombe Vincent Latombe added a comment - Can't reproduce on a recent version. This probably was fixed a long time ago.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            noormohamed NOOR MOHAMED NAINAMOHAMED
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: