tilt-dev / tilt-dev/tilt

Custom resource stays in pending state when Tilt can't find any associated pods

Open
#2,949 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

The Tilt resource in question is represented by a custom resource on the Kubernetes side. It seems that when Tilt can't find any pods to watch for this resource the resource stays in the pending state (yellow dot in the CLI, pulsing circle in the browser).
When I associate any pods via

k8s_resource('resource', extra_pod_selectors=[{'label': 'value'}])

it transitions to the running state when the associated pods are okay.

I'm not sure what the correct behaviour should be in this case. Tilt (and the developer) has the reasonable expectation that the resource results in some pods and it waits for this, so it would be misleading to simply transition to the running state. On the other hand this assumption might not always be correct even when a Kubernetes custom resource contains references to container images. A good example might be a cron job like custom resource which will not immediately result in any pods even if they could be found by extra_pod_selectors. Another example would be when the custom resource orchestrates resources in another Kubernetes cluster or for another consumer of container images, both of which are currently not in the scope of Tilt. So in these cases leaving the resource in the pending state communicates the wrong message to the developer as they think that something is not working as expected. And it will also block other dependent resources I think which it should not.

Maybe a new flag is needed for k8s_kind() to communicate to Tilt that it is okay if a resource has no pods. It could transition into a newly defined "green" state in this case. Something like Deployed. This could still work together with the current logic, just that zero or more pods instead of one or more pods are "okay" and that Tilt transitions the resource into Deployed instead of Pending when no pods are present. Does that make any sense?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the custom-resource case with k8s_resource and extra_pod_selectors, then inspect the k8s_kind entry point and how zero associated pods affect resource state and dependencies. Done requires an agreed behavior for resources with no pods, including whether a new flag or state is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.