k8s_resource.objects param doesn't let you distinguish btwn two identical k8s entities

Open
#3,993 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, kubernetes

Research direction

Reproduce the issue with the Tiltfile and k8s_resource.objects example from the report. Start by tracing how the objects selector handles the documented name:kind:namespace form and the unique-fragment error. Done means identical Kubernetes entities can be distinguished or selected as requested, with a useful error when selection remains ambiguous.

Written by the indexing model from the issue text.

Description

bug
Expected Behavior

k8s_resource.objects param should let you specify any k8s entity that Tilt knows about

Current Behavior

In the case where Tilt has two of the same k8s entities, Tilt names them by appending an index to the end, like so:

  • foobar:pod:my-ns:apiextensions.k8s.io:0
  • foobar:pod:my-ns:apiextensions.k8s.io:1

There is no way to disambiguate them via k8s_resource.objects (since that param. only accepts selectors of the form name:kind:namespace--otherwise you get the error "Too many parts in selector. Selectors must contain between 1 and 3 parts (colon separated)"). If you pass foobar:pod:my-ns, you get:

"foobar:pod:my-ns" is not a unique fragment. Objects that match "foobar:pod:my-ns" are "foobar:pod:my-ns", "foobar:pod:my-ns"

  1. The error message is unhelpful, but more importantly
  2. you will never be able to use k8s_resource.objects to specify either/both of these entities, b/c the objects param REQUIRES you to uniquely specify an entity, and tilt gives you no way to do this if the entities are identical. This param should probably let you specify entities non-uniquely (see #3727) -- tho at minimum, if it requires you to specify entities uniquely, you should be able to in this case.
Steps to Reproduce
  1. Tiltfile:
    load('ext://helm_remote', 'helm_remote')
    
    REPO_URL = 'https://containous.github.io/traefik-helm-chart'
    OBJ = 'tlsoptions.traefik.containo.us:CustomResourceDefinition:default'
    helm_remote('traefik', repo_name='traefik',
                repo_url=REPO_URL,
                namespace='default', version='8.9.0')
    k8s_resource('traefik', port_forwards='8000',
            objects=[OBJ]
    )
    
  2. tilt up
  3. See error (snapshot):

    "tlsoptions.traefik.containo.us:CustomResourceDefinition:default" is not a unique fragment. Objects that match "tlsoptions.traefik.containo.us:CustomResourceDefinition:default" are "tlsoptions.traefik.containo.us:CustomResourceDefinition:default", "tlsoptions.traefik.containo.us:CustomResourceDefinition:default"

About Your Use Case

Reported by Isaac Wilder in Slack. Minor issue/not blocking.

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

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.

More from tilt-dev/tilt

All issues in tilt-dev/tilt

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.