在 kubernetes 中自动化 spring 云数据流创建和部署

automate spring cloud dataflow stream creation and deployment in kubernetes

我有一个示例 SCDF 数据流应用程序,它能够在 运行 中部署并获取它 kubernetes.But 我依靠数据流仪表板创建指向 docker 的应用程序图像,然后定义流并添加属性并部署 it.Now 我正在尝试自动执行在数据流服务器控制台中创建应用程序的手动步骤,创建流定义并部署它。是否有相同的示例项目或参考.

这里有几个选项。

1) 我们依靠民防部队的Java DSL to automate and acceptance-test the application registration, creation and deployment of streams and tasks on all the supported platforms. You will take spring-cloud-dataflow-rest-client as a dependency in your custom Java/Boot applications; with that, you could gain access to DataFlowOperations, which will allow you to perform all the actions that you can via Shell or the UI. Have a look at TickTockTests.java to get an idea. In fact, we use this pattern internally for our integration-tests, too (see: DockerComposeIT.java)。

2) REST API:您可以使用 stream/task 的 create, deploy/launch, or stream update APIs as part of your CI tooling and the workflows. You have the flexibility to either invoke them via scripts or by other means. This concept was presented at a webinar — 它可能会给您一些想法。

有几种方法可以使您的流创建和部署过程自动化。 Spring Cloud Data Flow Dashboard 只是 SCDF 服务器的 REST 客户端之一。 Spring Cloud Data Flow 生态系统提供了很少的其他 REST 客户端实现。

Shell interface: https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#shell

使用它,您可以创建一个包含所有流创建和部署命令的脚本文件。您可以从一个环境到另一个环境(比如开发到暂存到生产)执行此脚本。这种方法的唯一警告是,shell 命令发送的操作本质上大部分是 asynchronous,因此您需要添加显式检查或超时或睡眠以确保您 运行 shell 命令一步一步。

Java DSL

SCDF REST 客户端也有 Java DSL,如 here。您可以以编程方式创建流并使用显式应用程序部署它们。