Skip to content

Commit d786291

Browse files
committed
Use helm_resource for orderly chart deployments
1 parent 1ae19f3 commit d786291

2 files changed

Lines changed: 34 additions & 12210 deletions

File tree

tilt/Tiltfile

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load('ext://restart_process', 'docker_build_with_restart')
22
load('ext://secret', 'secret_create_generic', 'secret_from_dict', 'secret_yaml_registry')
33
load('ext://dotenv', 'dotenv')
44
load('ext://deployment', 'deployment_create')
5-
load('ext://helm_remote', 'helm_remote')
5+
load('ext://helm_resource', 'helm_resource', 'helm_repo')
66
dotenv(fn='../backend/.env')
77

88
# Should the frontend and backend be deployed separately?
@@ -18,6 +18,9 @@ with_rancher = False
1818
# Requires kubeVersion <1.35.0-0
1919
RANCHER_VERSION="v2.13.2"
2020

21+
# Increase timeout because ingress-nginx can take longer than 30s to install
22+
update_settings(k8s_upsert_timeout_secs=60)
23+
2124
if separate_frontend_and_backend:
2225
docker_build(
2326
"anvilops-frontend", "../",
@@ -155,44 +158,43 @@ k8s_yaml(encode_yaml_stream(parsed))
155158

156159
k8s_resource(workload='anvilops-postgres', port_forwards=[5432])
157160

158-
# Install the Nginx ingress controller and forward localhost:3000, localhost:443
159-
helm_remote(
160-
'ingress-nginx',
161-
namespace='ingress-nginx',
162-
repo_url='https://kubernetes.github.io/ingress-nginx',
163-
create_namespace=True,
164-
set=[
165-
"controller.extraArgs.default-ssl-certificate=default/ingress-cert",
166-
"controller.admissionWebhooks.enabled=false",
167-
"controller.service.clusterIP=%s" % ingress_clusterip
168-
]
169-
)
170-
171-
# forwarding to 0.0.0.0:443 instead of just 443 bypasses privileged port restriction
172-
# https://github.com/tilt-dev/tilt/issues/1909
173-
k8s_resource('ingress-nginx-controller', port_forwards=('3000:80','0.0.0.0:443:443'))
174-
175161
if with_rancher:
176-
# Rancher requires TLS, and depends on cert-manager CRDs
177-
k8s_yaml('./cert-manager.crds.yaml')
178-
179162
# Requires kubeVersion <1.35.0-0
180163
# # view the rancher frontend at https://rancher.127.0.0.1.nip.io
181-
helm_remote(
164+
helm_repo('rancher_repo', 'https://releases.rancher.com/server-charts/latest')
165+
helm_resource(
182166
'rancher',
167+
'rancher_repo/rancher',
183168
namespace='cattle-system',
184-
repo_url='https://releases.rancher.com/server-charts/latest',
185-
create_namespace=True,
186-
version=RANCHER_VERSION,
187-
set=[
188-
'hostname=rancher.127.0.0.1.nip.io',
189-
'replicas=1',
190-
'ingress.ingressClassName=nginx',
191-
'tls=external',
192-
'bootstrapPassword=insecurepassword123'
193-
]
169+
flags=[
170+
'--version=%s' % RANCHER_VERSION,
171+
'--set=hostname=rancher.127.0.0.1.nip.io',
172+
'--set=replicas=1',
173+
'--set=ingress.ingressClassName=nginx',
174+
'--set=tls=external',
175+
'--set=bootstrapPassword=insecurepassword123',
176+
'--create-namespace'
177+
],
178+
resource_deps=['rancher_repo']
194179
)
195180

181+
# Install the Nginx ingress controller and forward localhost:3000, localhost:443
182+
# forwarding to 0.0.0.0:443 instead of just 443 bypasses privileged port restriction on MacOS
183+
# https://github.com/tilt-dev/tilt/issues/1909
184+
helm_repo('ingress-nginx_repo', 'https://kubernetes.github.io/ingress-nginx')
185+
helm_resource(
186+
'ingress-nginx',
187+
'ingress-nginx_repo/ingress-nginx',
188+
namespace='ingress-nginx',
189+
flags=[
190+
'--create-namespace',
191+
'--set=controller.extraArgs.default-ssl-certificate=default/ingress-cert',
192+
'--set=controller.service.clusterIP=%s' % ingress_clusterip
193+
],
194+
resource_deps=['ingress-nginx_repo'],
195+
port_forwards=('3000:80','0.0.0.0:443:443')
196+
)
197+
196198
if enable_monitoring:
197199
deployment_create(
198200
name = "lgtm",

0 commit comments

Comments
 (0)