Tilt should be able to Live Update multiple pods with same image
Currently, Tilt's Live Update functionality only works on a single instance of the image-to-be-updated. If the image is present on multiple pods, you get the error:
Will not perform Live Update because: Error retrieving container info: can only get container info for a single pod; image target image:xyz has n pods
Part of the thought behind this design is that the more places we apply a single Live Update, the more things could potentially go wrong/get out of sync. This increases the likelihood that Tilt will fall back to a full image build+deploy to ensure that all containers are running the same code, sacrificing speed; if the full build+deploy fails, then we're in an even worse situation, with a half-applied update across your pods and no good way to know what code is running where.
We still expect most Tilt users to be running their app in one pod at a time, or easily able to scale down to one pod at a time for testing/development purposes. However, there are definitely still users requesting multi-pod Live Update, and we want to get a sense of how many users this applies to, their specific use cases, and their appetite for the tradeoffs mentioned above.
For us, it's nice to be able to run multiple replicas using Tilt, so we can have more of a "realistic" experience when running locally. I've already uncovered a few scaling bugs when testing with Tilt this way!
We're just getting started with Live Update, and are currently planning to work around the limitation by supporting separate "modes" in our Tiltfile, with an argument choosing between:
- 1 replica per deployment, Live Update enabled
- Multiple replicas if defined, but Live Update disabled
This puts a bit more responsibility on the developer to think about testing in both modes, but gives us a decent fallback for now.
We received a report about this from a team that used preStop on their containers:
Will not perform Live Update because:
Error retrieving container info: can only get container info for a single pod; image target X has 2 pods
Falling back to a full image build + deploy
This might be a separate issue though (i.e., Tilt might be able to determine that a pod in pre-stop mode doesn't need to be live-updated)
When developing really small services, especially if scalability is a concern, it definitely helps for me to not have to switch between single and multiple replicas and wait for Tilt and Kubernetes to handle it before I see my change. I found this page while I was looking for a way to solve this basically. For the last hour, I've been switch to 2 replica, waiting 2 minutes, switching back to 1 replicas to code for 15 minutes, rinse and repeat.
Although I gotta say I really love Tilt, I think it's a fantastic tool and it has helped me a whole lot recently. The addition of this would be fantastic. I even wouldn't mind contributing myself if you guys give me some pointers on where to start!
v0.23 has a new live-updater that supports multiple pods!