refactor(traits): generating documentation for addons
diff --git a/addons/master/master.go b/addons/master/master.go
index 3cc9ab8..ed40e1a 100644
--- a/addons/master/master.go
+++ b/addons/master/master.go
@@ -31,7 +31,7 @@
trait.BaseTrait `property:",squash"`
}
-func newMasterTrait() trait.Trait {
+func NewMasterTrait() trait.Trait {
return &masterTrait{
BaseTrait: trait.NewBaseTrait("master", 2500),
}
diff --git a/addons/master/zz_generated_doc.go b/addons/master/zz_generated_doc.go
new file mode 100644
index 0000000..57d5fb2
--- /dev/null
+++ b/addons/master/zz_generated_doc.go
@@ -0,0 +1 @@
+package master
diff --git a/addons/master/register.go b/addons/register_master.go
similarity index 83%
rename from addons/master/register.go
rename to addons/register_master.go
index 77a8a02..061ee2d 100644
--- a/addons/master/register.go
+++ b/addons/register_master.go
@@ -15,10 +15,13 @@
limitations under the License.
*/
-package master
+package addons
-import "github.com/apache/camel-k/pkg/trait"
+import (
+ "github.com/apache/camel-k/addons/master"
+ "github.com/apache/camel-k/pkg/trait"
+)
func init() {
- trait.AddToTraits(newMasterTrait)
+ trait.AddToTraits(master.NewMasterTrait)
}
diff --git a/addons/zz_generated_doc.go b/addons/zz_generated_doc.go
new file mode 100644
index 0000000..1890561
--- /dev/null
+++ b/addons/zz_generated_doc.go
@@ -0,0 +1 @@
+package addons
diff --git a/cmd/kamel/main.go b/cmd/kamel/main.go
index 58441f9..2ba8ea9 100644
--- a/cmd/kamel/main.go
+++ b/cmd/kamel/main.go
@@ -23,15 +23,13 @@
"os"
"time"
+ _ "github.com/apache/camel-k/addons"
_ "github.com/apache/camel-k/pkg/builder/kaniko"
_ "github.com/apache/camel-k/pkg/builder/s2i"
"github.com/apache/camel-k/pkg/cmd"
_ "k8s.io/client-go/plugin/pkg/client/auth/azure"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
-
- // List of addons that we want to include
- _ "github.com/apache/camel-k/addons/master"
)
func main() {
diff --git a/cmd/util/doc-gen/main.go b/cmd/util/doc-gen/main.go
index 22ce5f3..95732e8 100644
--- a/cmd/util/doc-gen/main.go
+++ b/cmd/util/doc-gen/main.go
@@ -21,6 +21,8 @@
"github.com/apache/camel-k/cmd/util/doc-gen/generators"
"github.com/spf13/pflag"
"k8s.io/gengo/args"
+
+ _ "github.com/apache/camel-k/addons"
)
func main() {
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 318f21a..ab5709c 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -32,6 +32,7 @@
** xref:traits/jvm.adoc[Jvm]
** xref:traits/knative-service.adoc[Knative Service]
** xref:traits/knative.adoc[Knative]
+** xref:traits/master.adoc[Master]
** xref:traits/owner.adoc[Owner]
** xref:traits/platform.adoc[Platform]
** xref:traits/probes.adoc[Probes]
diff --git a/docs/modules/ROOT/pages/traits/master.adoc b/docs/modules/ROOT/pages/traits/master.adoc
new file mode 100755
index 0000000..7ba359c
--- /dev/null
+++ b/docs/modules/ROOT/pages/traits/master.adoc
@@ -0,0 +1,32 @@
+= Master Trait
+
+// Start of autogenerated code - DO NOT EDIT! (description)
+The Master trait allows to configure the integration to automatically leverage Kubernetes resources for doing
+leader election and starting *master* routes only on certain instances.
+
+It's activated automatically when using the master endpoint in a route, e.g. `from("master:telegram:bots")...`.
+
+
+This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
+
+// End of autogenerated code - DO NOT EDIT! (description)
+// Start of autogenerated code - DO NOT EDIT! (configuration)
+== Configuration
+
+Trait properties can be specified when running any integration with the CLI:
+```
+kamel run --trait master.[key]=[value] integration.groovy
+```
+The following configuration options are available:
+
+[cols="2,1,5a"]
+|===
+|Property | Type | Description
+
+| master.enabled
+| bool
+| Can be used to enable or disable a trait. All traits share this common property.
+
+|===
+
+// End of autogenerated code - DO NOT EDIT! (configuration)
diff --git a/docs/modules/ROOT/pages/traits/traits.adoc b/docs/modules/ROOT/pages/traits/traits.adoc
index f0c4b24..476b19d 100644
--- a/docs/modules/ROOT/pages/traits/traits.adoc
+++ b/docs/modules/ROOT/pages/traits/traits.adoc
@@ -50,6 +50,7 @@
* xref:traits/jvm.adoc[Jvm Trait]
* xref:traits/knative-service.adoc[Knative Service Trait]
* xref:traits/knative.adoc[Knative Trait]
+* xref:traits/master.adoc[Master Trait]
* xref:traits/owner.adoc[Owner Trait]
* xref:traits/platform.adoc[Platform Trait]
* xref:traits/probes.adoc[Probes Trait]
diff --git a/script/gen_doc.sh b/script/gen_doc.sh
index 01c905a..3c651db 100755
--- a/script/gen_doc.sh
+++ b/script/gen_doc.sh
@@ -21,4 +21,4 @@
echo "Generating traits documentation..."
cd $rootdir
-go run ./cmd/util/doc-gen --input-dirs ./pkg/trait
+go run ./cmd/util/doc-gen --input-dirs ./pkg/trait --input-dirs ./addons/...