tilt-dev / tilt-extensions

Extensions for Tilt
https://tilt.dev/
Apache License 2.0
200 stars 156 forks source link

kubectl_build fails with Image not used in any Kubernetes config #589

Closed lkoniecz closed 1 month ago

lkoniecz commented 1 month ago

Tiltfile

load('ext://kubectl_build', 'kubectl_build')

allow_k8s_contexts('hc-dev')

kubectl_build(
    '<aws-account-id>.dkr.ecr.us-east-1.amazonaws.com/dev/java-server', '.'
)

k8s_attach(
    'java-server',
    'statefulset/java-server'
)

piece of statefulset spec deployed in the cluster

kubectl get statefulset java-server -o jsonpath="{range .spec.template.spec.containers[*]}{.image}{'\n'}{end}"

<aws-account-id>.dkr.ecr.us-east-1.amazonaws.com/dev/java-server:449833c2f117cc9f72bf7e2515156c917771a8d6
curlimages/curl:8.3.0

from Tiltfile logs


Loading Tiltfile at: /Users/lky/repositories/hc-java-server/Tiltfile
Image not used in any Kubernetes config:
    ✕ <aws-account-id>.dkr.ecr.us-east-1.amazonaws.com/dev/java-server
Skipping this image build
If this is deliberate, suppress this warning with: update_settings(suppress_unused_image_warnings=["<aws-account-id>..dkr.ecr.us-east-1.amazonaws.com/dev/java-server"])
Successfully loaded Tiltfile (887.916µs)
nicks commented 1 month ago

This is expected - you've built an image, but you haven't given tilt any instructions on how to deploy it or where to deploy it to. kubectl_attach doesn't have any logic for updating images.

nicks commented 1 month ago

here's a more full example of how to use kubectl_build with a real project - https://github.com/tilt-dev/tilt-extensions/blob/master/kubectl_build/test/Tiltfile