Skip to content

Commit

Permalink
chore(trait): Update Jolokia trait documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Jan 22, 2020
1 parent cc67814 commit 6889b5d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
2 changes: 0 additions & 2 deletions docs/modules/ROOT/pages/traits/debug.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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**.

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/traits/environment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/traits/jolokia.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 9 additions & 19 deletions pkg/trait/jolokia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -69,21 +69,15 @@ 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"),
Port: 8778,
}
}

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,
Expand All @@ -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
}

Expand All @@ -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
Expand Down

0 comments on commit 6889b5d

Please sign in to comment.