
include('../Tiltfile')

k8s_custom_deploy(
    'custom-deploy-int-test',
    # forcibly delete and re-create the deployment whenever run
    apply_cmd='kubectl delete --ignore-not-found=true --wait=true -f "${DEPLOY_FILE}" >/dev/null && kubectl create -oyaml -f "${DEPLOY_FILE}"',
    delete_cmd='kubectl delete --ignore-not-found=true --wait=true -f "${DELETE_FILE}"',
    deps=['.'],
    image_selector='nginx',
    apply_env={'DEPLOY_FILE': 'deploy.yaml'},
    delete_env={'DELETE_FILE': 'deploy.yaml'},
    live_update=[
        fall_back_on('./fallback.txt'),
        sync('./web/', '/usr/share/nginx/html/')
    ]
)
k8s_resource(
    'custom-deploy-int-test',
    port_forwards=['54871:80']
)
