-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tiltfile
77 lines (66 loc) · 2.53 KB
/
Tiltfile
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
# -*- mode: Python -*-
config.define_string(
"helmchart-path",
args=False,
usage="Path to ICS Helm chart"
)
config.define_string(
"univention-project-username",
args=False,
usage="Username for Univention project at gitlab.souvap-univention.de"
)
config.define_string(
"gitlab-access-token",
args=False,
usage="Access token from gitlab.souvap-univention.de with read_registry scope"
)
cfg = config.parse()
helmchart_path = cfg.get("helmchart-path")
if not helmchart_path:
print("Please specify a path to the ICS Helm chart")
exit("No path specified")
univention_project_username = cfg.get("univention-project-username")
if not univention_project_username:
print("Please specify a username for the Univention project at gitlab.souvap-univention.de")
exit("No username specified")
gitlab_access_token = cfg.get("gitlab-access-token")
if not gitlab_access_token:
print("Please specify an access token from gitlab.souvap-univention.de with read_registry scope")
exit("No access token specified")
# Defaults to `gaia` cluster
allow_k8s_contexts('[email protected]')
namespace = k8s_namespace()
if namespace == 'default':
print("Please specify a namespace in the Kubeconfig")
exit("No namespace specified")
docker_build(
'registry.souvap-univention.de/souvap/tooling/images/intercom-service:development',
'intercom',
dockerfile='intercom/Dockerfile',
)
local("""
kubectl get secret --namespace {namespace} | grep souvap-gitlab || \
kubectl create secret docker-registry souvap-gitlab --docker-server=registry.souvap-univention.de --docker-username={univention_project_username} --docker-password={gitlab_access_token} -n {namespace}
""".format(
univention_project_username=univention_project_username,
gitlab_access_token=gitlab_access_token,
namespace=namespace
))
# Helm charts are provided by DevOps, therefore they are not in this repository.
# Recommended setup is to clone in parallel folder to this repository.
local("helm get values intercom-service --namespace {namespace} > ics-values.yaml".format(namespace=namespace))
k8s_yaml(
helm(
helmchart_path,
name='intercom-service',
namespace=namespace,
values='ics-values.yaml',
set=[
'global.imagePullSecrets[0]=souvap-gitlab',
'image.imagePullPolicy=Always',
'image.registry=registry.souvap-univention.de',
'image.repository=souvap/tooling/images/intercom-service',
'image.tag=development',
]
)
)