Open milas opened 2 years ago
I've got a workaround if you want , you could specify the function
def deploy_yaml(service,namespace=default):
k8s_custom_deploy(
service,
apply_cmd=str('kubectl apply -f {service}.yaml -n {namespace} -o yaml'.format(service=service,namespace=namespace)),
delete_cmd=str('kubectl delete -f {service}.yaml -n {namespace}'.format(service=service,namespace=namespace)),
deps=[service],
)
and call it as
deploy_yaml("my-service","my-namespace")
notice the very important -o yaml
in the apply command
The UI shows this
Deploying
Running cmd: kubectl apply -f dep/my-service.yaml -n my-namespace -o yaml
Objects applied to cluster:
→ my-service:deploy
Expected Behavior
k8s_custom_deploy
that does not return any YAML fromapply_cmd
Current Behavior
Steps to Reproduce
Create a
Tiltfile
with ak8s_custom_deploy
that doesn't return YAML and relies on label selectors:app.yaml
:tilt up
kubectl get pod -l app=web
to see that pod exists and is healthyContext
I think the most logical thing here is to add an optional
namespace
arg tok8s_resource
to explicitly use in theKubernetesDiscoveryTemplateSpec
+KubernetesDiscoverySpec
in addition to(?) any implicitly discovered namespaces. It should probably be an error to set this without also populatingextra_pod_selectors
because otherwise it's meaningless.Alternatively, we could have a "magic" key in
extra_pod_selectors
that's something like$namespace
(not a valid K8s label identifier, so no risk of overlap) to use for this purpose without changing the API.We also currently eagerly watch any namespaces based on the spec YAML; in the case of a spec apply cmd, we could eagerly watch the "default" namespace in that case, but that only works if that's the namespace the apply cmd actually uses, which isn't a given.