kubernetes-helm

kubernetes-helm

helm

Helm入门(一篇就够了) - 知乎

1
2
3
在 k8s 中,我们很多时候需要部署很多个应用,特别是微服务的项目,如果每个服务部署都需要使用kubectl apply依次执行,这将是一件很痛苦的事
这个时候,如果一键部署所有应用,使用 Helm (https://helm.sh)是一个很不错的选择
Helm本质就是一个k8s的包管理器
1
2
3
4
5
Helm的工作流程总结如下:
开发者首先创建并编辑chart的配置;
接着打包并发布至Helm的仓库(Repository);
当管理员使用helm命令安装时,相关的依赖会从仓库下载;
接着helm会根据下载的配置部署资源至k8s。

安装helm

1
首先需要在本地机器或Kubernetes集群上安装Helm

Repository

1
存储Helm Charts的地方

Chart

1
一个Helm包,其中包含了运行一个应用所需要的镜像、依赖和资源定义等,还可能包含Kubernetes集群中的服务定义,类似Homebrew中的formula、APT的dpkg或者Yum的rpm文件

创建chart

1
2
3
4
5
6
7
使用helm create命令创建一个新的Chart,Chart目录包含描述应用程序的文件和目录,包括Chart.yaml、values.yaml、templates目录等
heml create wordpress
wordpress/
Chart.yaml
values.yaml
templates/
charts/

配置Chart

1
Chart.yaml包含Chart的元数据和依赖项

Chart.yaml

1
2
~~~
#### Values.yaml

values.yaml包含应用程序的默认配置值

1
#### Template

使用Go模板语言生成Kubernetes对象的定义文件
在模板中引入values.yaml里的配置,在模板文件中可以通过 .VAlues对象访问到

1
#### 打包Chart

使用helm package命令将Chart打包为一个tarball文件,例如在wordpress目录中使用helm package命令将Chart打包为一个tarball文件,这将生成一个名为wordpress-0.1.0.tgz的tarball文件:
helm package wordpress/

1
#### 发布Chart

将打包好的Chart发布到一个Helm Repository中。可以使用 helm repo add 命令添加一个Repository,然后使用helm push命令将Chart推送到Repository中,例如:
helm repo add myrepo https://example.com/charts
helm repo list
helm push wordpress-0.1.0.tgz myrepo

1
#### 安装Release

使用helm install命令安装Chart的Release,可以通过命令行选项或指定values.yaml文件来配置Release,例如:
helm install mywordpress myrepo/wordpress
这将在Kubernetes集群中创建一个名为mywordpress的Release,包含WordPress应用程序和MySQL数据库

1
#### 管理Release

使用helm ls命令查看当前运行的Release列表,例如:
helm upgrade mywordpress myrepo/wordpress –set image.tag=5.7.3-php8.0-fpm-alpine
这将升级 mywordpress 的WordPress应用程序镜像版本为5.7.3-php8.0-fpm-alpine

1
2
3
4
~~~
可以使用helm rollback命令回滚到先前版本,例如:
helm rollback mywordpress 1
这将回滚mywordpress的版本到1

values

1
Helm Chart的参数,用于配置Kubernetes对象

Release

1
Chart在k8s上运行的Chart的一个实例,例如,如果一个MySQL Chart想在服务器上运行两个数据库,可以将这个Chart安装两次,并在每次安装中生成自己的Release以及Release名称

Namespace

1
Kubernetes中用于隔离资源的逻辑分区

helm

快速入门指南 | Helm

快速入门指南

helm repo add xx

1
2
添加一个chart 仓库
$ helm repo add bitnami https://charts.bitnami.com/bitnami

helm search repo xx

1
2
3
4
5
6
7
8
当添加完成,您将可以看到可以被您安装的charts列表:
$ helm search repo bitnami
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/bitnami-common 0.0.9 0.0.9 DEPRECATED Chart with custom templates used in ...
bitnami/airflow 8.0.2 2.0.0 Apache Airflow is a platform to programmaticall...
bitnami/apache 8.2.3 2.4.46 Chart for Apache HTTP Server
bitnami/aspnet-core 1.2.3 3.1.9 ASP.NET Core is an open-source framework create...
# ... and many more

helm repo update | helm install xx

1
2
3
4
5
6
7
8
9
10
$ helm repo update              # 确定我们可以拿到最新的charts列表

$ helm install bitnami/mysql --generate-name
NAME: mysql-1612624192
LAST DEPLOYED: Sat Feb 6 16:09:56 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES: ...

helm show chart xx | helm show all xx

1
您可以通过执行 helm show chart bitnami/mysql 命令简单的了解到这个chart的基本信息。 或者您可以执行 helm show all bitnami/mysql 获取关于该chart的所有信息。

关于版本发布

helm list
1
2
3
4
5
6
7
8
9
10
通过Helm您可以很容易看到哪些chart被发布了:
$ helm list

[lium@VM-0-10-tencentos liuk]$ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
dagster dagster-app 1 2026-02-06 16:47:42.669458351 +0800 CST deployed dagster-v0.0.1-release release

~ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
dagster dagster-app-test 5 2026-02-26 14:32:30.773016232 +0800 CST deployed dagster-0.0.1-dev-git dev

卸载一个版本

helm uninstall xx
1
2
3
4
5
6
7
8
您可以使用helm uninstall 命令卸载你的版本
$ helm uninstall mysql-1612624192
该命令会从Kubernetes卸载 mysql-1612624192, 它将删除和该版本相关的所有相关资源(service、deployment、 pod等等)甚至版本历史。

如果您在执行 helm uninstall 的时候提供 --keep-history 选项, Helm将会保存版本历史。 您可以通过命令查看该版本的信息
$ helm status mysql-1612624192
Status: UNINSTALLED
...
helm list -n xx
1
helm list -n "$namespace"
helm upgrade
1
2
3
4
helm upgrade dagster $env -n "$namespace" \
--values "$values_file" \
--wait \
--timeout 1m \

使用helm

三大概念

1
2
3
4
5
Chart代表着Helm包。它包含在 Kubernetes 集群内部运行应用程序,工具或服务所需的所有资源定义。

Repository(仓库) 是用来存放和共享 charts 的地方。

Release 是运行在 Kubernetes 集群中的 chart 的实例。一个 chart 通常可以在同一个集群中安装多次。每一次安装都会创建一个新的 release。以 MySQL chart为例,如果你想在你的集群中运行两个数据库,你可以安装该chart两次。每一个数据库都会拥有它自己的 release 和 release name。
1
Helm 安装 charts 到 Kubernetes 集群中,每次安装都会创建一个新的 release

查找 Charts

helm search chart仓库名
1
2
3
4
Helm 自带一个强大的搜索命令,可以用来从两种来源中进行搜索:
helm search hub 从 Artifact Hub 中查找并列出 helm charts。 Artifact Hub中存放了大量不同的仓库。

helm search repo 从你添加(使用 helm repo add)到本地 helm 客户端中的仓库中进行查找。该命令基于本地数据进行搜索,无需连接互联网。
helm search chart仓库名 chart
1
2
3
4
5
6
7
8
9
10
11
12
helm search hub wordpress
从你所添加的仓库中查找chart的名字

$ helm repo add brigade https://brigadecore.github.io/charts
"brigade" has been added to your repositories

$ helm search repo brigade
Helm 搜索使用模糊字符串匹配算法,所以你可以只输入名字的一部分

$ helm search repo kash
NAME CHART VERSION APP VERSION DESCRIPTION
brigade/kashti 0.4.0 v0.4.0 A Helm chart for Kubernetes

安装一个 helm 包

helm install 名字 chart
1
2
使用 helm install 命令来安装一个新的 helm 包。最简单的使用方法只需要传入两个参数:你命名的release名字和你想安装的chart的名称
helm install happy-panda bitnami/wordpress
1
现在wordpress chart 已经安装。注意安装chart时创建了一个新的 release 对象。上述发布被命名为 happy-panda。 (如果想让Helm生成一个名称,删除发布名称并使用--generate-name。)
helm status xx
1
2
3
Helm 客户端不会等到所有资源都运行才退出。许多 charts 需要大小超过 600M 的 Docker 镜像,可能需要很长时间才能安装到集群中。
你可以使用 helm status 来追踪 release 的状态,或是重新读取配置信息:
$ helm status happy-panda
1
2
3
4
5
helm install 命令可以从多个来源进行安装:
chart 的仓库(如上所述)
本地 chart 压缩包(helm install foo foo-0.1.1.tgz)
解压后的 chart 目录(helm install foo path/to/foo)
完整的 URL(helm install foo https://example.com/charts/foo-1.2.3.tgz)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ helm status happy-panda
NAME: happy-panda
LAST DEPLOYED: Tue Jan 26 10:27:17 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
** Please be patient while the chart is being deployed **

Your WordPress site can be accessed through the following DNS name from within your cluster:

happy-panda-wordpress.default.svc.cluster.local (port 80)

To access your WordPress site from outside the cluster follow the steps below:
1
2
3
4
5
6
7
8
9
10
11
12
13
[lium@VM-0-10-tencentos liuk]$ helm status dagster
NAME: dagster
LAST DEPLOYED: Fri Feb 6 16:47:42 2026
NAMESPACE: dagster-app
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Launched. You can access the Dagster webserver/UI by running the following commands:

export DAGSTER_WEBSERVER_POD_NAME=$(kubectl get pods --namespace dagster-app -l "app.kubernetes.io/name=dagster,app.kubernetes.io/instance=dagster,component=dagster-webserver" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to open the Dagster UI"
kubectl --namespace dagster-app port-forward $DAGSTER_WEBSERVER_POD_NAME 8080:80

安装前自定义 chart

1
2
3
上述安装方式只会使用 chart 的默认配置选项。很多时候,我们需要自定义 chart 来指定我们想要的配置。

使用 helm show values 可以查看 chart 中的可配置选项:
helm show values xx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ helm show values bitnami/wordpress
## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
# global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass

## Bitnami WordPress image version
## ref: https://hub.docker.com/r/bitnami/wordpress/tags/
##
image:
registry: docker.io
repository: bitnami/wordpress
tag: 5.6.0-debian-10-r35
[..]
1
2
3
4
5
6
然后,你可以使用 YAML 格式的文件覆盖上述任意配置项,并在安装过程中使用该文件。

$ echo '{mariadb.auth.database: user0db, mariadb.auth.username: user0}' > values.yaml
$ helm install -f values.yaml bitnami/wordpress --generate-name

上述命令将为 MariaDB 创建一个名称为 user0 的默认用户,并且授予该用户访问新建的 user0db 数据库的权限。chart 中的其他默认配置保持不变。
helm get values xx
1
2
3
4
5
安装过程中有两种方式传递配置数据:

--values (或 -f):使用 YAML 文件覆盖配置。可以指定多次,优先使用最右边的文件。
--set:通过命令行的方式对指定项进行覆盖。
如果同时使用两种方式,则 --set 中的值会被合并到 --values 中,但是 --set 中的值优先级更高。在--set 中覆盖的内容会被被保存在 ConfigMap 中。可以通过 helm get values <release-name> 来查看指定 release 中 --set 设置的值。也可以通过运行 helm upgrade 并指定 --reset-values 字段来清除 --set 中设置的值。
--set 的格式和限制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--set name=value
name: value

--set a=b,c=d
a: b
c: d

--set outer.inner=value
outer:
inner: value

--set name={a, b, c}
name:
- a
- b
- c
1
2
3
4
某些name/key可以设置为null或者空数组,例如 --set name=[],a=null

name: []
a: null
helm repo list
1
2
3
[lium@VM-0-10-tencentos liuk]$ helm repo list
NAME URL
changan-map https://changan-map.tencentcloudcr.com/chartrepo/train

升级 release 和失败时恢复

helm upgrade -f xx.yaml xx xx
1
2
3
4
5
6
7
8
当你想升级到 chart 的新版本,或是修改 release 的配置,你可以使用 helm upgrade 命令。

一次升级操作会使用已有的 release 并根据你提供的信息对其进行升级。由于 Kubernetes 的 chart 可能会很大而且很复杂,Helm 会尝试执行最小侵入式升级。即它只会更新自上次发布以来发生了更改的内容。

$ helm upgrade -f panda.yaml happy-panda bitnami/wordpress

在上面的例子中,happy-panda 这个 release 使用相同的 chart 进行升级,但是使用了一个新的 YAML 文件:
mariadb.auth.username: user1
1
2
3
4
5
6
我们可以使用 helm get values 命令来看看配置值是否真的生效了:

$ helm get values happy-panda
mariadb:
auth:
username: user1
helm rollback xxx
1
2
3
现在,假如在一次发布过程中,发生了不符合预期的事情,也很容易通过 helm rollback [RELEASE] [REVISION] 命令回滚到之前的发布版本。

$ helm rollback happy-panda 1
helm history xxx
1
上面这条命令将我们的 happy-panda 回滚到了它最初的版本。release 版本其实是一个增量修订(revision)。 每当发生了一次安装、升级或回滚操作,revision 的值就会加1。第一次 revision 的值永远是1。我们可以使用 helm history [RELEASE] 命令来查看一个特定 release 的修订版本号

安装、升级、回滚时的有用选项

1
2
3
4
--timeout:一个 Go duration 类型的值, 用来表示等待 Kubernetes 命令完成的超时时间,默认值为 5m0s。
--wait:表示必须要等到所有的 Pods 都处于 ready 状态,PVC 都被绑定,Deployments 都至少拥有最小 ready 状态 Pods 个数(Desired减去 maxUnavailable),并且 Services 都具有 IP 地址(如果是LoadBalancer, 则为 Ingress),才会标记该 release 为成功。最长等待时间由 --timeout 值指定。如果达到超时时间,release 将被标记为 FAILED。注意:当 Deployment 的 replicas 被设置为1,但其滚动升级策略中的 maxUnavailable 没有被设置为0时,--wait 将返回就绪,因为已经满足了最小 ready Pod 数。
--no-hooks:不运行当前命令的钩子。
--recreate-pods(仅适用于 upgrade 和 rollback):这个参数会导致重建所有的 Pod(deployment中的Pod 除外)。(在 Helm 3 中已被废弃)

卸载 release

helm uninstall xx
1
2
3
4
5
6
7
8
9
10
使用 helm uninstall 命令从集群中卸载一个 release:

$ helm uninstall happy-panda
该命令将从集群中移除指定 release。你可以通过 helm list 命令看到当前部署的所有 release:

$ helm list
NAME VERSION UPDATED STATUS CHART
inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0.1.0

从上面的输出中,我们可以看到,happy-panda 这个 release 已经被卸载。
1
在上一个 Helm 版本中,当一个 release 被删除,会保留一条删除记录。而在 Helm 3 中,删除也会移除 release 的记录。 如果你想保留删除记录,使用 helm uninstall --keep-history。使用 helm list --uninstalled 只会展示使用了 --keep-history 删除的 release。
helm list –all
1
2
3
4
5
6
7
8
9
helm list --all 会展示 Helm 保留的所有 release 记录,包括失败或删除的条目(指定了 --keep-history):

$ helm list --all
NAME VERSION UPDATED STATUS CHART
happy-panda 2 Wed Sep 28 12:47:54 2016 UNINSTALLED wordpress-10.4.5.6.0
inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0.1.0
kindred-angelf 2 Tue Sep 27 16:16:10 2016 UNINSTALLED alpine-0.1.0

注意,因为现在默认会删除 release,所以你不再能够回滚一个已经被卸载的资源了。

使用仓库

helm repo list | add | list
1
2
3
4
5
6
7
8
9
Helm 3 不再附带一个默认的 chart 仓库。helm repo 提供了一组命令用于添加、列出和移除仓库。

使用 helm repo list 来查看配置的仓库

使用 helm repo add 来添加新的仓库

因为 chart 仓库经常在变化,在任何时候你都可以通过执行 helm repo update 命令来确保你的 Helm 客户端是最新的。

使用 helm repo remove 命令来移除仓库

创建你自己的

helm create xx
1
2
3
4
5
6
7
8
可以通过使用 helm create 命令来快速开始:

$ helm create deis-workflow
Creating deis-workflow

现在,./deis-workflow 目录下已经有一个 chart 了。你可以编辑它并创建你自己的模版。

在编辑 chart 时,可以通过 helm lint 验证格式是否正确。
helm package xx
1
2
3
4
当准备将 chart 打包分发时,你可以运行 helm package 命令:

$ helm package deis-workflow
deis-workflow-0.1.0.tgz
1
2
3
4
5
6
然后这个 chart 就可以很轻松的通过 helm install 命令安装:

$ helm install deis-workflow ./deis-workflow-0.1.0.tgz
...

打包好的 chart 可以上传到 chart 仓库中

案例

deploy.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
# deploy_dagster_enhanced.sh

# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# 打印带颜色的消息
print_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
print_error() { echo -e "${RED}[ERROR]${NC} $1"; }

# 检查 helm 是否安装
check_helm() {
if ! command -v helm &> /dev/null; then
print_error "Helm 未安装,请先安装 Helm"
exit 1
fi
}
# 检查当前目录是否有 Chart.yaml
check_chart() {
if [ ! -f "Chart.yaml" ]; then
print_error "当前目录未找到 Chart.yaml 文件"
print_info "请确保在 Helm Chart 目录中运行此脚本"
exit 1
fi
}

# 检查命名空间是否存在
check_namespace() {
local namespace=$1
if kubectl get namespace "$namespace" &> /dev/null; then
return 0
else
return 1
fi
}

# 部署到指定环境
deploy_to_env() {
local env=$1
local namespace=""
local values_file=""

case $env in
"dev")
namespace="dagster-app-test"
values_file="values.yaml"
;;
"release")
namespace="dagster-app"
values_file="values.yaml"
;;
"release_tmp")
namespace="dagster-app-tmp"
values_file="values.yaml"
;;
*)
print_error "未知环境: $env"
return 1
;;
esac

print_info "开始部署到 $env 环境 (命名空间: $namespace)"

# cd "$(pwd)/$env"
# check_chart

# 检查是否已存在 dev
if helm list -n "$namespace" | grep -q "dagster"; then
print_warning "发现已存在的 $env 'dagster'"
read -p "是否执行升级 (upgrade) 而不是安装 (install)? (y/n): " upgrade_choice
if [[ $upgrade_choice =~ ^[Yy]$ ]]; then
print_info "执行 helm upgrade..."
if [ -f "$values_file" ]; then
helm upgrade dagster $env -n "$namespace" \
--values "$values_file" \
--wait \
--timeout 1m \
# --atomic
else
helm upgrade dagster $env -n "$namespace" \
--wait \
--timeout 1m \
# --atomic
fi
else
print_info "执行 helm install..."
helm install dagster $env -n "$namespace" \
--create-namespace \
--wait \
--timeout 1m \
# --atomic
fi
else
# 安装新 release
print_info "执行 helm install...1"
if [ -f "$values_file" ]; then
helm install dagster $env -n "$namespace" \
--create-namespace \
--wait \
--timeout 1m \
--values "$values_file"
else
helm install dagster $env -n "$namespace" \
--create-namespace \
--wait \
--timeout 1m \
# --atomic
fi
fi

