Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

filter on kubecfg update #241

Open
bigdrum opened this issue Feb 28, 2019 · 7 comments
Open

filter on kubecfg update #241

bigdrum opened this issue Feb 28, 2019 · 7 comments
Assignees
Milestone

Comments

@bigdrum
Copy link

bigdrum commented Feb 28, 2019

Feature request:

It would nice to add flag to kubecfg update so that only apply update to a subset of object that match the filter (regex match for name, for example).

I have a single file defines multiple deployments, sometimes I want to update a subset of it to try out the change, before applying to all.

@mkmik
Copy link
Contributor

mkmik commented Feb 28, 2019

I was thinking to add support for using a label selector; wdyt?

@jjo
Copy link
Contributor

jjo commented Feb 28, 2019

I was thinking to add support for using a label selector; wdyt?

it would be really useful to also be able to subset by kind and/or
metadata.name (/ namespace).

@mkmik
Copy link
Contributor

mkmik commented Feb 28, 2019

what about (also) limiting by subtree with a dot separated "path"?

@jjo
Copy link
Contributor

jjo commented Feb 28, 2019

the dot-separation is an interesting and tricky one also,
because it depends if you viewed it from the Kubernetes
hierarchy[1] or DNS (sp for Services)[2] PoV.

I.e. the pairs below may represent the same object to diff people:

  • [1] default.kubernetes, [2] kubernetes.default
  • [2] monitoring.prometheus, [2] prometheus.monitoring

Maybe a '/' instead? which then hints on globbing for
matching, while I (personally) have a strong preference
for regex'ing.

@mkmik
Copy link
Contributor

mkmik commented Feb 28, 2019

I was thinking it in terms of a "jsonnet path" inside the sources. People will group related objects together anyway and kubecfg looks for objects at arbitrary depths

@anguslees
Copy link
Contributor

Fwiw: #16 is almost a duplicate, except the motivation is the show subcommand.

Re above: I think picking a jsonnet (json) subtree would be super useful, particularly for debugging via show. It assumes we only have a single jsonnet top-level file, which is theoretically not true - so we need to solve that somehow (perhaps ignore files that don't contain the given json path).

Given the radically different (and all desirable) proposals above, I think we need to consider the command line UX carefully, and ensure it is possible to extend it to multiple query syntaxes, and apply it to update/show/diff/etc. This might just be as simple as building a family of command line options, that follow some sort of similar pattern (eg: --select-by-labels).

A separate but important consideration: We will want to force update --skip-gc=true (or abort if =false) in the presence of a filter.

@bigdrum
Copy link
Author

bigdrum commented Mar 8, 2019

From me, regex to select namespace, kind, and name (as @jjo mentioned) would be most straightforward and easy to reason about.

Selecting on subtree of jsonnet might be confusing/dangerous on update (it might make sense for show). Since it highly ties to the structure of the jsonnet, which can be changed by refactoring, and there is also a learning curve on it (this reminds me of https://tools.ietf.org/html/rfc6901).

@mkmik mkmik self-assigned this Aug 2, 2019
@mkmik mkmik added this to the v0.13.0 milestone Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants