-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_k8s_yaml.py
51 lines (45 loc) · 1.11 KB
/
gen_k8s_yaml.py
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
from jina import Deployment, Flow
#dir_name = './k8s_deployment'
ns_name = 'default'
## single excutor
#d = Deployment(port=8080, name='encoder', uses='docker://gabbro:30500/jina/clip-encoder')
#
#d.to_kubernetes_yaml(dir_name, k8s_namespace=ns_name)
## a flow
#f = (
# Flow(port=8080)
# .add(
# name='encoder',
# uses='docker://gabbro:30500/jina/clip-encoder',
## replicas=2,
# )
# .add(
# name='indexer',
# uses='docker://gabbro:30500/jina/indexer',
## shards=2,
# )
#)
### flow with traces and metrics
f = (
Flow(
tracing=True,
traces_exporter_host='http://localhost',
traces_exporter_port=4317,
metrics=True,
metrics_exporter_host='http://localhost',
metrics_exporter_port=4317,
port=8080,
)
.add(
name='encoder',
uses='docker://gabbro:30500/jina/clip-encoder',
# replicas=2,
)
.add(
name='indexer',
uses='docker://gabbro:30500/jina/indexer',
# shards=2,
)
)
dir_name = './k8s_flow_otlp'
f.to_kubernetes_yaml(dir_name, k8s_namespace=ns_name)