if [ $? -eq 0 ]; then
print_success "$env 环境部署成功!"
print_info "查看资源状态: kubectl get all -n $namespace"
print_info "查看 release 状态: helm list -n $namespace"
print_info "查看 Pod 状态: kubectl get pods -n $namespace -w"
else
print_error "$env 环境部署失败!"
return 1
fi
}

# 显示部署状态
show_status() {
local namespace=$1
print_info "=== 部署状态检查 ==="

echo -e "\n1. Helm Release 状态:"
helm list -n "$namespace"

echo -e "\n2. Pod 状态:"
kubectl get pods -n "$namespace" --no-headers | while read line; do
pod_name=$(echo $line | awk '{print $1}')
status=$(echo $line | awk '{print $3}')
if [[ "$status" == "Running" ]]; then
echo -e "${GREEN}✓${NC} $pod_name: $status"
else
echo -e "${RED}✗${NC} $pod_name: $status"
fi
done

echo -e "\n3. Service 状态:"
kubectl get svc -n "$namespace"

echo -e "\n4. Ingress 状态:"
kubectl get ingress -n "$namespace" 2>/dev/null || echo "未配置 Ingress"
}

# 主菜单
main_menu() {
clear
echo "======================================"
echo " Dagster 部署管理工具 "
echo "======================================"
echo ""
echo "请选择操作:"
echo "1) 部署到 dev 环境 (测试)"
echo "2) 部署到 release 环境 (生产)"
echo "3) 部署到 release_tmp 环境 (生产tmp)"
echo "4) 查看 dev 环境状态"
echo "5) 查看 release 环境状态"
echo "6) 查看 release_tmp 环境状态"
echo "7) 卸载 dev 环境"
echo "8) 卸载 release 环境"
echo "9) 卸载 release_tmp 环境"
echo "10) 退出"
echo ""


read -p "请输入选项 (1-8): " choice

case $choice in
1)
deploy_to_env "dev"
read -p "按回车键返回主菜单..."
main_menu
;;
2)
# 生产环境额外确认
print_warning "⚠️ 即将部署到生产环境!"
read -p "确认部署到生产环境? (请输入 'yes' 确认): " confirm
if [[ "$confirm" == "yes" ]]; then
deploy_to_env "release"
else
print_info "取消生产环境部署"
fi
read -p "按回车键返回主菜单..."
main_menu
;;
3)
# 生产环境额外确认
print_warning "⚠️ 即将部署到生产环境tmp!"
read -p "确认部署到生产环境tmp? (请输入 'yes' 确认): " confirm
if [[ "$confirm" == "yes" ]]; then
deploy_to_env "release_tmp"
else
print_info "取消生产环境tmp部署"
fi
read -p "按回车键返回主菜单..."
main_menu
;;
4)
show_status "dagster-app-test"
read -p "按回车键返回主菜单..."
main_menu
;;
5)
show_status "dagster-app"
read -p "按回车键返回主菜单..."
main_menu
;;
6)
show_status "dagster-app-tmp"
read -p "按回车键返回主菜单..."
main_menu
;;
7)
print_warning "即将卸载 dev 环境"
read -p "确认卸载? (y/n): " confirm
if [[ $confirm =~ ^[Yy]$ ]]; then
helm uninstall dagster -n dagster-app-test
# kubectl delete namespace dagster-app-test --wait=false
print_success "dev 环境已卸载"
fi
read -p "按回车键返回主菜单..."
main_menu
;;
8)
print_warning "⚠️ 即将卸载生产环境!"
read -p "确认卸载生产环境? (请输入 'confirm' 确认): " confirm
if [[ "$confirm" == "confirm" ]]; then
helm uninstall dagster -n dagster-app
print_success "生产环境已卸载"
else
print_info "取消卸载"
fi
read -p "按回车键返回主菜单..."
main_menu
;;
9)
print_warning "⚠️ 即将卸载生产环境tmp!"
read -p "确认卸载生产环境? (请输入 'confirm' 确认): " confirm
if [[ "$confirm" == "confirm" ]]; then
helm uninstall dagster -n dagster-app-tmp
print_success "生产环境已卸载"
else
print_info "取消卸载"
fi
read -p "按回车键返回主菜单..."
main_menu
;;
10)
print_info "退出部署工具"
exit 0
;;

*)
print_error "无效选项"
sleep 1
main_menu
;;
esac
}

# 初始化检查
init_check() {
check_helm
print_success "环境检查完成"
print_info "Helm 版本: $(helm version --short)"
print_info "Kubectl 上下文: $(kubectl config current-context)"
echo ""
}

# 主程序
main() {
init_check
main_menu
}

# 运行主程序
main

chart.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
apiVersion: v2
name: dagster
version: v0.0.1-release
kubeVersion: ">= 1.18.0-0"
description: The data orchestration platform built for productivity.
type: application
keywords:
- analytics
- data-orchestrator
- data-pipelines
- etl
- workflow
# sources:
# - https://github.com/dagster-io/dagster/tree/master/helm/dagster
dependencies:
- name: dagster-user-deployments
version: v1.1
condition: dagster-user-deployments.enableSubchart
- name: postgresql
version: 8.1.0
repository: ""
condition: postgresql.enabled
- name: rabbitmq
version: 6.16.3
repository: ""
condition: rabbitmq.enabled
- name: redis
version: 12.7.4
repository: ""
condition: redis.internal
maintainers:
- name: Spatio-temporal data group
email: support@dagsterlabs.com
url: https://dagster.io/about
icon: https://dagster.io/images/brand/logos/dagster-primary-mark.png
appVersion: release

values.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
# README:
# - 若对镜像使用固定标签,将镜像拉取策略改为"Always"以外的任何设置,都将使用缓存/过期镜像。
# - 我们建议为用户代码镜像使用唯一标签,这可确保Docker镜像在流水线的整个执行过程中保持一致。
---
global:
postgresqlSecretName: "dagster-postgresql-secret"
# DAGSTER_HOME环境变量默认会在此值基础上在所有节点上设置
dagsterHome: "/opt/dagster/dagster_home"

# 此图表及所有子图表使用的服务账户名称。若设置此值,则dagster子图表将不会创建各自独立的服务账户。
serviceAccountName: ""
storageClass: cbs-dagster-app
# 用于传递Celery消息代理和后端连接URL的密钥名称。
# 通常可保留默认值,但在下方将generateCeleryConfigSecret设置为false时,此配置会很有用。
celeryConfigSecretName: "dagster-celery-config-secret"

nameOverride: ""
fullnameOverride: ""
rbacEnabled: true
#指定密钥,以基于私有仓库中的镜像来运行容器
imagePullSecrets:
- name: tenc-secret
####################################################################################################
# Dagster Webserver: Dagster Web 服务的配置
####################################################################################################
dagsterWebserver:
replicaCount: 1
image:
# 当未为 Dagster 提供的镜像指定标签时,将默认使用 Helm 图表版本作为版本。
repository: "changan-map.tencentcloudcr.com/train/dagster-celery-k8s"
tag: "1.11.9"
pullPolicy: Always

# 支持覆盖 Web 服务 Pod 的名称前缀
nameOverride: "dagster-webserver"

# 支持路径前缀(例如:/dagster)
pathPrefix: ~

service:
type: ClusterIP
# 定义 Web 服务用于处理请求的端口;如果修改此端口,请务必同时更新下方的 livenessProbe 和 startupProbe 配置项。
port: 80
annotations: {}

