Skip to content

Commit 8bea946

Browse files
authored
Merge pull request #1096 from opencrvs/ocrvs-10672
fix: Moved all common tilt stuff to shared library
2 parents ca45723 + 5ab11b5 commit 8bea946

File tree

2 files changed

+18
-79
lines changed

2 files changed

+18
-79
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
- Restricted filesystem usage for journal service and file rotation strategy [#10518](https://github.com/opencrvs/opencrvs-core/issues/10518))
2626

27+
- Tiltfile: Improved Kubernetes support for development environment [#10672](https://github.com/opencrvs/opencrvs-core/issues/10672)
2728

2829
### Bug fixes
2930

Tiltfile

Lines changed: 17 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,31 @@
1-
############################################################
2-
# Please check readme at: https://github.com/opencrvs/infrastructure/tree/develop
3-
############################################################
4-
# Variables declaration:
5-
# Core images tag: usually "develop" or one of release name:
6-
# - v1.7.0
7-
# - v1.7.1
8-
# NOTE: It could take any value from https://github.com/orgs/opencrvs/packages
9-
# If you are under opencrvs-core repository, please use "local" tag
10-
# Tilt will build new image every time when changes are made to repository
11-
core_images_tag="develop"
1+
##########################################################################
2+
# Tiltfile: OpenCRVS Country config developer
3+
# For more information about variables, please check:
4+
# https://github.com/opencrvs/infrastructure/blob/develop/Tiltfile
125

13-
# Countryconfig/Farajaland image repository and tag
14-
# Usually image repository value is to your repository on DockerHub
15-
# If for some reason you don't have DockerHub account yet, please create
16-
# you local registry
17-
# (see: https://medium.com/@ankitkumargupta/quick-start-local-docker-registry-35107038242e)
6+
core_images_tag = "develop"
7+
# Build countryconfig image in local registry (use any name and tag you want)
188
countryconfig_image_name="opencrvs/ocrvs-countryconfig"
19-
# If you are under opencrvs-countryconfig or your own repository, please use "local" tag,
20-
# Tilt will build new image every time when changes are made to repository
219
countryconfig_image_tag="local"
2210

23-
# Namespaces:
24-
opencrvs_namespace = 'opencrvs-dev'
25-
dependencies_namespace = 'opencrvs-deps-dev'
26-
27-
28-
# Checkout infrastructure directory if not exists
11+
load('ext://git_resource', 'git_checkout')
2912
if not os.path.exists('../infrastructure'):
30-
local("git clone [email protected]:opencrvs/infrastructure.git ../infrastructure")
31-
32-
local_resource('README.md', cmd='awk "/For OpenCRVS Country Config Developers/{flag=1; next} /Seed data/{flag=0} flag" ../infrastructure/README.md', labels=['0.Readme'])
33-
34-
35-
# Load extensions for namespace and helm operations
36-
load('ext://helm_resource', 'helm_resource', 'helm_repo')
37-
load('ext://namespace', 'namespace_create', 'namespace_inject')
38-
load("../infrastructure/tilt/lib.tilt", "copy_secrets", "reset_environment", "seed_data")
39-
40-
include('../infrastructure/tilt/common.tilt')
41-
42-
# If your machine is powerful feel free to change parallel updates from default 3
43-
# update_settings(max_parallel_updates=3)
13+
# FIXME: Replace ocrvs-10672 to develop after testing
14+
git_checkout('[email protected]:opencrvs/infrastructure.git#ocrvs-10672', '../infrastructure')
15+
if not os.path.exists('../infrastructure/tilt/opencrvs.tilt'):
16+
fail('Something went wrong while cloning infrastructure repository!')
17+
load('../infrastructure/tilt/opencrvs.tilt', 'setup_opencrvs')
4418

4519
# Build countryconfig image
4620
docker_build(countryconfig_image_name, ".",
4721
dockerfile="Dockerfile",
4822
network="host")
4923

50-
# Create namespaces:
51-
# - opencrvs-deps-dev, dependencies namespace
52-
# - opencrvs-dev, main namespace
53-
namespace_create(dependencies_namespace)
54-
namespace_create(opencrvs_namespace)
55-
56-
57-
# Install Traefik GW
58-
# helm_repo('traefik-repo', 'https://traefik.github.io/charts', labels=['Dependencies'])
59-
# helm_resource(
60-
# 'traefik', 'traefik-repo/traefik', namespace='traefik', resource_deps=['traefik-repo'],
61-
# flags=['--values=../infrastructure/infrastructure/localhost/traefik/values.yaml'])
62-
63-
######################################################
64-
# OpenCRVS Dependencies Deployment
65-
# NOTE: This helm chart can be deployed as helm release
66-
k8s_yaml(helm('../infrastructure/charts/dependencies',
67-
namespace=dependencies_namespace,
68-
values=['../infrastructure/infrastructure/localhost/dependencies/values-dev.yaml']))
69-
70-
######################################################
71-
# OpenCRVS Deployment
72-
k8s_yaml(
73-
helm('../infrastructure/charts/opencrvs-services',
74-
namespace=opencrvs_namespace,
75-
values=['../infrastructure/infrastructure/localhost/opencrvs-services/values-dev.yaml'],
76-
set=[
77-
"image.tag={}".format(core_images_tag),
78-
"countryconfig.image.name={}".format(countryconfig_image_name),
79-
"countryconfig.image.tag={}".format(countryconfig_image_tag)
80-
]
81-
)
24+
setup_opencrvs(
25+
infrastructure_path='../infrastructure',
26+
core_images_tag=core_images_tag,
27+
countryconfig_image_name=countryconfig_image_name,
28+
countryconfig_image_tag=countryconfig_image_tag,
8229
)
8330

84-
#######################################################
85-
# Add Data Tasks to Tilt Dashboard
86-
reset_environment(opencrvs_namespace, opencrvs_configuration_file)
87-
88-
seed_data(opencrvs_namespace, opencrvs_configuration_file)
89-
90-
if security_enabled:
91-
copy_secrets(dependencies_namespace, opencrvs_namespace)
92-
9331
print("✅ Tiltfile configuration loaded successfully.")

0 commit comments

Comments
 (0)