quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Kubernetes Dev Services: k3s flavour name is not properly documented #33004

Closed metacosm closed 1 year ago

metacosm commented 1 year ago

Description

The k3s flavour needs to be passed as k3-s due to how SmallRye enumeration names conversions. That name is rather awkward and is not properly documented. Ideally, it should be named k3s but if it's not possible, the proper name should be documented accordingly.

Implementation ideas

No response

quarkus-bot[bot] commented 1 year ago

/cc @Sgitario (kubernetes), @geoand (devservices,kubernetes), @iocanel (kubernetes), @stuartwdouglas (devservices)

maxandersen commented 1 year ago

you see k3-s need to be passed to what/where exactly?

maxandersen commented 1 year ago

confirmed the bug using:

quarkus.kubernetes-client.devservices.flavor=k3s

gives you:

Caused by: java.lang.IllegalArgumentException: SRCFG00039: The config property quarkus.kubernetes-client.devservices.flavor with the config value "k3s" threw an Exception whilst being converted Cannot convert k3s to enum class io.quarkus.kubernetes.client.runtime.KubernetesDevServicesBuildTimeConfig$Flavor
        at io.smallrye.config.SmallRyeConfig.convertValue(SmallRyeConfig.java:284)
        at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:242)
        at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.readConfigValue(BuildTimeConfigurationReader.java:838)
        ... 27 more
Caused by: java.lang.IllegalArgumentException: Cannot convert k3s to enum class io.quarkus.ku
metacosm commented 1 year ago

It would actually be helpful for SmallRye to output the existing values in this situation as this would help users figure out what's wrong without having to debug the code.

scrocquesel commented 1 year ago

I guess changing the enum value to lowercase will avoid introducing hyphens when using an acronym. Or use a specific converters. Let me know what the better I'll do the PR.

metacosm commented 1 year ago

Lowercase is probably the easiest solution, yes! 👍

geoand commented 1 year ago

t would actually be helpful for SmallRye to output the existing values in this situation as this would help users figure out what's wrong without having to debug the code.

That's an interesting idea. Please open a new issue for that

dmlloyd commented 1 year ago

It's unfortunate that we add a hyphen on the digit-to-letter boundary. I can only guess that I was thinking e.g. Inet4Address should be inet4-address rather than inet4address (for example). I did have a small corpus of test strings but it was fairly limited.

We might consider updating these hyphenation rules to be somewhat more intuitive for a larger corpus of inputs, and then (maybe) add a flag for legacy behavior (or else require explicit names for those cases).

In the meantime I agree that it would be a good idea to update the converter for enums as described in smallrye/smallrye-config#930.