tilt-dev / tilt-dev/tilt

add a namespace defaulter to `k8s_yaml`

Open
#5,884 5 comments 2 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

Describe the Feature You Want

Add the following function to the tiltfile:

k8s_yaml(yaml, namespace='foo')

Tilt should go through all the objects in the YAML and do Helm/kubecontext namespace defaulting:

  • If the resource has an explicit namespace, keep the explicit one.
  • If the resource does NOT have an explicit namespace, use foo
Current Behavior

If you want namespace defaulting, you have to modify your kubecontext yourself

Why Do You Want This?

Namespace defaulting is a super common feature in the k8s ecosystem.

Additional context
NOTE: this is very different from kubectl --namespace semantics, which are:

  • If the resource has an explicit namespace, verify that it's the same, and emit an error if it's not the same.
  • If the resource does NOT have an explicit namespace, use foo

but i think those defaulting semantics are wrong for us, and newer tools seem to be moving away from them

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 locating the k8s_yaml entry point and the existing Kubernetes YAML namespace handling. Check how current tests cover explicit and missing namespaces, then verify that explicit namespaces remain unchanged and missing namespaces receive the supplied default without adopting kubectl's conflicting-namespace behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.