#为 Web 服务定义一个工作区。此设置仅在满足以下条件时配置:已启用用户部署,但禁用了子图表以便在独立的 Helm Release 中管理用户部署。
#在此情况下,Web 服务需要获知代码服务器的地址以加载用户代码,或者需要一个现有 ConfigMap 的名称,将其挂载为工作区文件。
workspace:
enabled: false

# 要包含在工作区文件中的服务器列表。设置此配置时,externalConfigmap 必须为空。
servers:
- host: "skdata-code"
port: 3030
name: "user-code-example"

#定义一个在 Helm Release 之外预置的 ConfigMap 的名称,该 ConfigMap 将被用作工作区文件。设置此配置时,servers 必须为空。
externalConfigmap: ~

# 以 --read-only 模式部署一个独立的 Web 服务实例(在此模式下,无法启动运行、将禁用调度器等)。
enableReadOnly: false

# 设置发送至 Dagster 实例的数据库语句的超时时间(以毫秒为单位)。
dbStatementTimeout: ~

#设置 SQLAlchemy 连接池中连接的最大存活时间(以秒为单位)。如果未设置,默认值为 1 小时。设置为 -1 则表示禁用此限制。
dbPoolRecycle: ~

# 设置 SQLAlchemy 连接池的最大溢出大小。设置为 -1 则表示禁用溢出功能。
dbPoolMaxOverflow: ~

# 设置 Uvicorn Web 服务器的日志级别。如果未设置,默认级别为 "warning"。
logLevel: ~

# 需要设置的其他环境变量。
# 这些变量将直接应用于 Daemon 容器。 https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
#
# Example:
#
# env:
# - name: ENV_ONE
# value: "one"
# - name: ENV_TWO
# value: "two"
env: []

# 可以从 ConfigMap 中获取并设置其他环境变量. See:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
#
# Example:
#
# envConfigMaps:
# - name: config-map
envConfigMaps: []

# 可以从 Secret 中获取并设置其他环境变量。See:
# https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
#
# Example:
#
# envSecrets:
# - name: secret
envSecrets: []

# 应包含在 Deployment 上的其他标签。 See:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my-label-key: my_label-value
deploymentLabels: {}

# 应包含在 Pod 上的其他标签。 See:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my-label-key: my_label-value
labels: {}

# 应包含的其他存储卷. See:
# https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core
#
# Example:
#
# volumes:
# - name: my-volume
# configMap: my-config-map
volumes: []

# 应包含的其他存储卷挂载. See:
# See: https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
#
# Example:
#
# volumeMounts:
# - name: test-volume
# mountPath: /opt/dagster/test_folder
# subPath: test_file.yaml
volumeMounts: []

# 应作为 Web 服务的 Sidecar 运行的其他容器. See:
# https://kubernetes.io/docs/concepts/workloads/pods/#how-pods-manage-multiple-containers
# 对于 1.29 之后的 Kubernetes 版本 See:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# Example:
# extraContainers:
# - name: my-sidecar
# image: busybox
extraContainers: []

# 应在 Web 服务的初始化容器之前运行的其他初始化容器(例如 Sidecar)。对于 Kubernetes 1.29 之后的版本,see:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# 额外的初始化容器会在测试数据库连接之前启动. #
# Example:
# extraPrependedInitContainers:
# - name: my-sidecar
# image: busybox
extraPrependedInitContainers: []

# 支持通过节点选择器、亲和性及容忍度来配置 Web 服务 Pod 的调度分配。 See:
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
annotations: {}
nodeSelector: {}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "10.226.0.15"
- "10.226.0.10"
tolerations: []
podSecurityContext: {}
securityContext: {}
resources:
requests:
memory: "4Gi"
cpu: "4000m"
limits:
memory: "8Gi"
cpu: "6000m"

# 为初始化容器单独配置资源,使其与主容器配置分离
initContainerResources: {}

# 启用用于检查数据库就绪状态的初始化容器
checkDbReadyInitContainer: true

# 覆盖默认的 K8s 调度器
# schedulerName: ~

# 如需指定资源,请取消注释以下行,按需调整其值,并删除 'resources:' 后的大括号
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# 就绪探针用于检测 Pod 何时准备就绪,可以开始处理请求。
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
readinessProbe:
httpGet:
path: "/server_info"
port: 80
periodSeconds: 20
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 3

#自 0.14.0 版本起,存活探针默认处于禁用状态。如果您希望启用它们,建议同时启用启动探针
livenessProbe: {}
startupProbe:
enabled: false

####################################################################################################
# 计算日志管理器: 计算日志管理器的配置。
#
# 默认情况下,系统将 NoOpComputeLogManager 设置为计算日志管理器。因此,Dagster UI 中将无法查看 stdout 和 stderr 日志。
# 要改变此行为,请选择一个带有存储后端的计算日志管理器,以捕获并持久化 stdout 和 stderr 日志。
#
# See https://docs.dagster.io/deployment/dagster-instance#compute-log-storage for more information.
####################################################################################################
computeLogManager:
# Type can be one of [
# NoOpComputeLogManager,
# AzureBlobComputeLogManager,
# GCSComputeLogManager,
# S3ComputeLogManager,
# LocalComputeLogManager,
# CustomComputeLogManager,
# ]
type: NoOpComputeLogManager
config: {}
## Uncomment this configuration if the AzureBlobComputeLogManager is selected
# azureBlobComputeLogManager:
# storageAccount: ~
# container: ~
# secretCredential: ~
# defaultAzureCredential: ~
# accessKeyOrSasToken: ~
# localDir: ~
# prefix: ~
# uploadInterval: ~
# showUrlOnly: ~
## Uncomment this configuration if the GCSComputeLogManager is selected
# gcsComputeLogManager:
# bucket: ~
# localDir: ~
# prefix: ~
# jsonCredentialsEnvvar: ~
# uploadInterval: ~
## 如果选择了 S3ComputeLogManager,请取消此部分的注释
# s3ComputeLogManager:
# bucket: ~
# localDir: ~
# prefix: ~
# useSsl: ~
# verify: ~
# verifyCertPath: ~
# endpointUrl: ~
# skipEmptyFiles: ~
# uploadInterval: ~
# uploadExtraArgs: {}
## Uncomment this configuration if the LocalComputeLogManager is selected
# localComputeLogManager:
# baseDir: ~
# pollingTimeout: ~
## Uncomment this configuration if the CustomComputeLogManager is selected.
## Using this setting requires a custom webserver image that defines the user specified
## compute log manager in an installed python module.
# customComputeLogManager:
# module: ~
# class: ~
# config: {}

pythonLogs: {}
## 应被捕获为 Dagster 日志的 Python 日志记录器名称。
# managedPythonLoggers:
# - foo_logger
## Dagster 实例的日志级别。严重程度低于此级别的日志将被忽略。可选值之一:[NOTSET, DEBUG, INFO, WARNING, WARN, ERROR, FATAL, CRITICAL]
# pythonLogLevel: INFO
## 将应用于所有 Dagster 日志的 Python 日志处理器。
# dagsterHandlerConfig:
# handlers:
# myHandler:
# class: logging.FileHandler
# filename: "/logs/my_dagster_logs.log"
# mode: "a"

####################################################################################################
# 用户代码部署: 用于配置将通过 gRPC 服务器加载的用户代码容器。
# 对于 "deployments" 列表中的每一项,系统都会创建一个 K8s Deployment 和一个 K8s Service,用以运行 gRPC 服务器。
# Dagster Web 服务与此 gRPC 服务器通信,以获取定义信息和当前的镜像信息。
# 这些部署可以独立于 Dagster Web 服务进行更新,并且 Web 服务将为所有执行任务拉取当前的镜像。
# 当使用分布式执行器(例如 Celery-K8s)执行作业时,当前的镜像信息将被查询一次,并在该次运行中的所有 Op 执行中使用。
# 为了确保一次作业执行内的所有 Op 执行都使用相同的镜像,我们建议使用唯一的标签(即,不要使用 "latest")。
#
# 所有的用户代码都将在这些镜像中被调用.
####################################################################################################
dagster-user-deployments:
# 创建一个工作区文件,其中包含用于托管您用户代码的 gRPC 服务器信息.
enabled: true

# 如果您计划在独立的 Helm Release 中部署用户代码,请将此值设置为 false。
enableSubchart: true

# 指定密钥,以便基于私有仓库中的镜像来运行用户代码服务器容器. See:
# https://kubernetes.io/docs/concepts/containers/images/#referring-to-an-imagepullsecrets-on-a-pod
# imagePullSecrets:
# - name: tenc-secret

# 独立部署列表
deployments:
- name: "skdata-code"
image:
# 当未提供标签时,它将默认使用 Helm 图表版本作为标签。
#"changan-map.tencentcloudcr.com/train/spatiotemporal-data-production_system"
repository: "changan-map.tencentcloudcr.com/train/spatiotemporal-data-production_system"
tag: 'v0.0.4'

