-
Notifications
You must be signed in to change notification settings - Fork 365
Description
If yaml is applied which includes instances of a CRD, then k8s_resource() doesn't pick it up -- and as a result, a subsequent call to config. set_enabled_resources() which would effectively exclude that resource from being applied, leaks objects through to k8s.
Example:
yaml = """
apiVersion: apps/v1
kind: Deployment
metadata:
name: foo
blah...
---
apiVersion: v1
kind: Service
metadata:
name: foo
blah...
---
apiVersion: some/other/thing
kind: SomeCrd
metadata:
name: foo
"""
k8s_yaml(yaml)
k8s_resource('foo')
config.set_enabled_resources(['anythingExceptFoo']);tilt up
kubectl get deployment foo (no results 👍 )
kubectl get service foo (no results 👍 )
kubectl get somecrd foo (1 result found! 👎 )
This can be sidestepped by passing the objects argument when calling k8s_resource():
k8s_resource('foo', objects=['foo:SomeCrd'])
HOWEVER, this shouldn't be necessary. Tilt should recognize ALL types applied via k8s_yaml() whether they're k8s native types or otherwise.
In particular this is causing issues when using git_resource() since it abstracts the call to k8s_resource() and we have no way to tell tilt about the additional objects. I can add an argument to git_resource() and forward it to the subsequent k8s_resource() call (which I did in order to verify this issue), but that complicates things (especially if you're using custom yaml/deploy callbacks) and really shouldn't be necessary anyway.