<p>We are deploying Spring Cloud Data Flow v2.2.1.RELEASE in Kubernetes. Everything or almost seems to work but scheduling is not. In fact, even when running tasks by manual launch using the UI (or api) we see an error log. That same log is generated when trying to schedule but this time, it makes the schedule creation fails. 
Here is a stack trace extract:</p>

<pre><code>java.lang.IllegalArgumentException: taskDefinitionName must not be null or empty
    at org.springframework.util.Assert.hasText(Assert.java:284)
    at org.springframework.cloud.dataflow.rest.resource.ScheduleInfoResource.&lt;init&gt;(ScheduleInfoResource.java:58)
    at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController$Assembler.instantiateResource(TaskSchedulerController.java:174)
    at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController$Assembler.instantiateResource(TaskSchedulerController.java:160)
    at org.springframework.hateoas.mvc.ResourceAssemblerSupport.createResourceWithId(ResourceAssemblerSupport.java:89)
    at org.springframework.hateoas.mvc.ResourceAssemblerSupport.createResourceWithId(ResourceAssemblerSupport.java:81)
    at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController$Assembler.toResource(TaskSchedulerController.java:168)
    at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController$Assembler.toResource(TaskSchedulerController.java:160)
    at org.springframework.data.web.PagedResourcesAssembler.createResource(PagedResourcesAssembler.java:208)
    at org.springframework.data.web.PagedResourcesAssembler.toResource(PagedResourcesAssembler.java:120)
    at org.springframework.cloud.dataflow.server.controller.TaskSchedulerController.list(TaskSchedulerController.java:85)
    at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
</code></pre>

<p>...,</p>

<p>We've looked at the table content, the task does have a name.</p>

<p>Any idea?</p>

<p>I've finally found the source of the error by debugging live Data Flow. The problem arises when CronJob that are not created by Data Flow are present in the namespace, which is by my evaluation a problem. The scheduler launches a process that loops on Kubernetes CronJob resources and tries to process them.</p>

<p>Data Flow should certainly do its processing on those using labels, like all Kubernetes native tools, to select only the elements that concerns it. Any process could use CronJob.</p>

<p>So Pivotal - Data Flow people, it would probably be a good idea to enhance that part and this way prevent that kind of "invisible" problems. I say invisible because the only error we get is the validation of the Schedule item, complaining about the fact that the name is empty and that is because that CronJob was not in any way linked to an SCDF task.</p>

<p>Hope that can help someone in the future.</p>

<p>Bug reported: <a href="https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/issues/347" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/issues/347</a></p>

<p>PR issued: <a href="https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/pull/348" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/pull/348</a></p>
