Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpk: make it harder to misuse "rpk config set" #4176

Closed
jcsp opened this issue Apr 4, 2022 · 1 comment · Fixed by #5061
Closed

rpk: make it harder to misuse "rpk config set" #4176

jcsp opened this issue Apr 4, 2022 · 1 comment · Fixed by #5061
Labels
area/rpk kind/enhance New feature or request

Comments

@jcsp
Copy link
Contributor

jcsp commented Apr 4, 2022

"rpk config set" is a schema-unaware mechanism for setting values in a YAML file: one can do e.g. a "set foo bar" and you'll get a foo key in your configuration file.

That's a UX issue in several ways:

  • User can typo a key name and it still gets written to the config file
  • User can supply a malformed value and it still gets written
  • (New in 22.1) User can specify a cluster configuration property name, and write it "correctly" to redpanda.yaml, except that that's not where we keep cluster configuration properties any more.

Assuming we still need this schema-unaware command, there are a few things we could do to make it less of a foot-gun:
A) Compile-in a list of "at time of writing" cluster configuration properties, and refuse to set them in redpanda.yaml with a helpful message about "rpk cluster config edit"
B) Or, as above, but instead of compiling it in, have rpk pull the schema at runtime from the admin api. This has the downside that it only works if redpanda is running, and if rpk has the right host/port for talking to the admin API.
C) Use the existing pkg/config/schema.go definition of node configuration properties to validate any "config set redpanda." command. For unknown properties, provide a helpful message that they might be trying to set a cluster configuration property. In the even that they are trying to set a node property that RPK just doesn't know about (unlikely: local config file edits are happening using the same RPK that is shipped with redpanda), they may have to edit redpanda.yaml directly.

I lean toward C.

@twmb
Copy link
Contributor

twmb commented May 4, 2022

This should addressed when addressing #4530: if we remove the implicit magic, we can make these failures explicit. However, I err towards (a).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rpk kind/enhance New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants