Scheduling a task under Kubernetes fails

10/25/2019

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:

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.<init>(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)

...,

We've looked at the table content, the task does have a name.

Any idea?

-- Eric Giguere
dataflow
kubernetes
spring-cloud

1 Answer

10/29/2019

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.

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.

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.

Hope that can help someone in the future.

Bug reported: https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/issues/347

PR issued: https://github.com/spring-cloud/spring-cloud-deployer-kubernetes/pull/348

-- Eric Giguere
Source: StackOverflow