From a05a99f8ed87d5d4fa306934736ce1108885dbd8 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Thu, 4 Sep 2025 07:04:39 +0200 Subject: [PATCH] feat(trait): deprecate Jolokia Favoring jvm.agents instead --- docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 3 +++ docs/modules/traits/pages/jolokia.adoc | 5 +++++ pkg/apis/camel/v1/trait/jolokia.go | 4 ++++ pkg/trait/jolokia.go | 10 +++++++++- pkg/trait/jolokia_test.go | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 74fd6227dd..f5f888d78f 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -7630,6 +7630,9 @@ Make sure you have the right privileges to perform such an action on the cluster See https://jolokia.org/reference/html/manual/agents.html +WARNING: The Jolokia trait is **deprecated** and will removed in future release versions: +use `jvm.agents` configuration instead. + [cols="2,2a",options="header"] |=== diff --git a/docs/modules/traits/pages/jolokia.adoc b/docs/modules/traits/pages/jolokia.adoc index 1b055b4a62..02e9a245ee 100755 --- a/docs/modules/traits/pages/jolokia.adoc +++ b/docs/modules/traits/pages/jolokia.adoc @@ -1,6 +1,8 @@ = Jolokia Trait // Start of autogenerated code - DO NOT EDIT! (badges) +[.badges] +[.badge-key]##Deprecated since##[.badge-unsupported]##2.8.0## // End of autogenerated code - DO NOT EDIT! (badges) // Start of autogenerated code - DO NOT EDIT! (description) The Jolokia trait activates and configures the Jolokia Java agent. @@ -9,6 +11,9 @@ Make sure you have the right privileges to perform such an action on the cluster See https://jolokia.org/reference/html/manual/agents.html +WARNING: The Jolokia trait is **deprecated** and will removed in future release versions: +use `jvm.agents` configuration instead. + This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**. diff --git a/pkg/apis/camel/v1/trait/jolokia.go b/pkg/apis/camel/v1/trait/jolokia.go index d90487cd1c..03725c5e75 100644 --- a/pkg/apis/camel/v1/trait/jolokia.go +++ b/pkg/apis/camel/v1/trait/jolokia.go @@ -23,7 +23,11 @@ package trait // // See https://jolokia.org/reference/html/manual/agents.html // +// WARNING: The Jolokia trait is **deprecated** and will removed in future release versions: +// use `jvm.agents` configuration instead. +// // +camel-k:trait=jolokia. +// +camel-k:deprecated=2.8.0. type JolokiaTrait struct { Trait `property:",squash" json:",inline"` // The PEM encoded CA certification file path, used to verify client certificates, diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go index 4d58863cec..4ae6a09d0d 100644 --- a/pkg/trait/jolokia.go +++ b/pkg/trait/jolokia.go @@ -54,7 +54,15 @@ func (t *jolokiaTrait) Configure(e *Environment) (bool, *TraitCondition, error) return false, nil, nil } - return e.IntegrationInPhase(v1.IntegrationPhaseInitialization) || e.IntegrationInRunningPhases(), nil, nil + condition := NewIntegrationCondition( + "Jolokia", + v1.IntegrationConditionTraitInfo, + corev1.ConditionTrue, + TraitConfigurationReason, + "Jolokia trait is deprecated in favour of jvm.agents. It may be removed in future version.", + ) + + return e.IntegrationInPhase(v1.IntegrationPhaseInitialization) || e.IntegrationInRunningPhases(), condition, nil } func (t *jolokiaTrait) Apply(e *Environment) error { diff --git a/pkg/trait/jolokia_test.go b/pkg/trait/jolokia_test.go index 123834b5a9..3343ab47d8 100644 --- a/pkg/trait/jolokia_test.go +++ b/pkg/trait/jolokia_test.go @@ -39,7 +39,7 @@ func TestConfigureJolokiaTraitInRunningPhaseDoesSucceed(t *testing.T) { require.NoError(t, err) assert.True(t, configured) - assert.Nil(t, condition) + assert.NotNil(t, condition) } func TestApplyJolokiaTraitNominalShouldSucceed(t *testing.T) {