# 请谨慎修改! 如果您为流水线运行镜像使用了固定标签,将镜像拉取策略更改为 "Always" 以外的任何策略,
# 都将导致使用已缓存/过期的镜像,这几乎肯定不是您想要的结果。
pullPolicy: Always

# 传递给 dagster api grpc 命令的参数.
# 例如:命令 "dagster api grpc -m dagster_test.test_project.test_jobs.repo -a define_demo_execution_repo"
# 将转化为以下配置:
# dagsterApiGrpcArgs:
# - "-m"
# - "dagster_test.test_project.test_jobs.repo"
# - "-a"
# - "define_demo_execution_repo"
#
#键 dagsterApiGrpcArgs 也可以替换为 codeServerArgs,
#以使用新的实验性命令 dagster code-server start 来替代 dagster api grpc。
# 新命令支持在 Dagster UI 内重新加载定义,而无需重启用户代码部署的 Pod。 # codeServerArgs:
codeServerArgs:
- "-m"
- "workspace.definitions"
- "--working-directory"
- "/workspace"
# - "--python-file"
# - "definitions.py"
port: 3030

#是否将为此用户代码部署指定的配置,包含在从该部署启动的运行任务 Pod 中。
includeConfigInLaunchedRuns:
enabled: true

# 需要设置的其他环境变量。这些变量将直接应用于守护进程容器。 See
# https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
#
# Example:
#
# env:
# - name: ENV_ONE
# value: "one"
# - name: ENV_TWO
# value: "two"
env:
- name: ENV_NAME
value: auto

# 可以从 ConfigMap 中获取并设置其他环境变量。 See:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
#
# Example:
#
# envConfigMaps:
# - name: config-map
envConfigMaps: []

# 可以从 Secret 中获取并设置其他环境变量. See:
# https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
#
# Example:
#
# envSecrets:
# - name: secret
envSecrets: []

# 应包含的其他标签. See:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my-label-key: my_label-value
labels: {}

# 应包含的其他存储卷。See:
# https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core
#
# Example:
#
volumes:
# - name: git-code-volume
# emptyDir: {}
- name: app-volume
emptyDir: {}
# configMap:
# name: my-config-map
# volumes: []

# 应包含的其他存储卷挂载。 See:
# See: https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
#
# Example:
#
# volumeMounts:
# # - name: git-code-volume
# # mountPath: /code/app
# - name: app-volume
# mountPath: /workspace
# subPath: test_file.yaml
# volumeMounts: []

# 在主容器运行前需要执行的初始化容器。 See:
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
initContainers: []
# initContainers:
# - name: git-clone
# image: changan-map.tencentcloudcr.com/train/git:v2.36.2
# command:
# - "/bin/sh"
# - "-c"
# - |
# echo "开始拉取代码..."
# mkdir -p /workspace && cd /workspace
# git init
# git remote add origin http://9room:ca%40123456@10.0.0.29:9091/9room/spatiotemporal-data-project.git
# git config core.sparsecheckout true
# mkdir -p .git/info/
# echo 'production_system/src/*' >> .git/info/sparse-checkout
# git fetch --filter=blob:none origin dev_lm
# git checkout dev_lm
# mv production_system/src/* ./
# rm -rf production_system
# echo "完成拉取..."
# ls -la /workspace
# volumeMounts:
# - name: app-volume
# mountPath: /workspace
# - name: app-volume
# mountPath: /workspace # cp -R /code/app/production_system/src/* /workspace

# 与主容器一同运行的其他容器(例如 Sidecar)。See:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# Example:
#
# sidecarContainers:
# - name: my-sidecar
# image: ...
# volumeMounts: []
# env: []
# sidecarContainers:
# - name: git-sync
# image: changan-map.tencentcloudcr.com/train/git-sync:4.4
# args:
# - --repo=http://9room:ca%40123456@10.0.0.29:9091/9room/spatiotemporal-data-project.git
# - --branch=dev_lm
# - --depth=1
# - --period=30s
# - --root=/git
# - --link=current
# - --wait=2
# volumeMounts:
# - name: git-code-volume
# mountPath: /git
# # - name: app-volume
# # mountPath: /workspace
# resources:
# requests:
# memory: "64Mi"
# cpu: "50m"
# limits:
# memory: "128Mi"
# cpu: "100m"
annotations: {}
nodeSelector: {}
affinity: {}
tolerations: []
podSecurityContext: {}
securityContext: {}
resources:
requests:
memory: "1Gi"
cpu: "800m"
limits:
memory: "8Gi"
cpu: "8000m"

# 覆盖默认的 K8s 调度器
# schedulerName: ~

# 就绪探针用于检测 Pod 何时准备就绪,可以开始处理请求.
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
readinessProbe:
# 就绪探针默认处于启用状态.
enabled: true
# 如果 readinessProbe 未定义 exec 字段,则将使用以下默认命令:
# exec:
# command: ["dagster", "api", "grpc-health-check", "-p", "{{ $deployment.port }}"]
periodSeconds: 20
timeoutSeconds: 10
successThreshold: 1
# 默认情况下,允许大约 300 秒的启动时间
failureThreshold: 1

# 自 0.14.0 版本起,存活探针默认处于禁用状态。如果您希望启用它们,建议同时启用启动探针
livenessProbe: {}
startupProbe:
enabled: false
# 用新 Pod 替换旧 Pod 时遵循的策略。 See:
# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
deploymentStrategy: {}

service:
annotations: {}

####################################################################################################
# 调度器: 调度器的配置
####################################################################################################
scheduler:
# Type can be one of [
# DagsterDaemonScheduler,
# CustomScheduler,
# ]
type: DagsterDaemonScheduler
config: #{}
## 此配置仅在选择了 DagsterDaemonScheduler 时生效。
daemonScheduler:
maxCatchupRuns: 5
maxTickRetries: 0

## 此配置仅在选择了 CustomScheduler 时生效。使用此设置需要一个自定义的 Web 服务镜像,该镜像需在一个已安装的 Python 模块中定义用户指定的调度器。
# customScheduler:
# module: ~
# class: ~
# config: {}

####################################################################################################
# Run Launcher: 运行启动器的配置。
####################################################################################################
runLauncher:
# 类型可为以下之一:[K8sRunLauncher, CeleryK8sRunLauncher, CustomRunLauncher]
type: K8sRunLauncher

config:
# 此配置仅在选择了 K8sRunLauncher 时生效。
k8sRunLauncher:
# 请谨慎修改! 如果您为流水线运行镜像使用了固定标签,
# 将镜像拉取策略更改为 "Always" 以外的任何策略,都将导致使用已缓存/过期的镜像,这几乎肯定不是您想要的结果
imagePullPolicy: "Always"

## 用于已启动 Job 中 Dagster 容器的镜像。pullPolicy 字段已被忽略,请改用 imagePullPolicy
# image:
# repository: ""
# tag: ""
# pullPolicy: Always

# 用于启动新 Job 的 Kubernetes 命名空间。默认情况下,将使用 Helm Release 所在的命名空间。
jobNamespace: dagster-app

# 设置为 true 以从集群内部加载 kubeconfig。
loadInclusterConfig: true

# 用于加载 kubeconfig 的文件路径。仅当 loadInclusterConfig 为 false 时,才设置此值。
kubeconfigFile: ~

# 可以从 ConfigMap 中为 Job 获取并设置其他环境变量。 See:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
#
# Example:
#
# envConfigMaps:
# - name: config-map
envConfigMaps: []

# 可以从 Secret 中为 Job 获取并设置其他环境变量。 See:
# https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
#
# Example:
#
# envSecrets:
# - name: secret
envSecrets: []

# 可以将现有环境中的其他变量传递到 Job 中。
#
# Example:
#
# envVars:
# - "FOO_ENV_VAR" (Will pull the value of FOO_ENV_VAR from the calling process)
# - "BAR_ENV_VAR=baz_value" (Will set the value of BAR_ENV_VAR to baz_value)
envVars: []

# 应包含在 Job 的 Pod 中的其他存储卷。 See:
# https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core
#
# Example:
#
# volumes:
# - name: my-volume
# configMap: my-config-map
volumes: []

# 应包含在 Job 的 Pod 内容器中的其他存储卷挂载。 See:
# See: https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
#
# Example:
#
# volumeMounts:
# - name: test-volume
# mountPath: /opt/dagster/test_folder
# subPath: test_file.yaml
volumeMounts: []

# 应包含在 Job 的 Pod 中的其他标签 See:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my_label_key: my_label_value
labels: {}

# Job 的 Pod 中容器的默认计算资源需求。See:
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
#
# Example:
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
resources: {}

# 覆盖启动的 Pod 的默认 Kubernetes 调度器
# schedulerName: ~

# 如果 Dagster 运行失败,启动的 Kubernetes Jobs 和 Pods 是否应该失败。
failPodOnRunFailure: false

