跳到主要内容

Dataflow

1. 概述

Dataflow 是 CSGHub 平台中的数据流管理与标注子系统,用于处理模型训练数据、标注任务、数据预处理与分发等流程。

通过 Helm Chart 部署,可以快速在 Kubernetes 环境中运行 Dataflow 及其依赖的 Label Studio、Redis、PostgreSQL、MongoDB 等组件。

本 Chart 既支持 一键安装全部依赖(内置模式),也支持 连接外部托管资源

2. 环境要求

项目说明
Kubernetes 版本v1.33+
Helm 版本v3.12+
网络要求集群节点需能访问 CSGHub 主服务(externalUrl)
权限要求具备创建命名空间、Service、PVC、Gateway 等资源的权限
集群要求需要支持 ReadWriteMany 的存储卷

3. 开始部署

  1. 添加 Helm 仓库

    helm repo add csghub https://charts.opencsg.com/csghub
    helm repo update
  2. 创建命名空间(可选)

    kubectl create namespace csghub
  3. 部署 Dataflow

    • externalUrl

      helm get notes csghub -n csghub | grep -A 6 'Access your CSGHub'

      通过以上命令获取 CSGHub 访问地址。

  • 执行部署操作

    💡 提示:

    • 国内部署添加:
      • --set global.image.registry="opencsg-registry.cn-beijing.cr.aliyuncs.com"
      • --set global.imageRegistry="opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsghq"

    注意:建议将自定义配置写入 custom-values.yaml,方便后续升级与版本管理。

    helm install dataflow csghub/dataflow \
    --namespace csghub \
    --create-namespace \
    --set global.gateway.external.domain="example.com" \
    --set externalUrl="<csghub externalUrl>" \
    --set dataflow.postgresql.database="csghub_dataflow" \
    --set labelStudio.postgresql.database="csghub_label_studio"

    此方式会自动启动:

    • Dataflow 主服务

    • Label Studio 标注服务

    • 内置 PostgreSQL、Redis、MongoDB

    • 内置 Gateway API Controller 控制器

4. 使用外部资源

建议在生产环境中使用外部托管数据库与缓存服务:

helm upgrade --install dataflow csghub/dataflow \
--namespace csghub \
--create-namespace \
--set dataflow.postgresql.database="csghub_dataflow" \
--set labelStudio.postgresql.database="csghub_label_studio" \
-f custom-values.yaml

示例 custom-values.yaml:

global:
gateway:
external:
domain: "company.com"
tls:
enabled: true
secretName: "csghub-tls"

postgresql:
enabled: false
external:
host: "pg.company.com"
port: 5432
user: "csghub"
password: "******"
sslmode: "require"

redis:
enabled: false
external:
host: "redis.company.com"
port: 6379
password: "******"

mongo:
enabled: false
external:
host: "mongo.company.com"
port: 27017
user: "admin"
password: "******"

externalUrl: "https://csghub.company.com"

5. 配置说明

5.1 全局配置

参数默认值说明
global.editionee部署版本:社区版(ce) / 企业版(ee)
global.gateway.external.domainexample.com访问域名
global.image.tagv1.16.0镜像版本号
global.persistence.size10Gi默认持久化卷大小
global.postgresql.enabledtrue启用内置 PostgreSQL
global.redis.enabledtrue启用内置 Redis
global.mongo.enabledtrue启用内置 MongoDB

5.2 服务配置

参数默认值说明
externalUrlhttps://csghub.example.comCSGHub 主系统访问地址
dataflow.image.repositoryopencsghq/dataflowDataflow 镜像
dataflow.image.tagv1.16.0镜像版本号
dataflow.persistence.size100Gi数据流持久化卷大小
dataflow.postgresql可覆盖默认 PostgreSQL 配置
dataflow.redis可覆盖默认 Redis 配置
dataflow.mongo可覆盖默认 MongoDB 配置

5.3 Label Studio配置

参数默认值说明
labelStudio.image.repositoryopencsghq/label-studioLabel Studio 镜像
labelStudio.image.tagv1.15.0镜像版本
labelStudio.persistence.size100Gi标注数据持久化卷大小
labelStudio.securityContext.runAsUser0容器运行用户 UID
labelStudio.postgresql.database"csghub_label_studio"标注数据库名

5.4 内置第三方组件

组件参数默认值说明
PostgreSQLpostgresql.image.repositoryopencsghq/postgres内置数据库镜像
postgresql.databases[csghub_dataflow, csghub_label_studio]启动时自动创建的数据库
postgresql.persistence.size50Gi持久化卷存储大小
Redisredis.image.repositoryredis
redis.persistence.size10Gi
MongoDBmongo.image.repositoryopencsghq/mongo
mongo.persistence.size10Gi

6. 验证部署

检查 Pod 状态:

kubectl get pods -n csghub

验证访问:

kubectl get svc -n csghub

功能验证需要对接到 CSGHub 。

7. 升级与卸载

7.1 升级 Chart

helm upgrade dataflow csghub/dataflow -n csghub -f custom-values.yaml

7.2 卸载 Chart

helm uninstall dataflow -n csghub-dataflow

8. 常见问题(FAQ)

问题原因解决方案
Dataflow 无法访问主系统externalUrl 未正确配置确认地址与 TLS 配置
Label Studio 启动失败数据库或 PVC 配置错误检查 PostgreSQL/Mongo 挂载路径
镜像拉取失败私有仓库未配置凭据添加 image.pullSecrets
Redis/Mongo 未启动与外部资源配置冲突禁用内置后重新部署