Resources come up when their dependencies aren't up
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 413
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 6
Description
Expected Behavior
When I enable (and wait for them to come up) and then disable resources with dependencies, and enable them again, I expect Tilt to check that the dependencies are complete and healthy.
Current Behavior
When I enable (and wait for them to come up) and then disable resources with dependencies, and enable them again, they all immediately come up with out waiting for their dependencies.
Steps to Reproduce
In this example, redis depends on postgres.
- Enable postgres and then redis.
- Wait for them to complete
- Disable both
- Enable redis
Redis will launch even though postgres is not running.
config.clear_enabled_resources()
k8s_yaml(encode_yaml_stream(decode_yaml_stream("""
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
selector:
matchLabels:
app: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis
ports:
- containerPort: 6379
""")))
k8s_resource('redis', resource_deps=['postgres'])
k8s_yaml(encode_yaml_stream(decode_yaml_stream("""
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
selector:
matchLabels:
app: postgres
replicas: 1
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: acme
- name: POSTGRES_USER
value: postgres
- name: POSTGRES_PASSWORD
value: development
livenessProbe:
exec:
command:
- /bin/sh
- -c
- psql -U postgres -d postgres -c "SELECT 1;"
failureThreshold: 6
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
exec:
command:
- /bin/sh
- -c
- psql -U postgres -d postgres -c "SELECT 1;"
failureThreshold: 6
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
""")))
k8s_resource('postgres')
Context
tilt doctor Output
Tilt: v0.30.2, built 2022-06-06
System: darwin-arm64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 20.10.17
- API Version: 1.41
- Builder: 2
- Compose Version: v2.5.1
---
Kubernetes
- Env: kind
- Context: kind
- Cluster Name: kind
- Namespace: default
- Container Runtime: containerd
- Version: v1.24.0
- Cluster Local Registry: &RegistryHosting{Host:localhost:10000,HostFromClusterNetwork:ctlptl-registry:5000,HostFromContainerRuntime:,Help:https://github.com/tilt-dev/ctlptl,SingleName:,}
---
Thanks for seeing the Tilt Doctor!
Please send the info above when filing bug reports. 💗
The info below helps us understand how you're using Tilt so we can improve,
but is not required to ask for help.
---
Analytics Settings
--> (These results reflect your personal opt in/out status and may be overridden by an `analytics_settings` call in your Tiltfile)
- User Mode: opt-out
- Machine: 824246c436840ddc1ecc5b043a18eb1c
- Repo: 00w/ZAt1hlKeNQiTmoBMfg==
About Your Use Case
I have UI buttons that dynamically change the Tilt args. Because of this behavior, you very easily get into a state where resources break because dependencies aren't honored.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied redis/postgres sequence, especially disabling both resources and re-enabling only redis. Trace the resource dependency and health-check handling involved in that transition. Done means redis waits for postgres to be running and healthy after re-enabling, as it does on the initial launch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100