kapp icon indicating copy to clipboard operation
kapp copied to clipboard

ability to exclude certain key names from `kapp config-map`

Open dprotaso opened this issue 4 years ago • 6 comments

Describe the problem/challenge you have Knative's config maps have an _example key and they're multi-line and noisy and there's not way to exclude them from the kapp config-map output

Describe the solution you'd like I was thinking a --exclude-keys key1,key2 flag would work

Anything else you would like to add: Thanks for the help!

dprotaso avatar Mar 12 '21 16:03 dprotaso

Hi @dprotaso,

You are correct, there is currently not a way to exclude certain keys from the kapp config-map list command. One strategy you could take in filtering the command's output is using the --json output flag and then piping that into a tool like jq.

We were able to produce this command that ignores a specific key from your kapp config-map command: kapp config-map list -a app --values --json | yq '.Tables[0].Rows[] | select(.key != "_example")'

Let us know if this helps!

cc: @DennisDenuto

gcheadle-vmware avatar Mar 17 '21 21:03 gcheadle-vmware

Yeah I knew piping it to jq/yq is an option though I wanted the nice table output that kapp produces

dprotaso avatar Mar 30 '21 17:03 dprotaso

Hi @dprotaso,

I understand the desire to have the nice table output. I tried piping the output into grep -v -e _example, and the lines were removed while remaining in table output. This may work in the meantime, however, I feel that there is an opportunity to improve the UI here.

I’m proposing a flag that could apply to kapp commands that print a table output (except kapp deploy). This flag, something like --exclude-row or --filter-table would be different from the current ways of filtering in kapp. Instead of matching on fields in resources, this flag would provide a way to ex/include rows in table output based on the text in the table.

Let me know if you think this would improve your workflow. If so, we can write up a story and prioritize it, however, an enhancement like this likely to be a lower priority for the Carvel team and may take a while to be picked up. But we are always welcoming contributions. Thank you!

gcheadle-vmware avatar Apr 20 '21 22:04 gcheadle-vmware

Yeah that'd work for me

dprotaso avatar Apr 21 '21 13:04 dprotaso

This sounds like a useful feature.

@dprotaso would you mind dropping a sample output of the kapp config-map output that triggered this issue? It would help folks better connect with the experience?

pivotaljohn avatar Apr 30 '21 23:04 pivotaljohn

Knative has verbose comments in their configmaps under a _example key

ie. https://github.com/knative/serving/blob/main/config/core/configmaps/autoscaler.yaml#L25

dprotaso avatar May 03 '21 17:05 dprotaso