Skip to content

Commit 450523f

Browse files
authored
[DOC] Contributing guide update to describe Custom Resource API Reference build (strimzi#3541)
* [DOC] Contributing guide update to describe Custom Resource API Reference build Signed-off-by: prmellor <[email protected]> * review edits JS Signed-off-by: prmellor <[email protected]> * review edits DL Signed-off-by: prmellor <[email protected]>
1 parent a30ff98 commit 450523f

File tree

2 files changed

+76
-15
lines changed

2 files changed

+76
-15
lines changed

documentation/contributing/introduction.adoc

+68-11
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,20 @@ Assemblies, which usually encapsulate a feature or process, bring the related co
3636
An assembly is like a sub-section or chapter in a book.
3737
For example, the _Deploying Strimzi_ guide has a chapter called _Verifying the Strimzi deployment_, which is contained in its own assembly.
3838

39+
.Documentation folder descriptions
3940
[source,options="nowrap",subs="+quotes"]
4041
----
41-
contributing/ # Documentation contributor guide (this book)
42-
deploying/ # Deploying Strimzi
43-
quickstart/ # Strimzi Quick Start guide
44-
overview/ # Strimzi Overview guide
45-
using/ # Using Strimzi
46-
assemblies/ # Assemblies provide content for all guides
47-
modules/ # Modules provide the content for assemblies
48-
shared/ # Shared include files
49-
shared/attributes.adoc # Global book attributes
50-
shared/images/ # Shared image files
42+
api/ # Property descriptions for the Custom Resource API Reference section of the Using Strimzi guide
43+
contributing/ # Documentation contributor guide (this book)
44+
deploying/ # Deploying Strimzi
45+
quickstart/ # Strimzi Quick Start guide
46+
overview/ # Strimzi Overview guide
47+
using/ # Using Strimzi
48+
assemblies/ # Assemblies provide content for all guides
49+
modules/ # Modules provide the content for assemblies
50+
shared/ # Shared include files
51+
shared/attributes.adoc # Global book attributes
52+
shared/images/ # Shared image files
5153
----
5254

5355
=== Strimzi Overview guide
@@ -80,4 +82,59 @@ In contrast to the _Deploying_ guide, this guide provides a reduced set of instr
8082

8183
The _Using Strimzi_ guide provides configuration instructions for Kafka components, and instructions for using Strimzi Operators.
8284
The majority of the content relates to how you might want to modify your deployment and introduce additional features, such as Cruise Control or distributed tracing.
83-
The _Using Strimzi_ guide also contains the API reference guide which is generated directly from the Java code of the operators.
85+
86+
=== Custom Resource API Reference
87+
88+
The _Using Strimzi_ guide (documentation/using/master.adoc) also contains a _Custom Resource API Reference_ that describes the configuration properties for custom resources.
89+
90+
The _Custom Resource API Reference_ is built from two files.
91+
92+
.Custom Resource API Reference files
93+
[source,asciidoc,options="nowrap"]
94+
----
95+
\include::modules/con-common-configuration-properties.adoc[leveloffset=+1]
96+
\include::modules/appendix_crds.adoc[]
97+
----
98+
99+
The `con-common-configuration-properties.adoc` file contains descriptions of common configuration properties.
100+
The content for the `documentation/modules/appendix_crds.adoc` file is generated directly from descriptions in the Java code.
101+
102+
Java files in the `api/` folder are annotated so that the descriptions are picked up in the build.
103+
104+
.Java annotations for documentation
105+
[source,java,options="nowrap"]
106+
----
107+
import io.strimzi.crdgenerator.annotations.Description;
108+
import io.strimzi.crdgenerator.annotations.DescriptionFile;
109+
----
110+
111+
The tables in `appendix_crds.adoc` are built from `@Description` annotations in the Java files.
112+
113+
Additional information is included by adding:
114+
115+
. An `@DescriptionFile` annotation to the Java file
116+
. A corresponding description file (`.adoc`) in the `documentation/api/` folder
117+
. An `include:__DESCRIPTION-FILE-NAME__` reference to the `appendix_crds.adoc`
118+
119+
The `include:__DESCRIPTION-FILE-NAME__` reference is added automatically by the Maven build, so you do not need to add it manually.
120+
121+
For example, to add additional configuration for the `KafkaUserQuotas` custom resource:
122+
123+
. `api/src/main/java/io/strimzi/api/kafka/model/KafkaUserQuotas.java` contains:
124+
** `import io.strimzi.crdgenerator.annotations.Description`
125+
** `import io.strimzi.crdgenerator.annotations.DescriptionFile`
126+
** `@Description("_descriptions for individual properties..._");`
127+
** An `@DescriptionFile` annotation
128+
. `documentation/api` includes the `io.strimzi.api.kafka.model.KafkaUserQuotas.adoc` file containing the additional configuration description.
129+
+
130+
The description file requires the same name as the related Java package.
131+
. `appendix_crds.adoc` contains a reference to include the additional configuration description:
132+
+
133+
[source,asciidoc,options="nowrap"]
134+
----
135+
### `KafkaUserQuotas` schema reference
136+
137+
/include::../api/io.strimzi.api.kafka.model.KafkaUserQuotas.adoc[leveloffset=+1]
138+
----
139+
140+
If you change anything in the `api` module of the Java code, you must rebuild the _Custom Resource API Reference_ using a xref:make-tooling[make command].

documentation/contributing/make-tooling.adoc

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ Make is a useful tool for building your documentation and pushing it to a public
1212
`make docu_html`:: Generate the HTML version of all the guides (the HTML files can be found in `documentation/html)
1313
`make docu_htmlnoheader`:: Generate the HTML version of all the guides without the HTML headers so they are suitable for including into a website (the HTML files can be found in `documentation/htmlnoheader)
1414

15-
== Generate the API Reference
15+
== Generate the Custom Resource API Reference
1616

17-
The API Reference is stored in the `documentation/modules/appendix_crds.adoc` file.
17+
The `documentation/modules/appendix_crds.adoc` file provides the main content for the _Custom Resource API Reference_.
1818
It is generated directly from the Java code when building the operators.
19-
If you change the Strimzi API, you need to regenerate the API Reference with following command:
19+
20+
If you change the Strimzi API, you need to regenerate the API Reference before submitting your PR by running the following from the root:
2021

2122
[source,shell,subs=attributes+]
2223
----
2324
mvn clean -DskipTests install
25+
make crd_install
2426
----
2527

26-
NOTE: You have to generate the API Reference only if you changed anything in the `api` module of the Java code.
28+
The build uses https://github.com/mikefarah/yq[`yq`^], so make sure it is kept up-to-date for it to work properly.
29+
30+
NOTE: You only have to generate the _Custom Resource API Reference_ if you changed anything in the `api` module of the Java code.

0 commit comments

Comments
 (0)