-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommon.tilt
More file actions
108 lines (98 loc) · 2.86 KB
/
common.tilt
File metadata and controls
108 lines (98 loc) · 2.86 KB
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
############################################################
# What common Tiltfile does?:
# - Traefik deployment
# - Group resources by label on UI: http://localhost:10350/
########################################################
# Load extensions for namespace and helm operations
load('ext://namespace', 'namespace_create', 'namespace_inject')
load('ext://helm_resource', 'helm_resource', 'helm_repo')
secret_settings(disable_scrub=True)
########################################################
# Traefik Deployment
print("🚀 Deploying traefik...")
namespace_create('traefik')
traefik_tilt_label = '5.Traefik'
# Install Traefik GW
helm_repo('traefik-repo', 'https://traefik.github.io/charts', labels=[traefik_tilt_label])
helm_resource(
'traefik', 'traefik-repo/traefik', namespace='traefik', resource_deps=['traefik-repo'],
flags=['--values=../examples/localhost/traefik/values.yaml'])
# OpenCRVS application has traefik CRDs IngressRoute
# and Middleware, so we need to add traefik as dependency
# to all workloads that use them
traefik_deps = [
'auth',
'config',
'client',
'countryconfig',
'events',
'gateway',
'login',
'webhooks',
'minio',
]
k8s_resource("traefik", labels=[traefik_tilt_label])
# Add labels to traefik resources
traefik_ingress_objects = ["{}-route:ingressroute".format(dep) for dep in traefik_deps]
traefik_middleware_objects = ["sts-and-basic-response-headers:middleware", "enable-compression:middleware", "block-internal-routes:middleware"]
k8s_resource(
objects=traefik_ingress_objects,
new_name='traefik-ingress-routes',
resource_deps=['traefik'],
labels=[traefik_tilt_label]
)
k8s_resource(
objects=traefik_middleware_objects,
new_name='traefik-middleware',
resource_deps=['traefik'],
labels=[traefik_tilt_label]
)
######################################################
# Add labels to resources to OpenCRVS services
tilt_label = '4.Dependencies'
dependencies = [
'elasticsearch',
'mongodb',
'minio',
'influxdb',
'redis',
'postgres',
# 'postgres-on-deploy',
# FIXME: both resources are present only if security is enabled
# 'elasticsearch-on-deploy',
# 'mongo-on-deploy',
]
for workload in dependencies:
k8s_resource(workload, labels=[tilt_label])
######################################################
# Add labels to resources to OpenCRVS services
tilt_label = '1.OpenCRVS'
opensrvs_services = [
'auth',
'config',
'client',
'countryconfig',
'documents',
'events',
'gateway',
'hearth',
'login',
'metrics',
'notification',
'scheduler',
'search',
'user-mgnt',
'webhooks',
'workflow'
]
for workload in opensrvs_services:
k8s_resource(workload, labels=[tilt_label])
opensrvs_jobs = [
'postgres-on-deploy',
'data-migration',
'data-migration-analytics',
'elasticsearch-reindex',
]
job_label = '3.Jobs'
for workload in opensrvs_jobs:
k8s_resource(workload, labels=[job_label])