You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/01/22 15:59:07 UTC
[camel-k] 11/13: chore(trait): Update Jolokia trait documentation
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6889b5db11a99ba2a7d2dd286474aa17da55e4f7
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Jan 22 08:54:46 2020 +0100
chore(trait): Update Jolokia trait documentation
---
docs/modules/ROOT/pages/traits/debug.adoc | 2 --
docs/modules/ROOT/pages/traits/environment.adoc | 2 +-
docs/modules/ROOT/pages/traits/jolokia.adoc | 6 +++---
pkg/trait/jolokia.go | 28 ++++++++-----------------
4 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/docs/modules/ROOT/pages/traits/debug.adoc b/docs/modules/ROOT/pages/traits/debug.adoc
index 1ac28e4..8cb42af 100755
--- a/docs/modules/ROOT/pages/traits/debug.adoc
+++ b/docs/modules/ROOT/pages/traits/debug.adoc
@@ -4,8 +4,6 @@
The Debug trait can be used to enable debugging on the integration container,
so that a remote debugger can be attached.
-Enabling the trait will inject the `JAVA_DEBUG` environment variable into the integration container.
-
This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
diff --git a/docs/modules/ROOT/pages/traits/environment.adoc b/docs/modules/ROOT/pages/traits/environment.adoc
index 51c65b0..283e831 100755
--- a/docs/modules/ROOT/pages/traits/environment.adoc
+++ b/docs/modules/ROOT/pages/traits/environment.adoc
@@ -2,7 +2,7 @@
// Start of autogenerated code - DO NOT EDIT! (description)
The environment trait is used internally to inject standard environment variables in the integration container,
-such as `NAMESPACE`, `POD_NAME`, `JAVA_MAIN_CLASS` and others.
+such as `NAMESPACE`, `POD_NAME` and others.
This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
diff --git a/docs/modules/ROOT/pages/traits/jolokia.adoc b/docs/modules/ROOT/pages/traits/jolokia.adoc
index 9d1f0ed..e8b1e8a 100755
--- a/docs/modules/ROOT/pages/traits/jolokia.adoc
+++ b/docs/modules/ROOT/pages/traits/jolokia.adoc
@@ -30,13 +30,13 @@ The following configuration options are available:
| string
| The PEM encoded CA certification file path, used to verify client certificates,
applicable when `protocol` is `https` and `use-ssl-client-authentication` is `true`
-(default `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` for OpenShift).
+(default `/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt` for OpenShift).
| jolokia.client-principal
| []string
-| The principal which must be given in a client certificate to allow access to the Jolokia endpoint,
+| The principal(s) which must be given in a client certificate to allow access to the Jolokia endpoint,
applicable when `protocol` is `https` and `use-ssl-client-authentication` is `true`
-(default `clientPrincipal=cn=system:master-proxy` for OpenShift).
+(default `clientPrincipal=cn=system:master-proxy`, `cn=hawtio-online.hawtio.svc` and `cn=fuse-console.fuse.svc` for OpenShift).
| jolokia.discovery-enabled
| bool
diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go
index e08eca0..00f6f8a 100644
--- a/pkg/trait/jolokia.go
+++ b/pkg/trait/jolokia.go
@@ -37,11 +37,11 @@ type jolokiaTrait struct {
BaseTrait `property:",squash"`
// The PEM encoded CA certification file path, used to verify client certificates,
// applicable when `protocol` is `https` and `use-ssl-client-authentication` is `true`
- // (default `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` for OpenShift).
+ // (default `/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt` for OpenShift).
CaCert *string `property:"ca-cert"`
- // The principal which must be given in a client certificate to allow access to the Jolokia endpoint,
+ // The principal(s) which must be given in a client certificate to allow access to the Jolokia endpoint,
// applicable when `protocol` is `https` and `use-ssl-client-authentication` is `true`
- // (default `clientPrincipal=cn=system:master-proxy` for OpenShift).
+ // (default `clientPrincipal=cn=system:master-proxy`, `cn=hawtio-online.hawtio.svc` and `cn=fuse-console.fuse.svc` for OpenShift).
ClientPrincipal []string `property:"client-principal"`
// Listen for multicast requests (default `false`)
DiscoveryEnabled *bool `property:"discovery-enabled"`
@@ -69,8 +69,6 @@ type jolokiaTrait struct {
Options *string `property:"options"`
}
-// The Jolokia trait must be executed prior to the deployment trait
-// as it mutates environment variables
func newJolokiaTrait() *jolokiaTrait {
return &jolokiaTrait{
BaseTrait: newBaseTrait("jolokia"),
@@ -78,12 +76,8 @@ func newJolokiaTrait() *jolokiaTrait {
}
}
-func (t *jolokiaTrait) isEnabled() bool {
- return t.Enabled != nil && *t.Enabled
-}
-
func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
- return t.isEnabled() && e.IntegrationInPhase(
+ return t.Enabled != nil && *t.Enabled && e.IntegrationInPhase(
v1.IntegrationPhaseInitialization,
v1.IntegrationPhaseDeploying,
v1.IntegrationPhaseRunning,
@@ -92,13 +86,10 @@ func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
func (t *jolokiaTrait) Apply(e *Environment) (err error) {
if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
- if t.isEnabled() {
- // Add Camel management dependency
- util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, "mvn:org.apache.camel/camel-management")
- // And Jolokia agent
- // TODO: We may want to make the Jolokia version configurable
- util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, "mvn:org.jolokia/jolokia-jvm:jar:agent:1.6.2")
- }
+ // Add the Camel management and Jolokia agent dependencies
+ util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, "mvn:org.apache.camel/camel-management")
+ // TODO: We may want to make the Jolokia version configurable
+ util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, "mvn:org.jolokia/jolokia-jvm:jar:agent:1.6.2")
return nil
}
@@ -113,8 +104,7 @@ func (t *jolokiaTrait) Apply(e *Environment) (err error) {
return nil
}
- // Configure the Jolokia Java agent
- // Populate first with the extra options
+ // Configure the Jolokia Java agent, first with the extra options
options, err := parseCsvMap(t.Options)
if err != nil {
return err