tilt icon indicating copy to clipboard operation
tilt copied to clipboard

down-policy not respected if resource is disabled

Open leigholiver opened this issue 1 month ago • 0 comments

Expected Behavior

If i disable a resource, and the k8s resource has the down-policy=keep annotation, the k8s resource should not be deleted.

Current Behavior

The resource is deleted when disabled.

Steps to Reproduce

k8s.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: example-config
  annotations:
    tilt.dev/down-policy: keep
data:
  foo: bar

Tiltfile:

k8s_yaml('k8s.yaml')
  1. tilt up - configmap is created
  2. tilt down - as expected, configmap is not deleted
$ tilt down
Loading Tiltfile at: /home/.../tilt-repro/Tiltfile
Successfully loaded Tiltfile (1.423993ms)
  1. tilt up
  2. disable the resource in the UI
  3. resource is deleted
$ tilt up
Tilt started on http://localhost:10351/
v0.36.0, built 2025-11-18

(space) to open the browser
(s) to stream logs (--stream=true)
(t) to open legacy terminal mode (--legacy=true)
(ctrl-c) to exit
Tilt started on http://localhost:10351/
v0.36.0, built 2025-11-18

Initial Build
Loading Tiltfile at: /home/.../tilt-repro/Tiltfile
Successfully loaded Tiltfile (1.514908ms)
uncategorized │
uncategorized │ Initial Build
uncategorized │ STEP 1/1 — Deploying
uncategorized │      Applying YAML to cluster
uncategorized │      Objects applied to cluster:
uncategorized │        → example-config:configmap
uncategorized │
uncategorized │      Step 1 - 0.06s (Deploying)
uncategorized │      DONE IN: 0.06s
uncategorized │
uncategorized │ Beginning deleting disabled Kubernetes objects
uncategorized │ Deleting kubernetes objects:
uncategorized │ → ConfigMap/example-config
uncategorized │ Resource "uncategorized" disabled. To enable/disable it, use the Tilt Web UI.
uncategorized │ Resource "uncategorized" enabled. To enable/disable it, use the Tilt Web UI.
uncategorized │
uncategorized │ Initial Build
uncategorized │ STEP 1/1 — Deploying
uncategorized │      Applying YAML to cluster
uncategorized │      Objects applied to cluster:
uncategorized │        → example-config:configmap
uncategorized │
uncategorized │      Step 1 - 0.07s (Deploying)
uncategorized │      DONE IN: 0.07s
uncategorized │

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.36.0, built 2025-11-18
System: linux-amd64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 28.1.1
- API Version: 1.49
- Builder: 2
- Compose Version: v2.35.1
---
Kubernetes
- Env: eks
- Context: ...
- Cluster Name: ...
- Namespace: ...
- Container Runtime: containerd
- Version: v1.33.5-eks-3cfe0ce
- Cluster Local Registry: none

About Your Use Case

Im trying to integrate with already-existing deployments using the get_obj extension, and the annotation looked perfect for leaving things in place - I was surprised by this behaviour, as the docs say:

Disabling a resource will stop the running process (if any) and delete any objects owned by that resource. It’s the equivalent of running tilt down on a specific resource.

I've searched for other possible annotations but didnt see anything - apologies if ive just missed something!

leigholiver avatar Nov 20 '25 15:11 leigholiver