# 容器的安全设置。 See
# https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-capabilities-for-a-container
securityContext: ~

# 为运行创建的 Kubernetes Job 和 Pod 的原始 k8s 配置。
# See: https://docs.dagster.io/deployment/guides/kubernetes/customizing-your-deployment
#
# Example:
# runK8sConfig:
# containerConfig: # raw config for the pod's main container
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# podTemplateSpecMetadata: # raw config for the pod's metadata
# annotations:
# mykey: myvalue
# podSpecConfig: # raw config for the spec of the launched's pod
# nodeSelector:
# disktype: ssd
# jobSpecConfig: # raw config for the kubernetes job's spec
# ttlSecondsAfterFinished: 7200
# jobMetadata: # raw config for the kubernetes job's metadata
# annotations:
# mykey: myvalue
runK8sConfig:
# containerConfig: # raw config for the pod's main container
# resources:
# limits:
# cpu: 1000m
# memory: 512Mi
jobSpecConfig: # raw config for the kubernetes job's spec
ttlSecondsAfterFinished: 7200

# 此配置仅在选择了 CeleryK8sRunLauncher 时生效
celeryK8sRunLauncher:
# 请谨慎修改!如果您为流水线运行镜像使用了固定标签,将镜像拉取策略更改为 "Always" 以外的任何策略,将使用缓存/过期的镜像,这几乎肯定不是您想要的结果。
imagePullPolicy: "Always"

# Celery workers 可以使用固定镜像部署(不包含用户代码)
image:
# 当未为 Dagster 提供的镜像提供标签时,它将默认使用 Helm 图表版本。
repository: "changan-map.tencentcloudcr.com/train/dagster-celery-k8s"
tag: '1.11.9'
pullPolicy: Always

# 将启动新 Job 的 Kubernetes 命名空间。
# 默认情况下,使用 release 命名空间。
jobNamespace: ~

# 支持覆盖 Celery worker Pod 的名称前缀
nameOverride: "celery-workers"

# Celery 的额外配置选项,应用于所有队列。
# 这些可以在下面按队列覆盖。关于可用选项,参见:
# https://docs.celeryq.dev/en/stable/userguide/configuration.html
configSource: {}

# 可以在此处配置额外的 Celery worker 队列。覆盖时,请确保配置一个 "dagster" worker 队列,因为这是 Dagster 使用的默认队列。
#
# 可选地,可以在 Celery 队列的 workers 上设置标签和节点选择器。
# 指定队列的节点选择器将覆盖任何现有的节点选择器默认值。
# configSource 将与上面共享的 configSource 合并。
workerQueues:
- name: "dagster"
replicaCount: 2
labels: {}
nodeSelector: {}
configSource: {}
additionalCeleryArgs: []

# 在 celery/job 容器上设置的额外环境变量
# 将使用这些环境变量创建一个 Kubernetes ConfigMap。参见:
# https://kubernetes.io/docs/concepts/configuration/configmap/
#
# Example:
#
# env:
# ENV_ONE: one
# ENV_TWO: two
env: {}

# 可以从 ConfigMap 中获取并设置其他环境变量。参见:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
#
# Example:
#
# envConfigMaps:
# - name: config-map
envConfigMaps: []

# 可以从 Secret 中获取并设置其他环境变量。参见:
# https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
#
# Example:
#
# envSecrets:
# - name: secret
envSecrets: []

annotations: {}

# 为所有 Celery 队列设置默认的节点选择器。
# See:
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
nodeSelector: {}

# 支持 Celery Pod 分配的亲和性和容忍度。参见。
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "10.226.0.15"
- "10.226.0.10"
tolerations: []
podSecurityContext: {}
securityContext: {}

# 指定资源.
# Example:
#
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
resources: {}

# 启用 check-db-ready 初始化容器
checkDbReadyInitContainer: true
# 覆盖默认的 K8s 调度器
# schedulerName: ~

# 如果 `livenessProbe` 不包含 `exec` 字段,那么我们将默认使用:
# exec:
# command:
# - /bin/sh
# - -c
# - dagster-celery status -A dagster_celery_k8s.app -y {{ $.Values.global.dagsterHome }}/celery-config.yaml | grep "${HOSTNAME}:.*OK"
livenessProbe:
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 3

# 应包含在 Job 的 Pod 中的其他存储卷。参见:
# https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core
#
# Example:
#
# volumes:
# - name: my-volume
# configMap: my-config-map
volumes: []

# 应包含在 Job 的 Pod 内容器中的其他存储卷挂载。参见:
# See: https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
#
# Example:
#
# volumeMounts:
# - name: test-volume
# mountPath: /opt/dagster/test_folder
# subPath: test_file.yaml
volumeMounts: []

# 应包含在 Job 的 Pod 中的其他标签。参见:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my_label_key: my_label_value
labels: {}

# 如果 Dagster 运行失败,启动的 Kubernetes Jobs 和 Pods 是否应该失败。
failPodOnRunFailure: false

## 取消此配置的注释,仅当选择了 CustomRunLauncher 时使用。
## 使用此设置需要一个自定义的 webserver 镜像,该镜像在一个已安装的 python 模块中定义了用户指定的运行启动器。
# customRunLauncher:
# module: ~
# class: ~
# config: {}

####################################################################################################
# PostgreSQL: postgresql 的配置值
#
# https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
#
# 在 Kubernetes 上运行 Dagster 需要 PostgreSQL 数据库。如果 postgresql.enabled 被标记为
# false,此处指定的 PG 凭据仍将被使用,并且应指向可从此图表访问的外部 PG 数据库。
####################################################################################################
postgresql:
# 将 postgresql.enabled 设置为 false 以禁用 PostgreSQL 数据库的部署并使用现有的外部 PostgreSQL 数据库
enabled: false

# 由初始化容器使用以检查数据库是否正在运行。(即使 enabled:false)
image:
registry: "changan-map.tencentcloudcr.com"
repository: "train/postgres"
tag: "14.6"
pullPolicy: IfNotPresent

# 使用外部 PostgreSQL 数据库时设置此 PostgreSQL 主机名
postgresqlHost: "10.226.0.13"

postgresqlUsername: skdata

# 注意在更改此密码时(例如在测试中),只要 PVC 存在,凭据就会持续存在 -- 参见:
# https://github.com/helm/charts/issues/12836#issuecomment-524552358
postgresqlPassword: Skdata@123

postgresqlDatabase: dgaster_server_data

# 设置连接字符串的 postgresql 参数字段。
# see: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
postgresqlParams: {}

# 设置时,覆盖连接字符串的默认 `postgresql` 模式。
# (例如,设置为 `postgresql+pg8000` 以使用 `pg8000` 库)。
# See: https://docs.sqlalchemy.org/en/13/dialects/postgresql.html#dialect-postgresql
postgresqlScheme: ""

service:
port: 5432

# 是否为 PostgreSQL 密码生成一个 secret 资源。如果 global.postgresqlSecretName 在此 helm 图表之外管理,这将很有用。
generatePostgresqlPasswordSecret: true

# 如果为 true,helm 图表将为您创建一个包含 Celery 代理和后端连接 URL 的 secret,包括可选的 Redis 或 RabbitMQ 密码。如果您想
# 自己管理包含 Celery 代理/后端连接字符串的 secret,请将其设置为 false。如果您自己管理secret,
# 该 secret 应具有在 global.celeryConfigSecretName 中指定的名称,并且应在 DAGSTER_CELERY_BROKER_URL 键中包含代理 URL,在
# DAGSTER_CELERY_BACKEND_URL 键中包含后端 URL。
generateCeleryConfigSecret: true

####################################################################################################
# RabbitMQ: rabbitmq 的配置值。只应启用 RabbitMQ / Redis 其中之一。
####################################################################################################
rabbitmq:
enabled: false

image:
registry: "changan-map.tencentcloudcr.com"
repository: "train/rabbitmq"
tag: "3.8.2-r35"
pullPolicy: IfNotPresent

rabbitmq:
username: test
password: test

service:
port: 5672

# https://github.com/helm/charts/issues/17250#issuecomment-533444837
volumePermissions:
enabled: true
image:
registry: "changan-map.tencentcloudcr.com"
repository: "train/minideb"
tag: "stretch"
pullPolicy: IfNotPresent
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "10.226.0.15"
- "10.226.0.10"
resources:
requests:
memory: "1Gi"
cpu: "800m"
limits:
memory: "2Gi"
cpu: "1000m"

####################################################################################################
# Redis: Redis 的配置值。可以用来代替 RabbitMQ。
####################################################################################################
redis:
# 要使用 redis 代替 rabbitmq,将 `enabled` 设置为 true。
enabled: false

