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

Lowercase enum values to avoid hypen in k8s flavor acronym #33013

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -197,17 +197,17 @@ private RunningDevService startKubernetes(DockerStatusBuildItem dockerStatusBuil
final Supplier<RunningDevService> defaultKubernetesClusterSupplier = () -> {
KubernetesContainer container;
switch (config.flavor) {
case API_ONLY:
case api_only:
container = new ApiServerContainer(
config.apiVersion.map(version -> findOrElseThrow(version, ApiServerContainerVersion.class))
.orElseGet(() -> latest(ApiServerContainerVersion.class)));
break;
case K3S:
case k3s:
container = new K3sContainer(
config.apiVersion.map(version -> findOrElseThrow(version, K3sContainerVersion.class))
.orElseGet(() -> latest(K3sContainerVersion.class)));
break;
case KIND:
case kind:
container = new KindContainer(
config.apiVersion.map(version -> findOrElseThrow(version, KindContainerVersion.class))
.orElseGet(() -> latest(KindContainerVersion.class)));
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public class KubernetesDevServicesBuildTimeConfig {
/**
* The flavor to use (kind, k3s or api-only). Default to api-only.
*/
@ConfigItem(defaultValue = "API_ONLY")
@ConfigItem(defaultValue = "api-only")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be api_only?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We replace _ with - when dealing with enum default values in Quarkus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried that both values api-only and api_only are indeed working fine.
Though, I would prefer using api_only which is the value present in the Flavor enum. This way we don't need to know this special handling made when using enum default values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using dashed values consistently in all Quarkus so let's keep it this way.

We decided to go with dashes for all default values.

public Flavor flavor;

/**
@@ -70,14 +70,14 @@ public static enum Flavor {
/**
* kind (needs priviledge docker)
*/
KIND,
kind,
/**
* k3s (needs priviledge docker)
*/
K3S,
k3s,
/**
* api only
*/
API_ONLY;
api_only;
}
}