Skip to content

Commit 3b19de6

Browse files
committed
fix(cmd): trait doc generation
Closes #6489
1 parent 8d40b60 commit 3b19de6

35 files changed

Lines changed: 251 additions & 160 deletions

cmd/util/doc-gen/generators/traitdocgen.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ func writeFields(t *types.Type, traitID string, content *[]string) {
230230
res = append(res, "|Property | Type | Description", "")
231231
writeMembers(t, traitID, &res)
232232
res = append(res, "|===", "", adocConfigurationMarkerEnd)
233+
res = append(res, "")
234+
res = append(res, "NOTE: the variable names are \"snake case\" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`")
235+
res = append(res, "")
233236
res = append(res, post...)
234237
*content = res
235238
}
@@ -245,7 +248,14 @@ func writeMembers(t *types.Type, traitID string, content *[]string) {
245248
if strings.Contains(prop, "squash") {
246249
writeMembers(m.Type, traitID, &res)
247250
} else {
248-
res = append(res, "| "+traitID+"."+prop)
251+
// get the json instead of property
252+
json := reflect.StructTag(m.Tags).Get("json")
253+
if json == "" {
254+
continue
255+
}
256+
jsonName := strings.Split(json, ",")[0]
257+
258+
res = append(res, "| "+traitID+"."+jsonName)
249259
res = append(res, "| "+strings.TrimPrefix(m.Type.Name.Name, "*"))
250260
first := true
251261
for _, l := range filterOutTagsAndComments(m.CommentLines) {

docs/modules/traits/pages/affinity.adoc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ The following configuration options are available:
3030
| bool
3131
| Can be used to enable or disable a trait. All traits share this common property.
3232

33-
| affinity.pod-affinity
33+
| affinity.podAffinity
3434
| bool
3535
| Always co-locates multiple replicas of the integration in the same node (default `false`).
3636

37-
| affinity.pod-anti-affinity
37+
| affinity.podAntiAffinity
3838
| bool
3939
| Never co-locates multiple replicas of the integration in the same node (default `false`).
4040

41-
| affinity.node-affinity-labels
41+
| affinity.nodeAffinityLabels
4242
| []string
4343
| Defines a set of nodes the integration pod(s) are eligible to be scheduled on, based on labels on the node.
4444

45-
| affinity.pod-affinity-labels
45+
| affinity.podAffinityLabels
4646
| []string
4747
| Defines a set of pods (namely those matching the label selector, relative to the given namespace) that the
4848
integration pod(s) should be co-located with.
4949

50-
| affinity.pod-anti-affinity-labels
50+
| affinity.podAntiAffinityLabels
5151
| []string
5252
| Defines a set of pods (namely those matching the label selector, relative to the given namespace) that the
5353
integration pod(s) should not be co-located with.
@@ -56,6 +56,9 @@ integration pod(s) should not be co-located with.
5656

5757
// End of autogenerated code - DO NOT EDIT! (configuration)
5858

59+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`
60+
61+
5962
== Examples
6063

6164
* To schedule the integration pod(s) on a specific node using the https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels[built-in node label] `kubernetes.io/hostname`:

docs/modules/traits/pages/builder.adoc

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,44 +44,44 @@ Deprecated: no longer in use
4444
| string
4545
| The strategy to use, either `pod` or `routine` (default `routine`)
4646

47-
| builder.base-image
47+
| builder.baseImage
4848
| string
4949
| Specify a base image. In order to have the application working properly it must be a container image which has a Java JDK
5050
installed and ready to use on path (ie `/usr/bin/java`).
5151

52-
| builder.incremental-image-build
52+
| builder.incrementalImageBuild
5353
| bool
5454
| Use the incremental image build option, to reuse existing containers (default `true`)
5555

56-
| builder.order-strategy
56+
| builder.orderStrategy
5757
| string
5858
| The build order strategy to use, either `dependencies`, `fifo` or `sequential` (default is the platform default)
5959

60-
| builder.request-cpu
60+
| builder.requestCPU
6161
| string
6262
| When using `pod` strategy, the minimum amount of CPU required by the pod builder.
6363

6464
Deprecated: use TasksRequestCPU instead with task name `builder`.
6565

66-
| builder.request-memory
66+
| builder.requestMemory
6767
| string
6868
| When using `pod` strategy, the minimum amount of memory required by the pod builder.
6969

7070
Deprecated: use TasksRequestCPU instead with task name `builder`.
7171

72-
| builder.limit-cpu
72+
| builder.limitCPU
7373
| string
7474
| When using `pod` strategy, the maximum amount of CPU required by the pod builder.
7575

7676
Deprecated: use TasksRequestCPU instead with task name `builder`.
7777

78-
| builder.limit-memory
78+
| builder.limitMemory
7979
| string
8080
| When using `pod` strategy, the maximum amount of memory required by the pod builder.
8181

8282
Deprecated: use TasksRequestCPU instead with task name `builder`.
8383

84-
| builder.maven-profiles
84+
| builder.mavenProfiles
8585
| []string
8686
| A list of references pointing to configmaps/secrets that contains a maven profile.
8787
This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
@@ -92,29 +92,29 @@ Syntax: [configmap\|secret]:name[/key], where name represents the resource name,
9292
| []string
9393
| A list of tasks to be executed (available only when using `pod` strategy) with format `<name>;<container-image>;<container-command>`.
9494

95-
| builder.tasks-filter
95+
| builder.tasksFilter
9696
| string
9797
| A list of tasks sorted by the order of execution in a csv format, ie, `<taskName1>,<taskName2>,...`.
9898
Mind that you must include also the operator tasks (`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
9999
if you need to execute them. Useful only with `pod` strategy.
100100

101-
| builder.tasks-request-cpu
101+
| builder.tasksRequestCPU
102102
| []string
103103
| A list of request cpu configuration for the specific task with format `<task-name>:<request-cpu-conf>`.
104104

105-
| builder.tasks-request-memory
105+
| builder.tasksRequestMemory
106106
| []string
107107
| A list of request memory configuration for the specific task with format `<task-name>:<request-memory-conf>`.
108108

109-
| builder.tasks-limit-cpu
109+
| builder.tasksLimitCPU
110110
| []string
111111
| A list of limit cpu configuration for the specific task with format `<task-name>:<limit-cpu-conf>`.
112112

113-
| builder.tasks-limit-memory
113+
| builder.tasksLimitMemory
114114
| []string
115115
| A list of limit memory configuration for the specific task with format `<task-name>:<limit-memory-conf>`.
116116

117-
| builder.node-selector
117+
| builder.nodeSelector
118118
| map[string]string
119119
| Defines a set of nodes the builder pod is eligible to be scheduled on, based on labels on the node.
120120

@@ -130,6 +130,9 @@ if you need to execute them. Useful only with `pod` strategy.
130130

131131
// End of autogenerated code - DO NOT EDIT! (configuration)
132132

133+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`
134+
135+
133136
== Node Selectors
134137

135138
With this trait you will also be able to define node selectors for the `builder` pod when using the `pod`` build strategy.

docs/modules/traits/pages/camel.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ The following configuration options are available:
2929
| bool
3030
| Deprecated: no longer in use.
3131

32-
| camel.runtime-provider
32+
| camel.runtimeProvider
3333
| string
3434
| The runtime provider to use for the integration. (Default, Camel K Runtime).
3535

36-
| camel.runtime-version
36+
| camel.runtimeVersion
3737
| string
3838
| The runtime version to use for the integration. It overrides the default version set in the Integration Platform.
3939
You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve
@@ -46,3 +46,5 @@ to the best matching Catalog existing on the cluster (Default, the one provided
4646
|===
4747

4848
// End of autogenerated code - DO NOT EDIT! (configuration)
49+
50+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/container.adoc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ The following configuration options are available:
3535
| bool
3636
| To automatically enable the trait
3737

38-
| container.request-cpu
38+
| container.requestCPU
3939
| string
4040
| The minimum amount of CPU required (default 125 millicores).
4141

42-
| container.request-memory
42+
| container.requestMemory
4343
| string
4444
| The minimum amount of memory required (default 128 Mi).
4545

46-
| container.limit-cpu
46+
| container.limitCPU
4747
| string
4848
| The maximum amount of CPU to be provided (default 500 millicores).
4949

50-
| container.limit-memory
50+
| container.limitMemory
5151
| string
5252
| The maximum amount of memory to be provided (default 512 Mi).
5353

@@ -66,16 +66,16 @@ Don't use in Knative based environments.
6666
| int32
6767
| To configure a different http port exposed by the container (default `8080`).
6868

69-
| container.port-name
69+
| container.portName
7070
| string
7171
| To configure a different http port name for the port exposed by the container.
7272
It defaults to `http` only when the `expose` parameter is true.
7373

74-
| container.service-port
74+
| container.servicePort
7575
| int32
7676
| To configure under which service port the http container port is to be exposed (default `80`).
7777

78-
| container.service-port-name
78+
| container.servicePortName
7979
| string
8080
| To configure under which service port name the http container port is to be exposed (default `http`).
8181

@@ -89,34 +89,36 @@ It defaults to `http` only when the `expose` parameter is true.
8989
won't be able to execute traits requiring CamelCatalog. If the container image you're using is coming from an IntegrationKit, use instead
9090
Integration `.spec.integrationKit` parameter. If you're moving the Integration across environments, you will also need to create an "external" IntegrationKit.
9191

92-
| container.image-pull-policy
92+
| container.imagePullPolicy
9393
| PullPolicy
9494
| The pull policy: Always\|Never\|IfNotPresent
9595

96-
| container.run-as-user
96+
| container.runAsUser
9797
| int64
9898
| Security Context RunAsUser configuration (default none): this value is automatically retrieved in Openshift clusters when not explicitly set.
9999

100-
| container.run-as-non-root
100+
| container.runAsNonRoot
101101
| bool
102102
| Security Context RunAsNonRoot configuration (default false).
103103

104-
| container.seccomp-profile-type
104+
| container.seccompProfileType
105105
| SeccompProfileType
106106
| Security Context SeccompProfileType configuration (default RuntimeDefault).
107107

108-
| container.allow-privilege-escalation
108+
| container.allowPrivilegeEscalation
109109
| bool
110110
| Security Context AllowPrivilegeEscalation configuration (default false).
111111

112-
| container.capabilities-drop
112+
| container.capabilitiesDrop
113113
| []k8s.io/api/core/v1.Capability
114114
| Security Context Capabilities Drop configuration (default ALL).
115115

116-
| container.capabilities-add
116+
| container.capabilitiesAdd
117117
| []k8s.io/api/core/v1.Capability
118118
| Security Context Capabilities Add configuration (default none).
119119

120120
|===
121121

122122
// End of autogenerated code - DO NOT EDIT! (configuration)
123+
124+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/cron.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Supported components are currently: `cron`, `timer` and `quartz`.
6363
| Use the default Camel implementation of the `cron` endpoint (`quartz`) instead of trying to materialize the integration
6464
as Kubernetes CronJob.
6565

66-
| cron.concurrency-policy
66+
| cron.concurrencyPolicy
6767
| string
6868
| Specifies how to treat concurrent executions of a Job.
6969
Valid values are:
@@ -79,22 +79,24 @@ either starting from a periodic consumer (only `cron`, `timer` and `quartz` are
7979
It's required that all periodic consumers have the same period, and it can be expressed as cron schedule (e.g. `1m` can be expressed as `0/1 * * * *`,
8080
while `35m` or `50s` cannot).
8181

82-
| cron.starting-deadline-seconds
82+
| cron.startingDeadlineSeconds
8383
| int64
8484
| Optional deadline in seconds for starting the job if it misses scheduled
8585
time for any reason. Missed jobs executions will be counted as failed ones.
8686

87-
| cron.active-deadline-seconds
87+
| cron.activeDeadlineSeconds
8888
| int64
8989
| Specifies the duration in seconds, relative to the start time, that the job
9090
may be continuously active before it is considered to be failed.
9191
It defaults to 60s.
9292

93-
| cron.backoff-limit
93+
| cron.backoffLimit
9494
| int32
9595
| Specifies the number of retries before marking the job failed.
9696
It defaults to 2.
9797

9898
|===
9999

100100
// End of autogenerated code - DO NOT EDIT! (configuration)
101+
102+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/deployer.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ when creating the resources for running the integration.
3737

3838
Deprecated: this feature will be removed in future releases.
3939

40-
| deployer.use-ssa
40+
| deployer.useSSA
4141
| bool
4242
| Deprecated: no longer in use.
4343

4444
|===
4545

4646
// End of autogenerated code - DO NOT EDIT! (configuration)
47+
48+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/deployment.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The following configuration options are available:
3030
| bool
3131
| Deprecated: no longer in use.
3232

33-
| deployment.progress-deadline-seconds
33+
| deployment.progressDeadlineSeconds
3434
| int32
3535
| The maximum time in seconds for the deployment to make progress before it
3636
is considered to be failed. It defaults to `60s`.
@@ -39,15 +39,15 @@ is considered to be failed. It defaults to `60s`.
3939
| DeploymentStrategyType
4040
| The deployment strategy to use to replace existing pods with new ones.
4141

42-
| deployment.rolling-update-max-unavailable
42+
| deployment.rollingUpdateMaxUnavailable
4343
| k8s.io/apimachinery/pkg/util/intstr.IntOrString
4444
| The maximum number of pods that can be unavailable during the update.
4545
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
4646
Absolute number is calculated from percentage by rounding down.
4747
This can not be 0 if MaxSurge is 0.
4848
Defaults to `25%`.
4949

50-
| deployment.rolling-update-max-surge
50+
| deployment.rollingUpdateMaxSurge
5151
| k8s.io/apimachinery/pkg/util/intstr.IntOrString
5252
| The maximum number of pods that can be scheduled above the desired number of
5353
pods.
@@ -59,3 +59,5 @@ Defaults to `25%`.
5959
|===
6060

6161
// End of autogenerated code - DO NOT EDIT! (configuration)
62+
63+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/environment.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ The following configuration options are available:
3030
| bool
3131
| Deprecated: no longer in use.
3232

33-
| environment.container-meta
33+
| environment.containerMeta
3434
| bool
3535
| Enables injection of `NAMESPACE` and `POD_NAME` environment variables (default `true`)
3636

37-
| environment.http-proxy
37+
| environment.httpProxy
3838
| bool
3939
| Propagates the `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables (default `true`)
4040

@@ -48,3 +48,5 @@ These take precedence over any previously defined environment variables.
4848
|===
4949

5050
// End of autogenerated code - DO NOT EDIT! (configuration)
51+
52+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

docs/modules/traits/pages/gateway.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following configuration options are available:
3131
| bool
3232
| Can be used to enable or disable a trait. All traits share this common property.
3333

34-
| gateway.class-name
34+
| gateway.className
3535
| string
3636
| The class name to use for the gateway configuration.
3737

@@ -42,3 +42,5 @@ The following configuration options are available:
4242
|===
4343

4444
// End of autogenerated code - DO NOT EDIT! (configuration)
45+
46+
NOTE: the variables names are "snake case" if you're using in `kamel` CLI, for example `trait.myParam` has to be translated as `-t trait.my-param`

0 commit comments

Comments
 (0)