davsclaus opened a new pull request, #30846:
URL: https://github.com/apache/camel/pull/30846

   ## Description
   
   [CAMEL-22733](https://issues.apache.org/jira/browse/CAMEL-22733): the trait 
options of `camel kubernetes run` / `export` were only listed on the website. 
This adds a command:
   
   ```
   camel kubernetes traits            # the traits, with a description
   camel kubernetes traits ingress    # the options of a trait: name, type, 
description
   camel kubernetes traits ingress --json
   ```
   
   - The list comes from the trait model (`Traits` and its models), so it stays 
in line with what `--trait` takes. Each model got a one-line 
`@JsonClassDescription` for the list of traits.
   - An option is shown as `--trait` takes it (`ingress.path-type`), with its 
type (`bool`, `int`, `string`, `[]string`, `map`). For a choice (an enum), the 
values are appended when the description does not name them already. The JSON 
output always has them.
   - `service-binding` is not listed: `--connect` sets it, but no trait applies 
it, so it has no effect today (that is a separate issue). `addons` is not a 
trait.
   - An unknown trait exits with `3` (not found).
   - `--trait` of `kubernetes run` and `kubernetes export` gets a completer 
with the option names (`container.port=`, ...).
   
   I picked a command over a longer `--help`: the options of all traits are 
about 150 lines.
   
   Docs: the kubernetes plugin pages mention the command. The command reference 
page and the plugin command metadata are regenerated.
   
   Note: #30845 (CAMEL-22104) adds a `prometheus` trait. Whichever PR merges 
second gets a `@JsonClassDescription` on `Prometheus` so the list describes it; 
without it, the list falls back to the description of the property ("The 
configuration of Prometheus trait").
   
   ## Testing
   
   `KubernetesTraitsTest`:
   - the list of traits and the options of a trait, as text and as JSON;
   - the values of a choice, and no repeat when the description names them;
   - an unknown trait is not found;
   - every listed option, given as `--trait <trait>.<option>=<value>`, is read 
by `TraitHelper.parseTraits` into the model, so the names shown are the names 
`--trait` takes;
   - the completion candidates.
   
   The whole module passes (189 tests). I did not try the Tab completion in an 
interactive `camel shell`; the candidates are unit tested, and the completer is 
wired like the other completers of the CLI.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to