kapp
kapp copied to clipboard
ability to exclude certain key names from `kapp config-map`
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!
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
Yeah I knew piping it to jq/yq is an option though I wanted the nice table output that kapp produces
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!
Yeah that'd work for me
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?
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