Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

This change adds preliminary support for k8s_objects. #48

Merged
merged 1 commit into from
Oct 3, 2017
Merged

Conversation

mattmoor
Copy link
Contributor

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.

Fixes: #46

`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`.
Copy link

@dlorenc dlorenc left a 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
Copy link

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?

Copy link
Contributor Author

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]
Copy link

Choose a reason for hiding this comment

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

Should we be using depsets here instead of lists?

Copy link
Contributor Author

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",
Copy link

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.

Copy link
Contributor Author

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.

@mattmoor mattmoor merged commit 9f29ca0 into master Oct 3, 2017
@nlopezgi nlopezgi deleted the objects branch November 27, 2018 15:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants