-
Notifications
You must be signed in to change notification settings - Fork 136
This change adds preliminary support for k8s_objects. #48
Conversation
`k8s_objects` takes a list of K8s objects across which to take certain actions. `k8s_objects` also supports nesting, so a `k8s_objects` can take another `k8s_objects`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments/questions, mostly for my own education.
comprise an application. There are two main ways that we support interacting | ||
with these kinds of objects. | ||
|
||
The first is to simply use a template file that contains your N objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this basically a multi-document YAML file, or are we doing anything special here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a multi-part yaml, nothing fancy.
output = ctx.outputs.executable, | ||
) | ||
|
||
runfiles = [obj.files_to_run.executable for obj in ctx.attr.objects] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using depset
s here instead of lists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.runfiles(files = ...)
expects a sequence of Files
, so depset
really only helps with potential deduping, which I'm not super concerned about (I'd guess Bazel does this later anyways?).
k8s_objects( | ||
name = "deployments", | ||
objects = [ | ||
":foo-deployment", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to use glob to specify a wildcard on a set of these? It might make a good example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this context, they are targets, so not really.
You could use a glob to generate the k8s_deploy
rules:
[k8s_kind(
name = "some-function-of-input",
template = f,
) for f in glob(["*.kind.yaml"])]
I don't do this in Prow, but I do something similar.
k8s_objects
takes a list of K8s objects across which to take certain actions.k8s_objects
also supports nesting, so ak8s_objects
can take anotherk8s_objects
.Fixes: #46