Skip to content

Commit dbb4146

Browse files
committed
Sync documentation of main branch
1 parent 290614c commit dbb4146

9 files changed

+133
-21
lines changed

_generated-doc/main/config/quarkus-all-config.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56047,7 +56047,7 @@ endif::add-copy-button-to-config-props[]
5604756047

5604856048
[.description]
5604956049
--
56050-
The flavor to use (kind, k3s or api-only). Default to api-only.
56050+
The flavor to use (kind, k3s or api-only). If not set, Dev Services for Kubernetes will set it to: api-only.
5605156051

5605256052

5605356053
ifdef::add-copy-button-to-env-var[]
@@ -56058,7 +56058,7 @@ Environment variable: `+++QUARKUS_KUBERNETES_CLIENT_DEVSERVICES_FLAVOR+++`
5605856058
endif::add-copy-button-to-env-var[]
5605956059
--
5606056060
a|tooltip:kind[kind (needs priviledge docker)], tooltip:k3s[k3s (needs priviledge docker)], tooltip:api-only[api only]
56061-
|tooltip:api-only[api only]
56061+
|
5606256062

5606356063
a|icon:lock[title=Fixed at build time] [[quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig]] [.property-path]##link:#quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig[`quarkus.kubernetes-client.devservices.override-kubeconfig`]##
5606456064
ifdef::add-copy-button-to-config-props[]
@@ -81231,7 +81231,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT_CONNECTION_POOL_SIZE+++`
8123181231
endif::add-copy-button-to-env-var[]
8123281232
--
8123381233
|int
81234-
|
81234+
|`50`
8123581235

8123681236
a| [[quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled[`quarkus.rest-client.keep-alive-enabled`]##
8123781237
ifdef::add-copy-button-to-config-props[]
@@ -82346,7 +82346,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT__CLIENT__CONNECTION_POOL_SIZE+++`
8234682346
endif::add-copy-button-to-env-var[]
8234782347
--
8234882348
|int
82349-
|
82349+
|`50`
8235082350

8235182351
a| [[quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled[`quarkus.rest-client."client".keep-alive-enabled`]##
8235282352
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-kubernetes-client.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ endif::add-copy-button-to-config-props[]
607607

608608
[.description]
609609
--
610-
The flavor to use (kind, k3s or api-only). Default to api-only.
610+
The flavor to use (kind, k3s or api-only). If not set, Dev Services for Kubernetes will set it to: api-only.
611611

612612

613613
ifdef::add-copy-button-to-env-var[]
@@ -618,7 +618,7 @@ Environment variable: `+++QUARKUS_KUBERNETES_CLIENT_DEVSERVICES_FLAVOR+++`
618618
endif::add-copy-button-to-env-var[]
619619
--
620620
a|tooltip:kind[kind (needs priviledge docker)], tooltip:k3s[k3s (needs priviledge docker)], tooltip:api-only[api only]
621-
|tooltip:api-only[api only]
621+
|
622622

623623
a|icon:lock[title=Fixed at build time] [[quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig]] [.property-path]##link:#quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig[`quarkus.kubernetes-client.devservices.override-kubeconfig`]##
624624
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-kubernetes-client_quarkus.kubernetes-client.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ endif::add-copy-button-to-config-props[]
607607

608608
[.description]
609609
--
610-
The flavor to use (kind, k3s or api-only). Default to api-only.
610+
The flavor to use (kind, k3s or api-only). If not set, Dev Services for Kubernetes will set it to: api-only.
611611

612612

613613
ifdef::add-copy-button-to-env-var[]
@@ -618,7 +618,7 @@ Environment variable: `+++QUARKUS_KUBERNETES_CLIENT_DEVSERVICES_FLAVOR+++`
618618
endif::add-copy-button-to-env-var[]
619619
--
620620
a|tooltip:kind[kind (needs priviledge docker)], tooltip:k3s[k3s (needs priviledge docker)], tooltip:api-only[api only]
621-
|tooltip:api-only[api only]
621+
|
622622

623623
a|icon:lock[title=Fixed at build time] [[quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig]] [.property-path]##link:#quarkus-kubernetes-client_quarkus-kubernetes-client-devservices-override-kubeconfig[`quarkus.kubernetes-client.devservices.override-kubeconfig`]##
624624
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-kubernetes-client_quarkus.kubernetes-client.devservices.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif::add-copy-button-to-config-props[]
5757

5858
[.description]
5959
--
60-
The flavor to use (kind, k3s or api-only). Default to api-only.
60+
The flavor to use (kind, k3s or api-only). If not set, Dev Services for Kubernetes will set it to: api-only.
6161

6262

6363
ifdef::add-copy-button-to-env-var[]
@@ -68,7 +68,7 @@ Environment variable: `+++QUARKUS_KUBERNETES_CLIENT_DEVSERVICES_FLAVOR+++`
6868
endif::add-copy-button-to-env-var[]
6969
--
7070
a|tooltip:kind[kind (needs priviledge docker)], tooltip:k3s[k3s (needs priviledge docker)], tooltip:api-only[api only]
71-
|tooltip:api-only[api only]
71+
|
7272

7373
a|icon:lock[title=Fixed at build time] [[quarkus-kubernetes-client_quarkus-kubernetes-client-devservices_quarkus-kubernetes-client-devservices-override-kubeconfig]] [.property-path]##link:#quarkus-kubernetes-client_quarkus-kubernetes-client-devservices_quarkus-kubernetes-client-devservices-override-kubeconfig[`quarkus.kubernetes-client.devservices.override-kubeconfig`]##
7474
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-rest-client-config.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT_CONNECTION_POOL_SIZE+++`
333333
endif::add-copy-button-to-env-var[]
334334
--
335335
|int
336-
|
336+
|`50`
337337

338338
a| [[quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled[`quarkus.rest-client.keep-alive-enabled`]##
339339
ifdef::add-copy-button-to-config-props[]
@@ -1448,7 +1448,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT__CLIENT__CONNECTION_POOL_SIZE+++`
14481448
endif::add-copy-button-to-env-var[]
14491449
--
14501450
|int
1451-
|
1451+
|`50`
14521452

14531453
a| [[quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled[`quarkus.rest-client."client".keep-alive-enabled`]##
14541454
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-rest-client-config_quarkus.rest-client.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT_CONNECTION_POOL_SIZE+++`
333333
endif::add-copy-button-to-env-var[]
334334
--
335335
|int
336-
|
336+
|`50`
337337

338338
a| [[quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-keep-alive-enabled[`quarkus.rest-client.keep-alive-enabled`]##
339339
ifdef::add-copy-button-to-config-props[]
@@ -1448,7 +1448,7 @@ Environment variable: `+++QUARKUS_REST_CLIENT__CLIENT__CONNECTION_POOL_SIZE+++`
14481448
endif::add-copy-button-to-env-var[]
14491449
--
14501450
|int
1451-
|
1451+
|`50`
14521452

14531453
a| [[quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled]] [.property-path]##link:#quarkus-rest-client-config_quarkus-rest-client-client-keep-alive-enabled[`quarkus.rest-client."client".keep-alive-enabled`]##
14541454
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5386,7 +5386,7 @@ _No Javadoc found_
53865386
a| https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes-client/spi/src/main/java/io/quarkus/kubernetes/client/spi/KubernetesDevServiceInfoBuildItem.java[`io.quarkus.kubernetes.client.spi.KubernetesDevServiceInfoBuildItem`, window="_blank"]
53875387
[.description]
53885388
--
5389-
_No Javadoc found_
5389+
BuildItem packaging the information of the kind test container created
53905390
-- a|`java.lang.String kubeConfig`
53915391
53925392
_No Javadoc found_
@@ -5398,6 +5398,17 @@ _No Javadoc found_
53985398

53995399

54005400

5401+
a| https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes-client/spi/src/main/java/io/quarkus/kubernetes/client/spi/KubernetesDevServiceRequestBuildItem.java[`io.quarkus.kubernetes.client.spi.KubernetesDevServiceRequestBuildItem`, window="_blank"]
5402+
[.description]
5403+
--
5404+
BuildItem managing the Kubernetes DevService Request information for the extension consuming it
5405+
-- a|`java.lang.String flavor`
5406+
5407+
_No Javadoc found_
5408+
5409+
5410+
5411+
54015412
a| https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes-client/spi/src/main/java/io/quarkus/kubernetes/client/spi/KubernetesResourcesBuildItem.java[`io.quarkus.kubernetes.client.spi.KubernetesResourcesBuildItem`, window="_blank"]
54025413
[.description]
54035414
--

_versions/main/guides/kubernetes-dev-services.adoc

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ include::_attributes.adoc[]
1010
:topics: dev-services,kubernetes,testing,dev-mode
1111
:extensions: io.quarkus:quarkus-kubernetes-client
1212

13-
Dev Services for Kubernetes automatically starts a Kubernetes API server in dev mode and when running tests.
14-
So you don't have to start a Kubernetes cluster manually.
13+
Dev Services for Kubernetes automatically starts a Kubernetes API server (plus the required etcd) in dev mode and when running tests. So you don't have to start it manually.
1514
The application is configured automatically.
1615

16+
The following https://github.com/dajudge/kindcontainer?tab=readme-ov-file#container-flavors[testcontainers] are supported: https://kind.sigs.k8s.io/[kind], https://k3s.io/[k3s] or api only(default)
17+
1718
== Enabling / Disabling Dev Services for Kubernetes
1819

1920
Dev Services for Kubernetes is automatically enabled unless:
@@ -23,9 +24,9 @@ Dev Services for Kubernetes is automatically enabled unless:
2324
- a valid Kube config file is found and `quarkus.kubernetes-client.devservices.override-kubeconfig` is not set to `true`
2425
- you include the `quarkus-test-kubernetes-client` dependency
2526

26-
Dev Services for Kubernetes relies on Docker to start the API server.
27-
If your environment does not support Docker, you will need to start the Kubernetes cluster manually, or connect to an already running Kubernetes cluster.
28-
You can configure the Kubernetes cluster access using either a Kube config file or the various properties available in the https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes-client/runtime-internal/src/main/java/io/quarkus/kubernetes/client/runtime/KubernetesClientBuildConfig.java[KubernetesClientBuildConfig] class.
27+
NOTE: Dev Services for Kubernetes relies on a container engine: Docker or Podman to start the server.
28+
If your environment does not support such a container engine, you will have to start a Kubernetes cluster running in a VM, in the cloud, etc.
29+
In this case, you can configure the Kubernetes cluster access using either a Kube config file or the various properties available in the https://github.com/quarkusio/quarkus/blob/main/extensions/kubernetes-client/runtime-internal/src/main/java/io/quarkus/kubernetes/client/runtime/KubernetesClientBuildConfig.java[KubernetesClientBuildConfig] class.
2930

3031
== Shared cluster
3132

@@ -41,6 +42,51 @@ The default service name is `kubernetes`.
4142
Sharing is enabled by default in dev mode, but disabled in test mode.
4243
You can disable the sharing with `quarkus.kubernetes-client.devservices.shared=false`.
4344

45+
== What else for the developers
46+
47+
If you would like to develop test cases running top of the kubernetes cluster (launched as test container by the Dev Service), then add the following dependencies to your pom file
48+
49+
[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
50+
.pom.xml
51+
----
52+
<dependency>
53+
<groupId>io.quarkus</groupId>
54+
<artifactId>quarkus-kubernetes-client</artifactId>
55+
</dependency>
56+
----
57+
58+
and set the Quarkus properties to select the flavor, or kube version.
59+
60+
Then you will be able to create a Fabric8 Kubernetes Client object able to perform many kube tasks as detailed part of this https://github.com/fabric8io/kubernetes-client/blob/main/doc/CHEATSHEET.md[cheat sheet].
61+
62+
.Simple Bean Example
63+
[source,java]
64+
----
65+
package org.acme;
66+
67+
import org.junit.jupiter.api.Test;
68+
69+
import io.fabric8.kubernetes.api.model.*;
70+
import io.fabric8.kubernetes.client.KubernetesClient;
71+
import io.quarkus.test.junit.QuarkusTest;
72+
73+
@QuarkusTest
74+
public class ArgocdExtensionDevModeTest {
75+
76+
@Inject
77+
private KubernetesClient client;
78+
79+
@Test
80+
public void testCreatePod() {
81+
client.resource(new PodBuilder()
82+
.withMetadata(<METADATA_OBJECT>)
83+
.withSpec(<SPEC_OBJECT>)
84+
.build())
85+
.inNamespace(<USER_NAMESPACE>)
86+
.create();
87+
}
88+
----
89+
4490
== Configuring the cluster
4591

4692
Dev Services for Kubernetes provides three different flavors of Kubernetes cluster. Each flavor supports different Kubernetes API versions.
@@ -52,7 +98,7 @@ quarkus.kubernetes-client.devservices.flavor=api-only # k3s or kind
5298
quarkus.kubernetes-client.devservices.api-version=1.22
5399
----
54100

55-
`api-only` only starts a Kubernetes API Server. If you need a fully-featured Kubernetes cluster that can spin up Pods, you can use `k3s` or `kind`. Note that they both requires to run in Docker privileged mode.
101+
`api-only` only starts a Kubernetes API Server (plus the required etcd). If you need a fully-featured Kubernetes cluster that can spin up Pods, you can use `k3s` or `kind`. `k3s` requires to start the container with `privileged mode`. The `kind` test container supports now to use podman rootless or rootfull.
56102

57103
If `api-version` is not set, the latest version for the given flavor will be used. Otherwise, the version must match a https://github.com/dajudge/kindcontainer/blob/master/k8s-versions.json[version supported by the given flavor].
58104

_versions/main/guides/testing-components.adoc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,59 @@ public class FooTest {
232232
Sometimes you need the full control over the bean attributes and maybe even configure the default mock behavior.
233233
You can use the mock configurator API via the `QuarkusComponentTestExtensionBuilder#mock()` method.
234234

235+
== Nested Tests
236+
237+
JUnit 5 https://junit.org/junit5/docs/current/user-guide/#writing-tests-nested[@Nested tests] may help to structure more complex test scenarios.
238+
However, only basic use cases are tested with `@QuarkusComponentTest`.
239+
240+
.Nested test
241+
[source, java]
242+
----
243+
import static org.junit.jupiter.api.Assertions.assertEquals;
244+
245+
import jakarta.inject.Inject;
246+
import io.quarkus.test.InjectMock;
247+
import io.quarkus.test.component.TestConfigProperty;
248+
import io.quarkus.test.component.QuarkusComponentTest;
249+
import org.junit.jupiter.api.Test;
250+
import org.mockito.Mockito;
251+
252+
@QuarkusComponentTest <1>
253+
@TestConfigProperty(key = "bar", value = "true") <2>
254+
public class FooTest {
255+
256+
@Inject
257+
Foo foo; <3>
258+
259+
@InjectMock
260+
Charlie charlieMock; <4>
261+
262+
@Nested
263+
class PingTest {
264+
265+
@Test
266+
public void testPing() {
267+
Mockito.when(charlieMock.ping()).thenReturn("OK");
268+
assertEquals("OK", foo.ping());
269+
}
270+
}
271+
272+
@Nested
273+
class PongTest {
274+
275+
@Test
276+
public void testPong() {
277+
Mockito.when(charlieMock.pong()).thenReturn("NOK");
278+
assertEquals("NOK", foo.pong());
279+
}
280+
}
281+
}
282+
----
283+
<1> The `QuarkusComponentTest` annotation registers the JUnit extension.
284+
<2> Sets a configuration property for the test.
285+
<3> The test injects the component under the test. `Foo` injects `Charlie`.
286+
<4> The test also injects a mock for `Charlie`. The injected reference is an "unconfigured" Mockito mock.
287+
235288
== Configuration
236289

237290
You can set the configuration properties for a test with the `@io.quarkus.test.component.TestConfigProperty` annotation or with the `QuarkusComponentTestExtensionBuilder#configProperty(String, String)` method.
@@ -240,6 +293,8 @@ If you only need to use the default values for missing config properties, then t
240293
It is also possible to set configuration properties for a test method with the `@io.quarkus.test.component.TestConfigProperty` annotation.
241294
However, if the test instance lifecycle is `Lifecycle#_PER_CLASS` this annotation can only be used on the test class and is ignored on test methods.
242295

296+
NOTE: `@io.quarkus.test.component.TestConfigProperty` declared on a `@Nested` test class is always ignored.
297+
243298
CDI beans are also automatically registered for all injected https://smallrye.io/smallrye-config/Main/config/mappings/[Config Mappings]. The mappings are populated with the test configuration properties.
244299

245300
== Mocking CDI Interceptors

0 commit comments

Comments
 (0)