# 要通过 helm 管理 redis,将 `internal` 设置为 `true`。要使用外部 redis,将 `internal` 设置为 `false`。
# 注意:如果 `internal` 为 true,那么无论 `enabled` 标志如何,都会创建 redis pod。
internal: false
image:
registry: changan-map.tencentcloudcr.com
repository: train/redis
tag: "6.0.10"
pullPolicy: IfNotPresent

usePassword: false
password: "test"

# Redis 主机 URL
host: ""

# Redis 端口
port: 6379

# 设置 Redis 代理数据库的 DB 编号(默认 0)
brokerDbNumber: 0

# 设置 Redis 后端数据库的 DB 编号(默认 0)
backendDbNumber: 0

# 如果您的 Redis 连接需要配置选项,您可以使用此字段指定
# 确切的连接 URL,而不是根据 Helm 值构建。
brokerUrl: ""
backendUrl: ""

####################################################################################################
# Flower: (可选)用于诊断和调试 Celery 队列和工作进程的 flower web 界面
####################################################################################################
flower:
enabled: false

image:
repository: "changan-map.tencentcloudcr.com/train/flower"
tag: "0.9.5"
pullPolicy: Always

service:
type: ClusterIP
annotations: {}
port: 5555

# 支持 Flower Pod 分配的节点选择器、亲和性和容忍度。参见:
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
annotations: {}
nodeSelector: {}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "10.226.0.15"
- "10.226.0.10"
tolerations: []
podSecurityContext: {}
securityContext: {}

# 启用 check-db-ready 初始化容器
checkDbReadyInitContainer: true
# 覆盖默认的 K8s 调度器
# schedulerName: ~

resources:
limits:
cpu: 800m
memory: 1024Mi
requests:
cpu: 500m
memory: 500Mi
# resources: {}
# 如果要指定资源,请取消注释以下行,根据需要调整它们,并删除 'resources:' 后面的大括号。
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# 存活探针检测何时重启 flower。
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
livenessProbe:
tcpSocket:
port: "flower"
# initialDelaySeconds: 60
periodSeconds: 20
failureThreshold: 3

# 启动探针(在 kubernetes v1.16+ 中可用)在 Pod 启动时使用。一旦成功,存活探针就会接管。
# 如果在 kubernetes < v1.16 上,则注释掉 `startupProbe` 行,并取消注释`livenessProbe` 下的 `initialDelaySeconds: 60`
startupProbe:
tcpSocket:
port: "flower"
periodSeconds: 10
failureThreshold: 6

####################################################################################################
# Ingress:(可选)为 Dagster webserver 和 Flower 创建 ingress
####################################################################################################
ingress:
enabled: false

annotations: {}
labels: {}

# 指定用于实现此 ingress 的 IngressClass。
#
# See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
ingressClassName: ~

dagsterWebserver:
# Webserver 的 Ingress 主机名,例如 dagster.mycompany.com此变量允许自定义 ingress 中的路由模式。一些ingress 控制器可能只支持 "/",而有些可能需要 "/*"。
path: "/*"
pathType: ImplementationSpecific
# 注意:请勿保留尾部斜杠。对于根配置,设置为空字符串
# See: https://github.com/dagster-io/dagster/issues/2073
host: ""

tls:
enabled: false
secretName: ""

# 在默认 webserver 路径之前添加到 ingress 的不同 http 路径
# Example:
#
# precedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
precedingPaths: []

# 在默认 webserver 路径之后添加到 ingress 的不同 http 路径
# Example:
#
# succeedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
succeedingPaths: []

readOnlyDagsterWebserver:
# 只读 webserver 的 Ingress 主机名,例如 viewer.dagster.mycompany.com此变量允许自定义 ingress 中的路由模式。
# 一些ingress 控制器可能只支持 "/",而有些可能需要 "/*"。
path: "/*"
pathType: ImplementationSpecific
# 注意:请勿保留尾部斜杠。对于根配置,设置为空字符串
# See: https://github.com/dagster-io/dagster/issues/2073
host: ""

tls:
enabled: false
secretName: ""

# 在默认 webserver 路径之前添加到 ingress 的不同 http 路径
# Example:
#
# precedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
precedingPaths: []

# 在默认 webserver 路径之后添加到 ingress 的不同 http 路径
# Example:
#
# succeedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
succeedingPaths: []

flower:
# Flower 的 Ingress 主机名,例如 flower.mycompany.com
host: ""
# 如果路径是 '/flower',Flower 将在 'mycompany.com/flower' 可访问
# 注意:请勿保留尾部斜杠。对于根配置,设置为空字符串
path: ""
pathType: ImplementationSpecific

tls:
enabled: false
secretName: ""

# 在默认 flower 路径之前添加到 ingress 的不同 http 路径
# 示例:
#
# precedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
precedingPaths: []

# 在默认 flower 路径之后添加到 ingress 的不同 http 路径
# 示例:
#
# succeedingPaths:
# - path: "/*"
# pathType: ImplementationSpecific
# serviceName: "ssl-redirect"
# servicePort: "use-annotation"
succeedingPaths: []

####################################################################################################
# Dagster Daemon(可选)部署一个守护进程,用于启动队列中的运行以及运行调度器和传感器
#
# 默认情况下,此守护进程包含在您的部署中,并用于运行调度器和传感器。
# 将 `enabled` 设置为 false 将停止守护进程包含在您的部署中。
#
# 守护进程中的每个线程定期发送心跳以指示它仍在运行。设置 `heartbeatTolerance` 允许您配置每个线程在没有发送心跳的情况下可以运行多长时间,
# 之后守护进程确定某个线程一定已挂起并重新启动该进程。
#
# 在 `runCoordinator` 中设置 `config.queuedRunCoordinator.maxConcurrentRuns` 允许您设置
# 可以同时执行的最大运行数限制。
####################################################################################################
dagsterDaemon:
enabled: true

image:
# 当未为 Dagster 提供的镜像提供标签时,它将默认使用 Helm 图表版本作为标签。
repository: "changan-map.tencentcloudcr.com/train/dagster-celery-k8s"
tag: "1.11.9"
pullPolicy: Always

heartbeatTolerance: 1800

runCoordinator:
# 是否启用运行队列(或某些其他自定义运行协调器)。参见
# https://docs.dagster.io/deployment/run-coordinator for more information.
enabled: true

# Type can be one of [
# QueuedRunCoordinator,
# CustomRunCoordinator,
# ]
type: QueuedRunCoordinator
config:
queuedRunCoordinator:
# 允许同时运行的最大运行数。默认为无限制。
maxConcurrentRuns: 81
# 基于标签的并发限制。参见 See https://docs.dagster.io/deployment/run-coordinator#usage
# for examples.
tagConcurrencyLimits:
- key: auto_daily_task
limit: 10
- key: clip_task
limit: 20
- key: use_gpu
limit: 50
- key: analysis_task
limit: 1
# 从队列中拉取新运行并启动的检查频率(以秒为单位)。
# Defaults to 5.
dequeueIntervalSeconds: ~
# 是否使用异步线程池来出队运行,允许多个运行并行出队。
dequeueUseThreads: true
# 出队运行时使用的最大工作线程数。可以调整以允许更多运行并行出队,但可能需要为守护进程分配更多资源。
dequeueNumWorkers: 4

## 如果选择了 CustomRunCoordinator,请取消此配置的注释。
## 使用此设置需要一个自定义的 Daemon 镜像,该镜像在一个已安装的 python 模块中定义了用户指定的运行协调器。
# customRunCoordinator:
# module: ~
# class: ~
# config: {}

# 启用对运行工作进程 Pod 的监控。如果运行在超时时间内未启动,它将被标记为失败。
# 如果运行已启动但随后运行工作进程崩溃,监控守护进程将要么使运行失败,要么尝试使用新的运行工作进程恢复运行。
runMonitoring:
enabled: true
# T运行启动的超时时间(避免运行卡在 STARTING 状态)
startTimeoutSeconds: 300
# 运行取消的超时时间(避免运行卡在 CANCELING 状态)
# cancelTimeoutSeconds: 300
# 运行完成的超时时间(避免运行卡在 RUNNING 状态)
# maxRuntimeSeconds: 7200
# 检查正在进行的运行的频率
pollIntervalSeconds: 120
# [实验性] 尝试使用新的运行工作进程恢复运行的最大次数,而不是在运行工作进程崩溃时使运行失败。仅适用于使用
# `k8s_job_executor` 在每个 Kubernetes 作业中运行每个 op 的运行。要启用,请将此值
# 设置为大于 0 的值。
maxResumeRunAttempts: 0
# [实验性] 运行以成功/失败/取消状态结束后,在释放可能保留的任何并发槽之前等待的秒数。
freeSlotsAfterRunEndSeconds: 0

runRetries:
enabled: true
maxRetries: 0

sensors:
# 是否使用异步线程池评估传感器,允许传感器并行执行
useThreads: true
# 评估传感器时使用的最大工作线程数。可以调整以允许更多传感器并行运行,但可能需要为守护进程分配更多资源。
numWorkers: 4
# 取消注释以使用线程池并行提交来自单个传感器 tick 的运行。可以用于在传感器在单个 tick 内发出多个运行请求时减少延迟。
# numSubmitWorkers: 4

