How to configure Spring Cloud Data Flow to execute tasks in a separate namespace per task?

647 views Asked by At

I am using Spring Cloud Data Flow to orchestrate the execution of tasks applications, and need to run each task app in it's dedicated namespace with it's own resource quota (some may be Guaranteed and some Burstable).

Following the guide at Spring Cloud Data Flow Tasks Configuration, and using the timestamp-task docker image I have the following config in my server-config.yml

    spring:
      cloud:
        dataflow:
          task:
            platform:
              kubernetes:
                accounts:
                  default:
                    limits:
                      memory: 1024Mi
                  my-dedicated-ns:
                    namespace: my-dedicated-ns
                    imagePullPolicy: Always
                    limits:
                      memory: 2048Mi

However when I launch the task with the argument --platformName=my-dedicated-ns the task still executes in the default namespace in which scdf is running (I called it spring-cloud-dataflow).

Looking at the execution details, I see that -

--platformName: my-dedicated-ns
--spring.cloud.data.flow.platformname: default
--spring.cloud.task.executionid: 9

Question -

  • How can I get the task to run in my-dedicated-ns namespace?
  • what is spring.cloud.data.flow.platformname and is it relevant? I try setting it in the task arguments but it always shows up as default.

Edit: Running kubectl describe on the task pod I get -

kubectl describe pod/timestamp-task-9n5xq9o8y0
...
Name:         timestamp-task-9n5xq9o8y0
Namespace:    spring-cloud-dataflow

...

Containers:
  timestamp-task-z95kxp4r84:
    
    Image:         springcloudtask/timestamp-task
    
    Args:
      --platformName=my-dedicated-ns
      --spring.cloud.data.flow.platformname=default
      --spring.cloud.task.executionid=7

Which suggests Spring Cloud Data Flow server always runs tasks in the same namespace, if so what is --platformName for?

1

There are 1 answers

0
Zubin Kavarana On BEST ANSWER

Platform name works just fine, I had to restart the Spring Cloud Data Flow server for the new namespace definition under

spring:
      cloud:
        dataflow:
          task:
            platform:
              kubernetes:
                accounts:

to take effect.