CLI command shared-pod-template is returning always an empty list

Article ID:360046576592
1 minute readKnowledge base

Issue

After running the shared-pod-template CLI command as described in Export Kubernetes (shared) pod template definitions from CloudBees CI Operations Center and controllers, the output is always an empty list.

$ java -jar jenkins-cli.jar -s https://cloudbees-core-url:port-number/cjoc/ shared-pod-template
{"version":"1","data":[]}
  • CTR-2373: 'shared-pod-template' CLI command look for old shared cloud name

Explanation

The problem behind this is that in version 2.190.0.2 of Operations Center Kubernetes Cloud Plugin (released as part of CloudBees CI on modern cloud platform 2.190.3.2), the name of the default kubernetes shared cloud changed from kubernetes shared cloud to kubernetes-shared-cloud.

However, the shared-pod-template CLI command was not updated to read the new location and is still looking for the old name (kubernetes shared cloud).

If the first installation of your cluster is based on CloudBees CI on modern cloud platform 2.190.3.2 or a higher version, the default kubernetes shared cloud will be named as kubernetes-shared-cloud, so the shared-pod-template CLI command won’t be able to read the shared pod templates.

The problem is fixed in 2.235.0.3 of Operations Center Kubernetes Cloud Plugin that supports both kubernetes-shared-cloud and kubernetes shared cloud. It is available in CloudBees CI since version 2.235.4.1.

Resolution

Upgrade CloudBees CI to version 2.235.4.1 or later.

Workaround

In the meantime, the issue can be worked around by renaming the $JENKINS_HOME/kubernetes-shared-cloud directory to $JENKINS_HOME/kubernetes shared cloud and restarting the Operation Center.