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

Error launching agent into second cloud

XMLWordPrintable

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

      I am having trouble launching a second k8s based agent into a new cluster.

      My use case is that I have a "shared" cluster (where Jenkins lives) where agents usually run and I have additional clusters for dev/tst/etc. Agents in shared (using the Kubernetes plugin) cluster run CI and then deploy built app containers to the dev cluster (for example) using kubectl. Once an app container is running I want to be able to launch a new agent into the [dev] cluster using the plugin to run some tests.

      It looks like I should just be able to set up the second cloud in Jenkins (we use config code) and the reference it in the top of the pod definition in the pipeline when I want to launch the new agent.

      However, when I do the agent tries to launch in the existing cluster ("shared" in this example) rather than the cloud I prescribe.

      In the logs I see:

      ```
      Oct 17, 2019 10:27:21 AM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud provision
      Template for label jknode-devops-repotemplate-dotnetcore-test-15: Kubernetes Pod Template
      Oct 17, 2019 10:27:21 AM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud
      Building connection to Kubernetes primary-aks-eurw-dev URL https://primary-aks-eurw-dev-wr-aasda324.hcp.westeurope.azmk8s.io:443/ namespace null
      Oct 17, 2019 10:27:21 AM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud
      Connected to Kubernetes primary-aks-eurw-dev URL https://primary-aks-eurw-shared-wr-dasdad242.hcp.westeurope.azmk8s.io:443/

      ```

      At a glance in the source code, it looks like the plugin is pulling the incorrect client out of the cache. As you can see from the logs it looks like it starts to build the connection to the dev cluster and then retrieves the client for the shared cluster and uses that.

            Unassigned Unassigned
            adouglas_wr Andrew Cameron-Douglas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: