From bb86e46fdcb6242bb0b71a4ca613fd683376c932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szynkiewicz?= Date: Fri, 18 Mar 2022 11:13:37 +0100 Subject: [PATCH] Simplify stork configuration --- docs/src/main/asciidoc/stork-reference.adoc | 8 ++++---- docs/src/main/asciidoc/stork.adoc | 6 +++--- .../rest/client/reactive/stork/StorkDevModeTest.java | 4 ++-- .../src/test/resources/stork-application.properties | 2 +- .../src/test/resources/stork-dev-application.properties | 2 +- .../src/test/resources/stork-stat-lb.properties | 2 +- .../io/quarkus/stork/StorkLoadBalancerConfiguration.java | 2 +- .../quarkus/stork/StorkServiceDiscoveryConfiguration.java | 2 +- .../src/main/resources/application.properties | 4 ++-- .../src/main/resources/application.properties | 4 ++-- .../src/main/resources/application.properties | 4 ++-- .../src/main/resources/application.properties | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/main/asciidoc/stork-reference.adoc b/docs/src/main/asciidoc/stork-reference.adoc index 8577200481dd3..c4086c3fa9306 100644 --- a/docs/src/main/asciidoc/stork-reference.adoc +++ b/docs/src/main/asciidoc/stork-reference.adoc @@ -50,7 +50,7 @@ For each service expected to be exposed as a Kubernetes Service, configure the l [source, properties] ---- quarkus.stork.my-service.service-discovery.type=kubernetes -quarkus.stork.my-service.service-discovery.params.k8s-namespace=my-namespace +quarkus.stork.my-service.service-discovery.k8s-namespace=my-namespace ---- Stork looks for the Kubernetes Service with the given name (`my-service` in the previous example) in the specified namespace. @@ -148,7 +148,7 @@ public class AcmeServiceDiscoveryProvider // <3> This implementation is straightforward. <1> `@ServiceDiscoveryType` annotation defines the type of the service discovery provider. For each `ServiceDiscoveryProvider` annotated with this annotation, a configuration class will be generated. The name of the configuration class is constructed by appending `Configuration` to the name of the provider. -<2> Use `@ServiceDiscoveryAttribute` to define configuration properties for services configured with this service discovery provider. Configuration properties are gathered from all properties of a form: `quarkus.stork.my-service.service-discovery.params.attr=value`. +<2> Use `@ServiceDiscoveryAttribute` to define configuration properties for services configured with this service discovery provider. Configuration properties are gathered from all properties of a form: `quarkus.stork.my-service.service-discovery.attr=value`. <3> The provider needs to implement `ServiceDiscoveryType` typed by the configuration class. <4> `createServiceDiscovery` method is the factory method. It receives the configuration and access to the name of the service and available infrastructure. @@ -202,8 +202,8 @@ Then, in the configuration, just add: [source, properties] ---- quarkus.stork.my-service.service-discovery.type=acme -quarkus.stork.my-service.service-discovery.params.host=localhost -quarkus.stork.my-service.service-discovery.params.port=1234 +quarkus.stork.my-service.service-discovery.host=localhost +quarkus.stork.my-service.service-discovery.port=1234 ---- Then, Stork will use your implementation to locate the `my-service` service. diff --git a/docs/src/main/asciidoc/stork.adoc b/docs/src/main/asciidoc/stork.adoc index 444008e6d1f68..428af56684d96 100644 --- a/docs/src/main/asciidoc/stork.adoc +++ b/docs/src/main/asciidoc/stork.adoc @@ -308,8 +308,8 @@ consul.host=localhost consul.port=8500 quarkus.stork.my-service.service-discovery.type=consul -quarkus.stork.my-service.service-discovery.params.consul-host=localhost -quarkus.stork.my-service.service-discovery.params.consul-port=8500 +quarkus.stork.my-service.service-discovery.consul-host=localhost +quarkus.stork.my-service.service-discovery.consul-port=8500 quarkus.stork.my-service.load-balancer.type=round-robin ---- @@ -318,7 +318,7 @@ The first two lines provide the Consul location used by the `Registration` bean. The other properties are related to Stork. `stork.my-service.service-discovery` indicates which type of service discovery we will be using to locate the `my-service` service. In our case, it's `consul`. -`quarkus.stork.my-service.service-discovery.params.consul-host` and `quarkus.stork.my-service.service-discovery.params.consul-port` configures the access to Consul. +`quarkus.stork.my-service.service-discovery.consul-host` and `quarkus.stork.my-service.service-discovery.consul-port` configures the access to Consul. Finally, `quarkus.stork.my-service.load-balancer.type` configures the service selection. In our case, we use a `round-robin`. diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/stork/StorkDevModeTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/stork/StorkDevModeTest.java index 36cdc3f8c0e6c..f30d13b937008 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/stork/StorkDevModeTest.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/stork/StorkDevModeTest.java @@ -57,8 +57,8 @@ void shouldModifyStorkSettings() { // @formatter:on TEST.modifyResourceFile("application.properties", - v -> v.replaceAll("quarkus.stork.hello-service.service-discovery.params.address-list=.*", - "quarkus.stork.hello-service.service-discovery.params.address-list=localhost:8766")); + v -> v.replaceAll("quarkus.stork.hello-service.service-discovery.address-list=.*", + "quarkus.stork.hello-service.service-discovery.address-list=localhost:8766")); // @formatter:off when() .get("/helper") diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-application.properties b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-application.properties index 74753c1c5661f..93b9a46d1eabb 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-application.properties +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-application.properties @@ -1,5 +1,5 @@ quarkus.stork.hello-service.service-discovery.type=static -quarkus.stork.hello-service.service-discovery.params.address-list=${quarkus.http.host}:${quarkus.http.test-port} +quarkus.stork.hello-service.service-discovery.address-list=${quarkus.http.host}:${quarkus.http.test-port} quarkus.stork.hello-service.load-balancer.type=least-response-time hello2/mp-rest/url=stork://hello-service/hello diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-dev-application.properties b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-dev-application.properties index 1c9b733d9b675..ffd99080076ca 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-dev-application.properties +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-dev-application.properties @@ -1,5 +1,5 @@ quarkus.stork.hello-service.service-discovery.type=static -quarkus.stork.hello-service.service-discovery.params.address-list=${quarkus.http.host}:${quarkus.http.port} +quarkus.stork.hello-service.service-discovery.address-list=${quarkus.http.host}:${quarkus.http.port} quarkus.stork.hello-service.load-balancer.type=least-response-time hello2/mp-rest/url=stork://hello-service/hello diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-stat-lb.properties b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-stat-lb.properties index 5ffa35bfedc10..7451e73af5309 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-stat-lb.properties +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/resources/stork-stat-lb.properties @@ -1,4 +1,4 @@ quarkus.stork.hello-service.service-discovery.type=static -quarkus.stork.hello-service.service-discovery.params.address-list=${quarkus.http.host}:${quarkus.http.test-port},localhost:8766 +quarkus.stork.hello-service.service-discovery.address-list=${quarkus.http.host}:${quarkus.http.test-port},localhost:8766 quarkus.stork.hello-service.load-balancer.type=least-response-time hello2/mp-rest/url=stork://hello-service/hello diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkLoadBalancerConfiguration.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkLoadBalancerConfiguration.java index 185c7b2340410..5b51b7f105ba3 100644 --- a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkLoadBalancerConfiguration.java +++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkLoadBalancerConfiguration.java @@ -21,7 +21,7 @@ public class StorkLoadBalancerConfiguration { * Check the documentation of the selected load balancer type for available parameters * */ - @ConfigItem + @ConfigItem(name = ConfigItem.PARENT) public Map parameters; } diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkServiceDiscoveryConfiguration.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkServiceDiscoveryConfiguration.java index 6426542e16dbf..f415c961b3ae7 100644 --- a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkServiceDiscoveryConfiguration.java +++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkServiceDiscoveryConfiguration.java @@ -21,7 +21,7 @@ public class StorkServiceDiscoveryConfiguration { * Check the documentation of the selected service discovery type for available parameters. * */ - @ConfigItem + @ConfigItem(name = ConfigItem.PARENT) public Map params; } diff --git a/integration-tests/grpc-mutual-auth/src/main/resources/application.properties b/integration-tests/grpc-mutual-auth/src/main/resources/application.properties index 724628cbd3789..e7dc23731af7a 100644 --- a/integration-tests/grpc-mutual-auth/src/main/resources/application.properties +++ b/integration-tests/grpc-mutual-auth/src/main/resources/application.properties @@ -3,8 +3,8 @@ quarkus.grpc.clients.hello.override-authority=localhost quarkus.grpc.clients.hello.name-resolver=stork quarkus.stork."hello-service".service-discovery.type=static -quarkus.stork."hello-service".service-discovery.params.address-list=${quarkus.http.host}:9000 -%test.quarkus.stork."hello-service".service-discovery.params.address-list=${quarkus.http.host}:9001 +quarkus.stork."hello-service".service-discovery.address-list=${quarkus.http.host}:9000 +%test.quarkus.stork."hello-service".service-discovery.address-list=${quarkus.http.host}:9001 quarkus.stork."hello-service".load-balancer.type=round-robin quarkus.grpc.clients.hello.ssl.certificate=src/main/resources/tls/client.pem diff --git a/integration-tests/grpc-plain-text-mutiny/src/main/resources/application.properties b/integration-tests/grpc-plain-text-mutiny/src/main/resources/application.properties index 329e717ad40c7..a67a7b91363e0 100644 --- a/integration-tests/grpc-plain-text-mutiny/src/main/resources/application.properties +++ b/integration-tests/grpc-plain-text-mutiny/src/main/resources/application.properties @@ -4,6 +4,6 @@ quarkus.grpc.clients.hello.host=hello-service quarkus.grpc.clients.hello.name-resolver=stork quarkus.stork.hello-service.service-discovery.type=static -%test.quarkus.stork.hello-service.service-discovery.params.address-list=badd-url:9001,${quarkus.http.host}:9001 -quarkus.stork.hello-service.service-discovery.params.address-list=badd-url:9000,${quarkus.http.host}:9000 +%test.quarkus.stork.hello-service.service-discovery.address-list=badd-url:9001,${quarkus.http.host}:9001 +quarkus.stork.hello-service.service-discovery.address-list=badd-url:9000,${quarkus.http.host}:9000 quarkus.stork.hello-service.load-balancer.type=round-robin diff --git a/integration-tests/grpc-stork-response-time/src/main/resources/application.properties b/integration-tests/grpc-stork-response-time/src/main/resources/application.properties index 000f018d021f2..c717e692c3571 100644 --- a/integration-tests/grpc-stork-response-time/src/main/resources/application.properties +++ b/integration-tests/grpc-stork-response-time/src/main/resources/application.properties @@ -5,11 +5,11 @@ quarkus.grpc.clients.hello1.name-resolver=stork quarkus.grpc.clients.hello2.name-resolver=stork quarkus.stork.hello-service1.service-discovery.type=static -quarkus.stork.hello-service1.service-discovery.params.address-list=localhost:9013,localhost:9012 +quarkus.stork.hello-service1.service-discovery.address-list=localhost:9013,localhost:9012 quarkus.stork.hello-service1.load-balancer.type=least-response-time quarkus.stork.hello-service2.service-discovery.type=static -quarkus.stork.hello-service2.service-discovery.params.address-list=localhost:9013,localhost:9012 +quarkus.stork.hello-service2.service-discovery.address-list=localhost:9013,localhost:9012 quarkus.stork.hello-service2.load-balancer.type=least-response-time #quarkus.log.category."io.quarkus.grpc.runtime.stork".level=DEBUG diff --git a/integration-tests/rest-client-reactive-stork/src/main/resources/application.properties b/integration-tests/rest-client-reactive-stork/src/main/resources/application.properties index df26635d522c8..a32b231526f45 100644 --- a/integration-tests/rest-client-reactive-stork/src/main/resources/application.properties +++ b/integration-tests/rest-client-reactive-stork/src/main/resources/application.properties @@ -2,4 +2,4 @@ quarkus.stork.hello-service.service-discovery.type=my quarkus.stork.hello-service.load-balancer.type=least-response-time hello/mp-rest/url=stork://hello-service/hello # slow-service and fast-service come from Slow- and FastWiremockServer -quarkus.stork.hello-service.service-discovery.params.address-list=${slow-service},${fast-service} \ No newline at end of file +quarkus.stork.hello-service.service-discovery.address-list=${slow-service},${fast-service} \ No newline at end of file