Skip to content

tiltfile: add k8s_kind#1250

Merged
landism merged 2 commits into
masterfrom
mlandis/ch1724/implement-support-for-specifying-json-path
Mar 5, 2019
Merged

tiltfile: add k8s_kind#1250
landism merged 2 commits into
masterfrom
mlandis/ch1724/implement-support-for-specifying-json-path

Conversation

@landism

@landism landism commented Mar 5, 2019

Copy link
Copy Markdown
Member

Problems:

  1. In order to use CRDs, users had to manually join images with k8s entities by passing them all together to k8s_resource, which felt kind of clunky.
  2. k8s_resource only takes one image, which meant this didn't work with CRDs with multiple images.

Solution:
Add k8s_extra_image_location method, which says where to find the image definitions for a given k8s object type, so now CRDs can have multiple images and don't need a call to k8s_resource, but can just use the normal tiltfile joining logic.

@landism landism changed the title tiltfile: add tiltfile: add k8s_extra_image_location Mar 5, 2019
@landism
landism requested review from jazzdan and maiamcc March 5, 2019 16:46

@maiamcc maiamcc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Comment thread internal/k8s/image.go
Comment thread internal/k8s/image.go Outdated
Comment thread internal/tiltfile/k8s.go Outdated
Comment thread internal/tiltfile/tiltfile_state.go Outdated
filterYamlN = "filter_yaml"
k8sResourceN = "k8s_resource"
portForwardN = "port_forward"
k8sExtraImageLocation = "k8s_extra_image_location"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not thrillllled about this function name... k8s_extra_image_location_for_kind? (That's also not great... feel free to leave it for now if you can't come up w/ anything better.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, naming this thing is causing me grief. I'll come up with a few options and bounce them off people on slack.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, this seems not as terrible as most options:
k8s_kind('Environment', image_json_path='{.spec.runtime.image}')

@landism
landism force-pushed the mlandis/ch1724/implement-support-for-specifying-json-path branch from 26a2b79 to ef3d9ba Compare March 5, 2019 19:20
@landism landism changed the title tiltfile: add k8s_extra_image_location tiltfile: add k8s_kind Mar 5, 2019
@landism
landism merged commit 07d7422 into master Mar 5, 2019
@landism
landism deleted the mlandis/ch1724/implement-support-for-specifying-json-path branch March 5, 2019 21:23
@landism landism mentioned this pull request Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants