Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When specifying a deployment namespace with tilt up --namespace <NAMESPACE>, if <NAMESPACE> does not currently exist, create the namespace. #6356

Open
peter-mcclonski opened this issue Apr 16, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@peter-mcclonski
Copy link

Describe the Feature You Want

When specifying a deployment namespace with tilt up --namespace <NAMESPACE>, if <NAMESPACE> does not currently exist, create the namespace.

Current Behavior

If the namespace does not already exist, deployments will fail.

Why Do You Want This?

There is currently no good way to have a custom namespace created for tilt. Based on the initial description of this flag on release (https://blog.tilt.dev/2021/06/30/namespace-flag.html), it's implied that previous uses of the namespace extension, including namespace_create('test-default') should be fully replaced by the flag.

@nicks
Copy link
Member

nicks commented Apr 16, 2024

hmmm...i'm not sure we should do this.

The tilt --namespace flag is indented to map to kubectl --namespace. In kubectl, it sets the default namespace for API requests - https://pkg.go.dev/k8s.io/client-go@v0.29.3/tools/clientcmd/api/v1#Context

kubectl --namespace=... apply does not auto-create the namespace.

Helm has a separate --create-namespace flag, which you can simulate in tilt as:

namespace_create(k8s_namespace())

@peter-mcclonski
Copy link
Author

@nicks Fair concerns. Regardless, I would make the case that this is a reasonable quality-of-life improvement. If tying it directly to the --namespace flag is undesirable, perhaps adding a separate tilt --create-namespace flag to be analogous to the underlying helm --create-namespace flag?

I would make the argument that the current reliance namespace_create(k8s_namespace()) is non-intuitive, and contrasts with the linked tilt feature announcement. The --namespace flag being provided out of the box contrasts with the need to load a separate extension for namespace_create(...). At minimum, if specifying the --namespace flag and the namespace does not exist, I would expect to see the initial tilt up fail immediately.

@nicks
Copy link
Member

nicks commented Apr 19, 2024

ya, i guess we'd accept a --create-namespace flag that mirrors the helm flag behavior

@peter-mcclonski
Copy link
Author

To make sure we're on the same page-- I'm thinking that this would be a tilt flag on the up command. For instance, tilt up --create-namespace. The flag would be meaningless (and provide an associated error) if not paired with the --namespace flag, and it would result in the namespace being created prior to the actual contents of the Tiltfile being processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants