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

Kubernetes plugin to provide option to overwrite hostname in podtemplate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • kubernetes-plugin
    • None
    • Jenkins ver. 2.60.3
      Kubernetes plugin - 1.8.4

      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' } }

        }

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

              Created:
              Updated:
              Resolved: