Closed ankeesler closed 3 years ago
This seems related to https://github.com/tilt-dev/tilt/issues/3732.
Unfortunately, even if you turned off the warning, the deploy still wouldn't work. :\
There's two separate problems:
Fortunately, we have a workaround for cases like this! See this guide: https://docs.tilt.dev/custom_resource.html which tells you how to use Tilt's APIs to tell it where to inject the image, and has some examples (e.g., Airflow env variables)
Wow, thanks @nicks ! That's really helpful. I'll give that a try. Thanks for the quick turnaround!
@nicks Hope it's okay to do this, but I'll share a workaround I ended up using after multiple searches brought me here:
My Tiltfile builds the Dockerfile
docker_build(
'my-image-name',
'.',
entrypoint=["echo", "this", "is", "a", "no", "op", "pod"],
dockerfile='/Dockerfile',
only=['/some/code'],
live_update=[
sync('/some/code', '/code'),
],
extra_tag=["my-image-name:local"], # <- Tilt still does it's internal tags, but also
# creates this tag that can be used outside of Tilt
)
I use a no-op Job/Pod that gets pulled in as part of k8s_yaml(kustomize())
in a file named no-op.yaml
.
# This is a no op Job, we're doing this so we can gain the benefits of Tilt
# auto-building the local image for us
---
apiVersion: batch/v1
kind: Job
metadata:
name: no-op
namespace: default
spec:
template:
spec:
containers:
- name: no-op
image: my-image-name
restartPolicy: Never
I can then do things like docker run my-image-name:local echo "Hello"
or manually apply kubectl apply -f non-tilt.yaml
that would use this image
Describe the Feature You Want
tilt
that I want to build a Docker image with hot restart capabilities (i.e.,docker_build_with_restart()
), even though I am not using that image in aspec.containers[].image
field.ConfigMap
) to pass to an operator to deploy aPod
with that image that I built.Current Behavior
tilt
to build a Docker image (i.e.,docker_build_with_restart()
) that I don't use in anyspec.containers[].image
field, it doesn't build the image and gives me this helpful warning.Pod
with that image, it can't since the image doesn't exist, and thePod
goes intoImagePullBackOff
.Why Do You Want This?
tilt
to iterate quickly on local development (i.e., make a change in*.go
code, and see that change show up in a localkind
cluster within 5 seconds or so).Pod
as we are for the operator, but we see this error and get reload times of more like 15 seconds.Additional context
Here are some snippets of our
Tiltfile
. Notice 1) the attempt to build theimage/kubecertagent
image with adocker_build_with_restart()
and 2) the attempt to pass it as aytt
parameter below. Our Concierge app will consume thatkube_cert_agent_image
template parameter via aConfigMap
. It reads theConfigMap
and then deploys aPod
with the image name provided.