This is an automated email from the ASF dual-hosted git repository. squakez pushed a commit to branch release-2.11.x in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6f2fb6e594a8de6ae005e8ca17f716d2692e5770 Author: Keerthan <[email protected]> AuthorDate: Tue Sep 22 15:50:58 2026 +0530 Fix #6800: Flag to skip the camel-observability-services dependency --- docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 7 ++ docs/modules/traits/pages/camel.adoc | 4 ++ helm/camel-k/crds/camel-k-crds.yaml | 36 ++++++++++ pkg/apis/camel/v1/camelcatalog_types.go | 3 + pkg/apis/camel/v1/trait/camel.go | 3 + pkg/apis/camel/v1/trait/zz_generated.deepcopy.go | 5 ++ pkg/apis/camel/v1/zz_generated.deepcopy.go | 1 + pkg/controller/catalog/initialize.go | 2 +- .../bases/camel.apache.org_integrationkits.yaml | 4 ++ .../camel.apache.org_integrationplatforms.yaml | 8 +++ .../camel.apache.org_integrationprofiles.yaml | 8 +++ .../crd/bases/camel.apache.org_integrations.yaml | 8 +++ .../config/crd/bases/camel.apache.org_pipes.yaml | 8 +++ pkg/trait/dependencies.go | 18 +++++ pkg/trait/dependencies_test.go | 79 ++++++++++++++++++++++ 15 files changed, 193 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 093826153..29f300e77 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -6824,6 +6824,13 @@ to the best matching Catalog existing on the cluster (Default, the one provided A list of properties to be provided to the Integration runtime +|`skipObservabilityServices` + +bool +| + + +Whether to skip the default Camel Observability Services dependency + |=== diff --git a/docs/modules/traits/pages/camel.adoc b/docs/modules/traits/pages/camel.adoc index ed6e8a7d8..f80086462 100755 --- a/docs/modules/traits/pages/camel.adoc +++ b/docs/modules/traits/pages/camel.adoc @@ -43,6 +43,10 @@ to the best matching Catalog existing on the cluster (Default, the one provided | []string | A list of properties to be provided to the Integration runtime +| camel.skipObservabilityServices +| bool +| Whether to skip the default Camel Observability Services dependency + |=== 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` diff --git a/helm/camel-k/crds/camel-k-crds.yaml b/helm/camel-k/crds/camel-k-crds.yaml index c86b84042..08f0eed5d 100644 --- a/helm/camel-k/crds/camel-k-crds.yaml +++ b/helm/camel-k/crds/camel-k-crds.yaml @@ -3090,6 +3090,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object quarkus: description: |- @@ -4043,6 +4047,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -6582,6 +6590,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -9082,6 +9094,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -11570,6 +11586,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -20850,6 +20870,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -23232,6 +23256,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -33873,6 +33901,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -36179,6 +36211,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait diff --git a/pkg/apis/camel/v1/camelcatalog_types.go b/pkg/apis/camel/v1/camelcatalog_types.go index 18734384c..a6d0cecc3 100644 --- a/pkg/apis/camel/v1/camelcatalog_types.go +++ b/pkg/apis/camel/v1/camelcatalog_types.go @@ -26,6 +26,9 @@ const ( // CamelCatalogKind -- . CamelCatalogKind string = "CamelCatalog" MavenQuarkusGroupID string = "org.apache.camel.quarkus" + + // CamelQuarkusObservabilityServicesArtifactID -- . + CamelQuarkusObservabilityServicesArtifactID string = "camel-quarkus-observability-services" ) // +genclient diff --git a/pkg/apis/camel/v1/trait/camel.go b/pkg/apis/camel/v1/trait/camel.go index 502bef4aa..c4b33bb42 100644 --- a/pkg/apis/camel/v1/trait/camel.go +++ b/pkg/apis/camel/v1/trait/camel.go @@ -34,4 +34,7 @@ type CamelTrait struct { RuntimeVersion string `json:"runtimeVersion,omitempty" property:"runtime-version"` // A list of properties to be provided to the Integration runtime Properties []string `json:"properties,omitempty" property:"properties"` + + // Whether to skip the default Camel Observability Services dependency + SkipObservabilityServices *bool `json:"skipObservabilityServices,omitempty" property:"skip-observability-services"` } diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go index 03e7c8716..f546ae545 100644 --- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go @@ -170,6 +170,11 @@ func (in *CamelTrait) DeepCopyInto(out *CamelTrait) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.SkipObservabilityServices != nil { + in, out := &in.SkipObservabilityServices, &out.SkipObservabilityServices + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CamelTrait. diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go index 1d11e35a2..61987bfe8 100644 --- a/pkg/apis/camel/v1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go @@ -6,6 +6,7 @@ package v1 import ( "encoding/json" + "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/controller/catalog/initialize.go b/pkg/controller/catalog/initialize.go index b0388a6ea..c92188fdb 100644 --- a/pkg/controller/catalog/initialize.go +++ b/pkg/controller/catalog/initialize.go @@ -110,7 +110,7 @@ func (action *initializeAction) addPlainQuarkusCatalog(ctx context.Context, cata // opinionated set of observability services { GroupID: v1.MavenQuarkusGroupID, - ArtifactID: "camel-quarkus-observability-services", + ArtifactID: v1.CamelQuarkusObservabilityServicesArtifactID, }, } if clonedCatalog.Spec.Runtime.Capabilities != nil { diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml index 4ea0a0ee3..68b1b79c3 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml @@ -386,6 +386,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object quarkus: description: |- diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml index 0178f258e..53420a12e 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml @@ -747,6 +747,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -3286,6 +3290,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml index cc54f0a5e..2db4a9fde 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml @@ -672,6 +672,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -3160,6 +3164,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml index 0cfb746ad..ae052f028 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml @@ -7455,6 +7455,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -9837,6 +9841,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait diff --git a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml index cb9188c84..9d313c936 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml @@ -7508,6 +7508,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait @@ -9814,6 +9818,10 @@ spec: You can use a fixed version (for example "3.2.3") or a semantic version (for example "3.x") which will try to resolve to the best matching Catalog existing on the cluster (Default, the one provided by the operator version). type: string + skipObservabilityServices: + description: Whether to skip the default Camel Observability + Services dependency + type: boolean type: object container: description: The configuration of Container trait diff --git a/pkg/trait/dependencies.go b/pkg/trait/dependencies.go index b5641a553..efd01e898 100644 --- a/pkg/trait/dependencies.go +++ b/pkg/trait/dependencies.go @@ -24,6 +24,7 @@ import ( "github.com/apache/camel-k/v2/pkg/util" "github.com/apache/camel-k/v2/pkg/util/camel" "github.com/apache/camel-k/v2/pkg/util/sets" + "k8s.io/utils/ptr" ) const ( @@ -50,6 +51,16 @@ func (t *dependenciesTrait) Configure(e *Environment) (bool, *TraitCondition, er return e.IntegrationInPhase(v1.IntegrationPhaseInitialization), nil, nil } +func (t *dependenciesTrait) isSkipObservabilityServices(e *Environment) bool { + if ct := e.Catalog.GetTrait(camelTraitID); ct != nil { + if camel, ok := ct.(*camelTrait); ok { + return ptr.Deref(camel.SkipObservabilityServices, false) + } + } + + return false +} + func (t *dependenciesTrait) Apply(e *Environment) error { if e.Integration.Status.Dependencies == nil { e.Integration.Status.Dependencies = make([]string, 0) @@ -64,8 +75,15 @@ func (t *dependenciesTrait) Apply(e *Environment) error { dependencies.Add(e.Integration.Spec.Dependencies...) } + skipObservabilityServices := t.isSkipObservabilityServices(e) + // Add runtime specific dependencies for _, d := range e.CamelCatalog.Runtime.Dependencies { + if skipObservabilityServices && + d.GroupID == v1.MavenQuarkusGroupID && + d.ArtifactID == v1.CamelQuarkusObservabilityServicesArtifactID { + continue + } dependencies.Add(d.GetDependencyID()) } diff --git a/pkg/trait/dependencies_test.go b/pkg/trait/dependencies_test.go index 2cb05e1e4..f36178c3b 100644 --- a/pkg/trait/dependencies_test.go +++ b/pkg/trait/dependencies_test.go @@ -25,6 +25,7 @@ import ( v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "github.com/apache/camel-k/v2/pkg/util/camel" + "k8s.io/utils/ptr" ) func TestDependenciesTraitApplicability(t *testing.T) { @@ -395,3 +396,81 @@ func TestIntegrationProfileDependency(t *testing.T) { }, ) } + +func TestDependenciesTraitSkipObservabilityServices(t *testing.T) { + catalog, err := camel.DefaultCatalog() + require.NoError(t, err) + catalog.Runtime.Dependencies = []v1.MavenArtifact{ + { + GroupID: v1.MavenQuarkusGroupID, + ArtifactID: "camel-quarkus-core", + }, + { + GroupID: v1.MavenQuarkusGroupID, + ArtifactID: v1.CamelQuarkusObservabilityServicesArtifactID, + }, + } + + e := &Environment{ + Catalog: NewEnvironmentTestCatalog(), + CamelCatalog: catalog, + Integration: &v1.Integration{ + Status: v1.IntegrationStatus{ + Phase: v1.IntegrationPhaseInitialization, + }, + }, + } + + camelTrait, ok := e.Catalog.GetTrait(camelTraitID).(*camelTrait) + require.True(t, ok) + camelTrait.SkipObservabilityServices = ptr.To(true) + + trait := newDependenciesTrait() + enabled, condition, err := trait.Configure(e) + require.NoError(t, err) + assert.Nil(t, condition) + assert.True(t, enabled) + + err = trait.Apply(e) + require.NoError(t, err) + + assert.Contains(t, e.Integration.Status.Dependencies, "mvn:org.apache.camel.quarkus:camel-quarkus-core") + assert.NotContains(t, e.Integration.Status.Dependencies, "mvn:org.apache.camel.quarkus:camel-quarkus-observability-services") +} + +func TestDependenciesTraitObservabilityServicesDefault(t *testing.T) { + catalog, err := camel.DefaultCatalog() + require.NoError(t, err) + catalog.Runtime.Dependencies = []v1.MavenArtifact{ + { + GroupID: v1.MavenQuarkusGroupID, + ArtifactID: "camel-quarkus-core", + }, + { + GroupID: v1.MavenQuarkusGroupID, + ArtifactID: v1.CamelQuarkusObservabilityServicesArtifactID, + }, + } + + e := &Environment{ + Catalog: NewEnvironmentTestCatalog(), + CamelCatalog: catalog, + Integration: &v1.Integration{ + Status: v1.IntegrationStatus{ + Phase: v1.IntegrationPhaseInitialization, + }, + }, + } + + trait := newDependenciesTrait() + enabled, condition, err := trait.Configure(e) + require.NoError(t, err) + assert.Nil(t, condition) + assert.True(t, enabled) + + err = trait.Apply(e) + require.NoError(t, err) + + assert.Contains(t, e.Integration.Status.Dependencies, "mvn:org.apache.camel.quarkus:camel-quarkus-core") + assert.Contains(t, e.Integration.Status.Dependencies, "mvn:org.apache.camel.quarkus:camel-quarkus-observability-services") +}