schedules:
# 是否使用异步线程池评估调度器,允许调度器并行执行
useThreads: true
# 评估调度器时使用的最大工作线程数。可以调整以允许更多调度器并行运行,但可能需要为守护进程分配更多资源。
numWorkers: 4
# 取消注释以使用线程池并行提交来自单个调度器 tick 的运行。可以用于在调度器在单个 tick 内发出多个运行请求时减少延迟。
# numSubmitWorkers: 4

# 取消注释以配置回填守护进程。
# 警告:版本在 1.9.7 之前的代码部署不支持此配置,可能会失败。
# More details: https://github.com/dagster-io/dagster/pull/30189#issuecomment-2930805760
# backfills:
# 是否使用异步线程池提交回填,允许回填运行并行入队
# useThreads: true
# 提交回填时使用的最大工作线程数。可以调整以允许更多回填并行运行,但可能需要为守护进程分配更多资源。
# numWorkers: 4
# 取消注释以使用线程池并行提交来自回填的运行。可以用于在回填入队许多运行请求时减少延迟。
# numSubmitWorkers: 4

# 要设置的额外环境变量。
# 这些将直接应用于守护进程容器。参见
# https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
#
# Example:
#
# env:
# - name: ENV_ONE
# value: "one"
# - name: ENV_TWO
# value: "two"
env: []

# 可以从 ConfigMap 中获取并设置其他环境变量。参见:
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
#
# Example:
#
# envConfigMaps:
# - name: config-map
envConfigMaps: []

# 可以从 Secret 中获取并设置其他环境变量。参见:
# https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
#
# Example:
#
# envSecrets:
# - name: secret
envSecrets: []

# 应包含在 Deployment 上的其他标签。参见:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# deploymentLabels:
# my-label-key: my_label-value
deploymentLabels: {}

# 应包含在 Pod 上的其他标签。参见:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
#
# Example:
# labels:
# my-label-key: my_label-value
labels: {}

# 应包含的其他存储卷。参见:
# https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core
#
# Example:
#
# volumes:
# - name: my-volume
# configMap: my-config-map
volumes: []

# 应包含的其他存储卷挂载。参见:
# See: https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
#
# Example:
#
# volumeMounts:
# - name: test-volume
# mountPath: /opt/dagster/test_folder
# subPath: test_file.yaml
volumeMounts: []

# 应作为守护进程的 Sidecar 运行的其他容器。参见:
# https://kubernetes.io/docs/concepts/workloads/pods/#how-pods-manage-multiple-containers
# For K8s versions after 1.29, prefer using extraPrependedInitContainers instead. See:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# Example:
# extraContainers:
# - name: my-sidecar
# image: busybox
extraContainers: []

# 应在守护进程的初始化容器之前运行的其他初始化容器(例如 Sidecar)。
# 对于 Kubernetes 1.29 之后的版本,参见:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# 额外的初始化容器会在测试数据库连接之前启动。
#
# Example:
# extraPrependedInitContainers:
# - name: my-sidecar
# image: busybox
extraPrependedInitContainers: []

annotations: {}
nodeSelector: {}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "10.226.0.15"
- "10.226.0.10"
tolerations: []
podSecurityContext: {}
securityContext: {}
resources:
requests:
memory: "4Gi"
cpu: "4000m"
limits:
memory: "8Gi"
cpu: "6000m"

# 为初始化容器单独配置资源,使其与主容器配置分离
initContainerResources: {}
# 启用 check-db-ready 初始化容器
checkDbReadyInitContainer: true
# 覆盖默认的 K8s 调度器
# schedulerName: ~

# 自 0.14.0 版本起,存活探针默认处于禁用状态。如果您希望启用它们,建议同时启用启动探针。
livenessProbe: {}
readinessProbe: {}
startupProbe: {}

####################################################################################################
#busybox:用于检查连接的 busybox 镜像的配置
####################################################################################################
busybox:
image:
repository: "changan-map.tencentcloudcr.com/train/busybox"
tag: "1.28"
pullPolicy: "IfNotPresent"

####################################################################################################
# 额外清单:(可选)在此图表内创建额外的 k8s 资源
####################################################################################################
extraManifests:
# # 为命名空间设置默认容器资源请求/限制
# # * 要为 dagster 系统容器覆盖这些;编辑此 values.yaml 的资源部分 - 例如:webserver.resources & celery.resources
# # * 要在 solid 执行容器中覆盖这些;添加一个 @solid(tag=) 类似于:{ "dagster-k8s/config": { "container_config": { "resources": {....
# - apiVersion: v1
# kind: LimitRange
# metadata:
# name: default-container-resources
# spec:
# limits:
# - default:
# cpu: 250m
# memory: 512Mi
# defaultRequest:
# cpu: 100m
# memory: 256Mi
# type: Container
# # Example 2:
# - apiVersion: cloud.google.com/v1beta1
# kind: BackendConfig
# metadata:
# name: "{{ .Release.Name }}-backend-config"
# labels:
# {{- include "dagster.labels" . | nindent 6 }}
# spec:
# securityPolicy:
# name: "gcp-cloud-armor-policy-test"

####################################################################################################
# Dagster 实例迁移:创建一个作业来迁移您的实例。此字段应仅在一次性设置中启用。
#
# 有关更多详细信息,请参见:
# https://docs.dagster.io/deployment/guides/kubernetes/how-to-migrate-your-instance
####################################################################################################
migrate:
enabled: false

# 应作为迁移作业的 Sidecar 运行的其他容器。参见:
# https://kubernetes.io/docs/concepts/workloads/pods/#how-pods-manage-multiple-containers
# 对于 K8s 1.29 之后的版本,建议改用 initContainers 来使用原生 Sidecar。参见:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# Example:
# extraContainers:
# - name: my-sidecar
# image: busybox
extraContainers: []

# 应在主作业容器之前运行的初始化容器,例如原生 Sidecar。参见:
# https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
#
# Example:
# initContainers:
# - name: my-sidecar
# image: busybox
initContainers: []

####################################################################################################
# 作为一个开源项目,我们收集使用统计信息以更好地了解用户如何参与使用 Dagster 并为开发优先级提供信息。
#
# 遥测数据将推动项目,例如在产品常用部分添加功能,并将帮助我们了解新功能的采用情况。
#
# 有关更多详细信息,请参见:
# https://docs.dagster.io/getting-started/telemetry
####################################################################################################
telemetry:
enabled: true

serviceAccount:
create: true

# 指定图表中引用的服务账户的名称。请注意,设置全局服务账户名称将覆盖此字段。
name: ""

annotations: {}

####################################################################################################
# 为诸如调度器/传感器 ticks 之类的数据类型设置数据保留策略。
#
# 有关更多详细信息,请参见:
# https://docs.dagster.io/deployment/dagster-instance#data-retention
####################################################################################################
retention:
enabled: false
schedule:
# 对于调度器 ticks,指定多少天后可以删除 ticks。此字段可以是tick 类型到整数的字典,也可以是一个整数(适用于所有 tick 类型)。值为 -1
# 表示 ticks 应无限期保留。
purgeAfterDays: -1
sensor:
# 对于传感器 ticks,指定多少天后可以删除 ticks。此字段可以是tick 类型到整数的字典,也可以是一个整数(适用于所有 tick 类型)。
# 值为 -1表示 ticks 应无限期保留。
purgeAfterDays:
failure: -1
skipped: 7
started: -1
success: -1
autoMaterialize:
# 对于自动物化 ticks,指定多少天后可以删除 ticks。此字段可以是 tick 类型到整数的字典,
# 也可以是一个整数(适用于所有 tick类型)。值为 -1 表示 ticks 应无限期保留。
purgeAfterDays:
failure: -1
skipped: 7
started: -1
success: -1
####################################################################################################
# 实例上要配置的额外字段,这些字段尚未由上面的键确定。
# See https://docs.dagster.io/deployment/dagster-instance for the full set of available fields.
####################################################################################################
# Example:
#
# additionalInstanceConfig:
# auto_materialize: # See: https://docs.dagster.io/deployment/dagster-instance#auto-materialize
# run_tags:
# key: value
additionalInstanceConfig: {}

####################################################################################################
# [已弃用] 流水线运行
#
# 此配置现在可以通过 dagster-user-deployments 设置。
####################################################################################################
pipelineRun:
image:
# When a tag is not supplied for a Dagster provided image,
# it will default as the Helm chart version.
repository: "changan-map.tencentcloudcr.com/train/user-code-example"
tag: ~
pullPolicy: Always

# Additional environment variables to set.
# A Kubernetes ConfigMap will be created with these environment variables. See:
# https://kubernetes.io/docs/concepts/configuration/configmap/
#
# Example:
#
# env:
# ENV_ONE: one
# ENV_TWO: two
env: {}