From 4b18a166d839951c66f4d1e179f4fca6010690d5 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Wed, 20 Nov 2024 23:59:07 -0700 Subject: [PATCH] Update Tiltfile for faster iteration: The live update makes the development loop quite fast. Signed-off-by: Jacob Weinstock --- Tiltfile | 57 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/Tiltfile b/Tiltfile index 7f2d2c66..50754c22 100644 --- a/Tiltfile +++ b/Tiltfile @@ -2,32 +2,47 @@ local_resource('compile smee', cmd='make cmd/smee/smee-linux-amd64', deps=["go.mod", "go.sum", "internal", "Dockerfile", "cmd/smee/main.go", "cmd/smee/flag.go", "cmd/smee/backend.go"] ) -docker_build( - 'quay.io/tinkerbell/smee', - '.', - dockerfile='Dockerfile', +load('ext://restart_process', 'docker_build_with_restart') +#docker_build( +# 'quay.io/tinkerbell/smee', +# '.', +# dockerfile='Dockerfile', +#) +docker_build_with_restart( + 'quay.io/tinkerbell/smee', + '.', + dockerfile='Dockerfile', + entrypoint=['/usr/bin/smee'], + live_update=[ + sync('cmd/smee/smee-linux-amd64', '/usr/bin/smee'), + ], ) -#k8s_yaml(kustomize('./manifests/kustomize/overlays/k3d')) default_registry('ttl.sh/meohmy-dghentld') -trusted_proxies = os.getenv('trusted_proxies', '') -lb_ip = os.getenv('LB_IP', '192.168.2.114') +load('ext://local_output', 'local_output') +default_trusted_proxies = local_output("kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}' | tr ' ' ','") +trusted_proxies = os.getenv('TRUSTED_PROXIES', default_trusted_proxies) +lb_ip = os.getenv('LB_IP', '') stack_version = os.getenv('STACK_CHART_VERSION', '0.5.0') -layer2_interface = os.getenv('LAYER2_INTERFACE', 'eth1') +stack_location = os.getenv('STACK_LOCATION', '/home/tink/repos/tinkerbell/charts/tinkerbell/stack') # or a local path like '/home/tink/repos/tinkerbell/charts/tinkerbell/stack' +namespace = 'tink' + +if lb_ip == '': + fail('Please set the LB_IP environment variable. This is required to deploy the stack.') load('ext://helm_resource', 'helm_resource') helm_resource('stack', - chart='oci://ghcr.io/tinkerbell/charts/stack', - namespace='tink', - image_deps=['quay.io/tinkerbell/smee'], - image_keys=[('smee.image')], - flags=[ - '--create-namespace', - '--version=%s' % stack_version, - '--set=global.trustedProxies={%s}' % trusted_proxies, - '--set=global.publicIP=%s' % lb_ip, - '--set=stack.kubevip.interface=%s' % layer2_interface, - '--set=stack.relay.sourceInterface=%s' % layer2_interface, - ], - release_name='tink-stack' + chart=stack_location, + namespace=namespace, + image_deps=['quay.io/tinkerbell/smee'], + image_keys=[('smee.image')], + flags=[ + '--create-namespace', + '--version=%s' % stack_version, + '--set=global.trustedProxies={%s}' % trusted_proxies, + '--set=global.publicIP=%s' % lb_ip, + '--set=stack.kubevip.interface=eth1', + '--set=stack.relay.sourceInterface=eth1', + ], + release_name='stack' )