You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2026/08/28 13:56:24 UTC

(camel-k) branch release-2.9.x updated (c44a51510 -> 954ff9805)

This is an automated email from the ASF dual-hosted git repository.

squakez pushed a change to branch release-2.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


    from c44a51510 chore: nightly automatic updates
     new 46b98e7a4 chore(trait): drop maven profile
     new f06598224 chore(trait): verify master SA
     new 954ff9805 feat(platform): provide maven repo allow list

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  8 +--
 docs/modules/traits/pages/builder.adoc             |  5 +-
 e2e/common/misc/maven_repository_test.go           |  7 +-
 helm/camel-k/crds/camel-k-crds.yaml                | 78 +++++-----------------
 pkg/apis/camel/v1/maven_types.go                   |  5 +-
 pkg/apis/camel/v1/trait/builder.go                 |  7 +-
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   |  4 +-
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |  4 +-
 pkg/builder/project.go                             | 24 -------
 .../applyconfiguration/camel/v1/mavenbuildspec.go  | 10 +--
 .../camel/applyconfiguration/camel/v1/mavenspec.go | 44 ++++++++----
 pkg/platform/platform.go                           | 21 ++++++
 .../config/crd/bases/camel.apache.org_builds.yaml  |  8 +--
 .../bases/camel.apache.org_integrationkits.yaml    |  6 +-
 .../camel.apache.org_integrationplatforms.yaml     | 20 ++----
 .../camel.apache.org_integrationprofiles.yaml      | 20 ++----
 .../crd/bases/camel.apache.org_integrations.yaml   | 12 +---
 .../config/crd/bases/camel.apache.org_pipes.yaml   | 12 +---
 pkg/trait/builder.go                               | 24 +++----
 pkg/trait/builder_test.go                          | 41 ------------
 pkg/trait/camel.go                                 |  8 +++
 pkg/trait/master.go                                |  7 ++
 pkg/trait/master_test.go                           | 10 +++
 23 files changed, 137 insertions(+), 248 deletions(-)


(camel-k) 02/03: chore(trait): verify master SA

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch release-2.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit f0659822418eb3c0ab2b2090a797d7f0b8275763
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Aug 27 08:31:15 2026 +0200

    chore(trait): verify master SA
---
 pkg/trait/master.go      |  7 +++++++
 pkg/trait/master_test.go | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/pkg/trait/master.go b/pkg/trait/master.go
index 9ac75e780..2ab99902f 100644
--- a/pkg/trait/master.go
+++ b/pkg/trait/master.go
@@ -22,6 +22,7 @@ import (
 	"strings"
 
 	corev1 "k8s.io/api/core/v1"
+	"k8s.io/apimachinery/pkg/util/validation"
 	"k8s.io/utils/ptr"
 	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
@@ -209,6 +210,12 @@ func (t *masterTrait) prepareRBAC(cli client.Client, serviceAccount, itName, itN
 	if serviceAccount == "" {
 		serviceAccount = "default"
 	}
+	if errs := validation.IsDNS1123Subdomain(serviceAccount); len(errs) > 0 {
+		return nil, fmt.Errorf(
+			"integration service account name is not properly formatted: %s",
+			strings.Join(errs, "; "),
+		)
+	}
 
 	templateData := struct {
 		Namespace      string
diff --git a/pkg/trait/master_test.go b/pkg/trait/master_test.go
index f819f295f..069639cec 100644
--- a/pkg/trait/master_test.go
+++ b/pkg/trait/master_test.go
@@ -337,3 +337,13 @@ func TestMasterTraitDeprecationWarning(t *testing.T) {
 	assert.Contains(t, condition.message, "RoleBinding")
 	assert.Contains(t, condition.message, "Quarkus properties")
 }
+
+func TestPrepareRBACFailures(t *testing.T) {
+	wrongSa := "my-sa\nsomethingelse"
+	mt := &masterTrait{
+		BaseTrait: NewBaseTrait("master", TraitOrderBeforeControllerCreation),
+	}
+	_, err := mt.prepareRBAC(nil, wrongSa, "", "")
+	require.Error(t, err)
+	assert.Contains(t, err.Error(), "integration service account name is not properly formatted")
+}


(camel-k) 01/03: chore(trait): drop maven profile

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch release-2.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 46b98e7a46575fcbe3e66192d842092047259886
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Aug 27 08:28:52 2026 +0200

    chore(trait): drop maven profile
    
    It was already deprecated
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  8 +--
 docs/modules/traits/pages/builder.adoc             |  5 +-
 helm/camel-k/crds/camel-k-crds.yaml                | 78 +++++-----------------
 pkg/apis/camel/v1/maven_types.go                   |  5 +-
 pkg/apis/camel/v1/trait/builder.go                 |  7 +-
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   |  4 +-
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |  4 +-
 pkg/builder/project.go                             | 24 -------
 .../applyconfiguration/camel/v1/mavenbuildspec.go  | 10 +--
 .../camel/applyconfiguration/camel/v1/mavenspec.go | 44 ++++++++----
 .../config/crd/bases/camel.apache.org_builds.yaml  |  8 +--
 .../bases/camel.apache.org_integrationkits.yaml    |  6 +-
 .../camel.apache.org_integrationplatforms.yaml     | 20 ++----
 .../camel.apache.org_integrationprofiles.yaml      | 20 ++----
 .../crd/bases/camel.apache.org_integrations.yaml   | 12 +---
 .../config/crd/bases/camel.apache.org_pipes.yaml   | 12 +---
 pkg/trait/builder.go                               | 17 +----
 pkg/trait/builder_test.go                          | 41 ------------
 18 files changed, 78 insertions(+), 247 deletions(-)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 7845f885f..1a932f688 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -4577,8 +4577,7 @@ The Maven properties.
 |
 
 
-A reference to the ConfigMap or Secret key that contains
-the Maven profile.
+Deprecated: no longer in use.
 
 |`settings` +
 *xref:#_camel_apache_org_v1_ValueSource[ValueSource]*
@@ -6522,10 +6521,7 @@ Deprecated: use TasksRequestCPU instead with task name `builder`.
 |
 
 
-A list of references pointing to configmaps/secrets that contains a maven profile.
-This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-Syntax: [configmap{vbar}secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+Deprecated: no longer in use.
 
 |`tasks` +
 []string
diff --git a/docs/modules/traits/pages/builder.adoc b/docs/modules/traits/pages/builder.adoc
index c83da3ed7..5f97612e7 100755
--- a/docs/modules/traits/pages/builder.adoc
+++ b/docs/modules/traits/pages/builder.adoc
@@ -78,10 +78,7 @@ Deprecated: use TasksRequestCPU instead with task name `builder`.
 
 | builder.maven-profiles
 | []string
-| A list of references pointing to configmaps/secrets that contains a maven profile.
-This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-Syntax: [configmap\|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+| Deprecated: no longer in use.
 
 | builder.tasks
 | []string
diff --git a/helm/camel-k/crds/camel-k-crds.yaml b/helm/camel-k/crds/camel-k-crds.yaml
index e5a5d0d76..4560b3c09 100644
--- a/helm/camel-k/crds/camel-k-crds.yaml
+++ b/helm/camel-k/crds/camel-k-crds.yaml
@@ -447,9 +447,7 @@ spec:
                               description: The path of the local Maven repository.
                               type: string
                             profiles:
-                              description: |-
-                                A reference to the ConfigMap or Secret key that contains
-                                the Maven profile.
+                              description: 'Deprecated: no longer in use.'
                               items:
                                 description: ValueSource --.
                                 properties:
@@ -1373,9 +1371,7 @@ spec:
                               description: The path of the local Maven repository.
                               type: string
                             profiles:
-                              description: |-
-                                A reference to the ConfigMap or Secret key that contains
-                                the Maven profile.
+                              description: 'Deprecated: no longer in use.'
                               items:
                                 description: ValueSource --.
                                 properties:
@@ -2934,11 +2930,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -3505,9 +3497,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -3871,11 +3861,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -5872,9 +5858,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -6286,11 +6270,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -8281,9 +8261,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -8601,11 +8579,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -10531,9 +10505,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -10893,11 +10865,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -20019,11 +19987,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -22265,11 +22229,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -32749,11 +32709,7 @@ spec:
                               Deprecated: use TasksRequestCPU instead with task name `builder`.
                             type: string
                           mavenProfiles:
-                            description: |-
-                              A list of references pointing to configmaps/secrets that contains a maven profile.
-                              This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                              The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                              Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                            description: 'Deprecated: no longer in use.'
                             items:
                               type: string
                             type: array
@@ -34931,11 +34887,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
diff --git a/pkg/apis/camel/v1/maven_types.go b/pkg/apis/camel/v1/maven_types.go
index 18af05277..88887faff 100644
--- a/pkg/apis/camel/v1/maven_types.go
+++ b/pkg/apis/camel/v1/maven_types.go
@@ -29,9 +29,8 @@ type MavenSpec struct {
 	LocalRepository string `json:"localRepository,omitempty"`
 	// The Maven properties.
 	Properties map[string]string `json:"properties,omitempty"`
-	// A reference to the ConfigMap or Secret key that contains
-	// the Maven profile.
-	Profiles []ValueSource `json:"profiles,omitempty"`
+	// Deprecated: no longer in use.
+	DeprecatedProfiles []ValueSource `json:"profiles,omitempty"`
 	// A reference to the ConfigMap or Secret key that contains
 	// the Maven settings.
 	Settings ValueSource `json:"settings,omitempty"`
diff --git a/pkg/apis/camel/v1/trait/builder.go b/pkg/apis/camel/v1/trait/builder.go
index 6ef4a54c2..6bb924950 100644
--- a/pkg/apis/camel/v1/trait/builder.go
+++ b/pkg/apis/camel/v1/trait/builder.go
@@ -52,11 +52,8 @@ type BuilderTrait struct {
 	// When using `pod` strategy, the maximum amount of memory required by the pod builder.
 	// Deprecated: use TasksRequestCPU instead with task name `builder`.
 	LimitMemory string `json:"limitMemory,omitempty" property:"limit-memory"`
-	// A list of references pointing to configmaps/secrets that contains a maven profile.
-	// This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-	// The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-	// Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
-	MavenProfiles []string `json:"mavenProfiles,omitempty" property:"maven-profiles"`
+	// Deprecated: no longer in use.
+	DeprecatedMavenProfiles []string `json:"mavenProfiles,omitempty" property:"maven-profiles"`
 	// A list of tasks to be executed (available only when using `pod` strategy) with format `<name>;<container-image>;<container-command>`.
 	Tasks []string `json:"tasks,omitempty" property:"tasks"`
 	// A list of tasks sorted by the order of execution in a csv format, ie, `<taskName1>,<taskName2>,...`.
diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
index 24cd6c132..44a53c967 100644
--- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
@@ -70,8 +70,8 @@ func (in *BuilderTrait) DeepCopyInto(out *BuilderTrait) {
 		*out = new(bool)
 		**out = **in
 	}
-	if in.MavenProfiles != nil {
-		in, out := &in.MavenProfiles, &out.MavenProfiles
+	if in.DeprecatedMavenProfiles != nil {
+		in, out := &in.DeprecatedMavenProfiles, &out.DeprecatedMavenProfiles
 		*out = make([]string, len(*in))
 		copy(*out, *in)
 	}
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 9b1a09711..03514b9af 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -2386,8 +2386,8 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
 			(*out)[key] = val
 		}
 	}
-	if in.Profiles != nil {
-		in, out := &in.Profiles, &out.Profiles
+	if in.DeprecatedProfiles != nil {
+		in, out := &in.DeprecatedProfiles, &out.DeprecatedProfiles
 		*out = make([]ValueSource, len(*in))
 		for i := range *in {
 			(*in)[i].DeepCopyInto(&(*out)[i])
diff --git a/pkg/builder/project.go b/pkg/builder/project.go
index 51971abee..8b8d592b0 100644
--- a/pkg/builder/project.go
+++ b/pkg/builder/project.go
@@ -20,7 +20,6 @@ package builder
 import (
 	"bytes"
 	"encoding/xml"
-	"fmt"
 	"os"
 	"regexp"
 	"strings"
@@ -44,7 +43,6 @@ func init() {
 		Project.GenerateProjectSettings,
 		Project.InjectDependencies,
 		Project.SanitizeDependencies,
-		Project.InjectProfiles,
 	}
 }
 
@@ -54,7 +52,6 @@ type projectSteps struct {
 	GenerateProjectSettings Step
 	InjectDependencies      Step
 	SanitizeDependencies    Step
-	InjectProfiles          Step
 
 	CommonSteps []Step
 }
@@ -66,7 +63,6 @@ var Project = projectSteps{
 	GenerateProjectSettings: NewStep(ProjectGenerationPhase+1, generateProjectSettings),
 	InjectDependencies:      NewStep(ProjectGenerationPhase+2, injectDependencies),
 	SanitizeDependencies:    NewStep(ProjectGenerationPhase+3, sanitizeDependencies),
-	InjectProfiles:          NewStep(ProjectGenerationPhase+4, injectProfiles),
 }
 
 func cleanUpBuildDir(ctx *builderContext) error {
@@ -204,23 +200,3 @@ func injectDependencies(ctx *builderContext) error {
 func sanitizeDependencies(ctx *builderContext) error {
 	return camel.SanitizeIntegrationDependencies(ctx.Maven.Project.Dependencies)
 }
-
-func injectProfiles(ctx *builderContext) error {
-	if ctx.Build.Maven.Profiles != nil {
-		for _, p := range ctx.Build.Maven.Profiles {
-			val, err := kubernetes.ResolveValueSource(ctx.C, ctx.Client, ctx.Namespace, &p)
-			if err != nil {
-				return fmt.Errorf("could not load profile : %s: %w. ", p.String(), err)
-			}
-			if val != "" {
-				profile := maven.Profile{}
-				if err := xml.Unmarshal([]byte(val), &profile); err != nil {
-					return err
-				}
-				ctx.Maven.Project.AddProfile(profile)
-			}
-		}
-	}
-
-	return nil
-}
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/mavenbuildspec.go b/pkg/client/camel/applyconfiguration/camel/v1/mavenbuildspec.go
index b8ba49df4..bf01e9811 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/mavenbuildspec.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/mavenbuildspec.go
@@ -59,15 +59,15 @@ func (b *MavenBuildSpecApplyConfiguration) WithProperties(entries map[string]str
 	return b
 }
 
-// WithProfiles adds the given value to the Profiles field in the declarative configuration
+// WithDeprecatedProfiles adds the given value to the DeprecatedProfiles field in the declarative configuration
 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
-// If called multiple times, values provided by each call will be appended to the Profiles field.
-func (b *MavenBuildSpecApplyConfiguration) WithProfiles(values ...*ValueSourceApplyConfiguration) *MavenBuildSpecApplyConfiguration {
+// If called multiple times, values provided by each call will be appended to the DeprecatedProfiles field.
+func (b *MavenBuildSpecApplyConfiguration) WithDeprecatedProfiles(values ...*ValueSourceApplyConfiguration) *MavenBuildSpecApplyConfiguration {
 	for i := range values {
 		if values[i] == nil {
-			panic("nil value passed to WithProfiles")
+			panic("nil value passed to WithDeprecatedProfiles")
 		}
-		b.MavenSpecApplyConfiguration.Profiles = append(b.MavenSpecApplyConfiguration.Profiles, *values[i])
+		b.MavenSpecApplyConfiguration.DeprecatedProfiles = append(b.MavenSpecApplyConfiguration.DeprecatedProfiles, *values[i])
 	}
 	return b
 }
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/mavenspec.go b/pkg/client/camel/applyconfiguration/camel/v1/mavenspec.go
index 4fa73b535..e9142419f 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/mavenspec.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/mavenspec.go
@@ -26,14 +26,32 @@ import (
 // MavenSpecApplyConfiguration represents a declarative configuration of the MavenSpec type for use
 // with apply.
 type MavenSpecApplyConfiguration struct {
-	LocalRepository  *string                           `json:"localRepository,omitempty"`
-	Properties       map[string]string                 `json:"properties,omitempty"`
-	Profiles         []ValueSourceApplyConfiguration   `json:"profiles,omitempty"`
-	Settings         *ValueSourceApplyConfiguration    `json:"settings,omitempty"`
-	SettingsSecurity *ValueSourceApplyConfiguration    `json:"settingsSecurity,omitempty"`
-	CASecrets        []corev1.SecretKeySelector        `json:"caSecrets,omitempty"`
-	Extension        []MavenArtifactApplyConfiguration `json:"extension,omitempty"`
-	CLIOptions       []string                          `json:"cliOptions,omitempty"`
+	// The path of the local Maven repository.
+	LocalRepository *string `json:"localRepository,omitempty"`
+	// The Maven properties.
+	Properties map[string]string `json:"properties,omitempty"`
+	// Deprecated: no longer in use.
+	DeprecatedProfiles []ValueSourceApplyConfiguration `json:"profiles,omitempty"`
+	// A reference to the ConfigMap or Secret key that contains
+	// the Maven settings.
+	Settings *ValueSourceApplyConfiguration `json:"settings,omitempty"`
+	// A reference to the ConfigMap or Secret key that contains
+	// the security of the Maven settings.
+	SettingsSecurity *ValueSourceApplyConfiguration `json:"settingsSecurity,omitempty"`
+	// The Secrets name and key, containing the CA certificate(s) used to connect
+	// to remote Maven repositories.
+	// It can contain X.509 certificates, and PKCS#7 formatted certificate chains.
+	// A JKS formatted keystore is automatically created to store the CA certificate(s),
+	// and configured to be used as a trusted certificate(s) by the Maven commands.
+	// Note that the root CA certificates are also imported into the created keystore.
+	CASecrets []corev1.SecretKeySelector `json:"caSecrets,omitempty"`
+	// The Maven build extensions.
+	// See https://maven.apache.org/guides/mini/guide-using-extensions.html.
+	Extension []MavenArtifactApplyConfiguration `json:"extension,omitempty"`
+	// The CLI options that are appended to the list of arguments for Maven commands,
+	// e.g., `-V,--no-transfer-progress,-Dstyle.color=never`.
+	// See https://maven.apache.org/ref/3.9.14/maven-embedder/cli.html.
+	CLIOptions []string `json:"cliOptions,omitempty"`
 }
 
 // MavenSpecApplyConfiguration constructs a declarative configuration of the MavenSpec type for use with
@@ -64,15 +82,15 @@ func (b *MavenSpecApplyConfiguration) WithProperties(entries map[string]string)
 	return b
 }
 
-// WithProfiles adds the given value to the Profiles field in the declarative configuration
+// WithDeprecatedProfiles adds the given value to the DeprecatedProfiles field in the declarative configuration
 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
-// If called multiple times, values provided by each call will be appended to the Profiles field.
-func (b *MavenSpecApplyConfiguration) WithProfiles(values ...*ValueSourceApplyConfiguration) *MavenSpecApplyConfiguration {
+// If called multiple times, values provided by each call will be appended to the DeprecatedProfiles field.
+func (b *MavenSpecApplyConfiguration) WithDeprecatedProfiles(values ...*ValueSourceApplyConfiguration) *MavenSpecApplyConfiguration {
 	for i := range values {
 		if values[i] == nil {
-			panic("nil value passed to WithProfiles")
+			panic("nil value passed to WithDeprecatedProfiles")
 		}
-		b.Profiles = append(b.Profiles, *values[i])
+		b.DeprecatedProfiles = append(b.DeprecatedProfiles, *values[i])
 	}
 	return b
 }
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml b/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml
index cfff79c7f..1fef21c1d 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml
@@ -447,9 +447,7 @@ spec:
                               description: The path of the local Maven repository.
                               type: string
                             profiles:
-                              description: |-
-                                A reference to the ConfigMap or Secret key that contains
-                                the Maven profile.
+                              description: 'Deprecated: no longer in use.'
                               items:
                                 description: ValueSource --.
                                 properties:
@@ -1373,9 +1371,7 @@ spec:
                               description: The path of the local Maven repository.
                               type: string
                             profiles:
-                              description: |-
-                                A reference to the ConfigMap or Secret key that contains
-                                the Maven profile.
+                              description: 'Deprecated: no longer in use.'
                               items:
                                 description: ValueSource --.
                                 properties:
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 2b7c50488..4e701777e 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -249,11 +249,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
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 7b89b0e30..95e6d4390 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -246,9 +246,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -612,11 +610,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -2613,9 +2607,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -3027,11 +3019,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
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 9c023a8d6..444600a91 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
@@ -158,9 +158,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -478,11 +476,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -2408,9 +2402,7 @@ spec:
                         description: The path of the local Maven repository.
                         type: string
                       profiles:
-                        description: |-
-                          A reference to the ConfigMap or Secret key that contains
-                          the Maven profile.
+                        description: 'Deprecated: no longer in use.'
                         items:
                           description: ValueSource --.
                           properties:
@@ -2770,11 +2762,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
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 b971ddedf..4a209889b 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -7292,11 +7292,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
@@ -9538,11 +9534,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
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 e3504f7f6..ca28a7cf7 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7344,11 +7344,7 @@ spec:
                               Deprecated: use TasksRequestCPU instead with task name `builder`.
                             type: string
                           mavenProfiles:
-                            description: |-
-                              A list of references pointing to configmaps/secrets that contains a maven profile.
-                              This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                              The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                              Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                            description: 'Deprecated: no longer in use.'
                             items:
                               type: string
                             type: array
@@ -9526,11 +9522,7 @@ spec:
                           Deprecated: use TasksRequestCPU instead with task name `builder`.
                         type: string
                       mavenProfiles:
-                        description: |-
-                          A list of references pointing to configmaps/secrets that contains a maven profile.
-                          This configmap/secret is a resource of the IntegrationKit created, therefore it needs to be present in the namespace where the operator is going to create the IntegrationKit.
-                          The content of the maven profile is expected to be a text containing a valid maven profile starting with `<profile>` and ending with `</profile>` that will be integrated as an inline profile in the POM.
-                          Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = profile.xml).
+                        description: 'Deprecated: no longer in use.'
                         items:
                           type: string
                         type: array
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index ed616e4bb..56ca48676 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -439,22 +439,7 @@ func (t *builderTrait) builderTask(e *Environment, taskConf *v1.BuildConfigurati
 		}
 	}
 
-	// User provides a maven profile
-	if t.MavenProfiles != nil {
-		mavenProfiles := make([]v1.ValueSource, 0)
-		for _, v := range t.MavenProfiles {
-			if v != "" {
-				mavenProfile, err := v1.DecodeValueSource(v, "profile.xml")
-				if err != nil {
-					return nil, fmt.Errorf("invalid maven profile: %s: %w. ", v, err)
-				}
-				mavenProfiles = append(mavenProfiles, mavenProfile)
-			}
-		}
-		task.Maven.Profiles = mavenProfiles
-	}
-
-	steps := make([]builder.Step, 0)
+	steps := make([]builder.Step, 0, len(builder.Project.CommonSteps))
 	steps = append(steps, builder.Project.CommonSteps...)
 
 	// sort steps by phase
diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go
index 067e91ff2..3677cb5b4 100644
--- a/pkg/trait/builder_test.go
+++ b/pkg/trait/builder_test.go
@@ -245,47 +245,6 @@ func TestCustomTaskBuilderTraitInvalidStrategyOverride(t *testing.T) {
 	assert.Equal(t, env.IntegrationKit.Status.Conditions[0].Type, v1.IntegrationKitConditionType("IntegrationKitTasksValid"))
 }
 
-func TestMavenProfilesBuilderTrait(t *testing.T) {
-	env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine)
-	builderTrait := createNominalBuilderTraitTest()
-	builderTrait.MavenProfiles = []string{"configmap:maven-profile/owasp-profile.xml", "secret:maven-profile-secret"}
-
-	err := builderTrait.Apply(env)
-
-	require.NoError(t, err)
-
-	assert.Equal(t, v1.ValueSource{
-		ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
-			LocalObjectReference: corev1.LocalObjectReference{
-				Name: "maven-profile",
-			},
-			Key: "owasp-profile.xml",
-		},
-	}, env.Pipeline[0].Builder.Maven.MavenSpec.Profiles[0])
-	assert.Equal(t, v1.ValueSource{
-		SecretKeyRef: &corev1.SecretKeySelector{
-			LocalObjectReference: corev1.LocalObjectReference{
-				Name: "maven-profile-secret",
-			},
-			Key: "profile.xml",
-		},
-	}, env.Pipeline[0].Builder.Maven.MavenSpec.Profiles[1])
-}
-
-func TestInvalidMavenProfilesBuilderTrait(t *testing.T) {
-	env := createBuilderTestEnv(v1.IntegrationPlatformClusterKubernetes, v1.IntegrationPlatformBuildPublishStrategyJib, v1.BuildStrategyRoutine)
-	builderTrait := createNominalBuilderTraitTest()
-	builderTrait.MavenProfiles = []string{"fakeprofile"}
-
-	err := builderTrait.Apply(env)
-
-	// The error will be reported to IntegrationKits
-	require.NoError(t, err)
-	assert.Equal(t, v1.IntegrationKitPhaseError, env.IntegrationKit.Status.Phase)
-	assert.Equal(t, corev1.ConditionFalse, env.IntegrationKit.Status.Conditions[0].Status)
-	assert.Contains(t, env.IntegrationKit.Status.Conditions[0].Message, "fakeprofile")
-}
-
 func TestBuilderCustomTasks(t *testing.T) {
 	builderTrait := createNominalBuilderTraitTest()
 	builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")


(camel-k) 03/03: feat(platform): provide maven repo allow list

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch release-2.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 954ff98054a28e3369712ecc8522811a70afa802
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Aug 27 08:32:59 2026 +0200

    feat(platform): provide maven repo allow list
---
 e2e/common/misc/maven_repository_test.go |  7 ++++++-
 pkg/platform/platform.go                 | 21 +++++++++++++++++++++
 pkg/trait/builder.go                     |  7 +++++++
 pkg/trait/camel.go                       |  8 ++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/e2e/common/misc/maven_repository_test.go b/e2e/common/misc/maven_repository_test.go
index cffb9a162..d4f3e78fc 100644
--- a/e2e/common/misc/maven_repository_test.go
+++ b/e2e/common/misc/maven_repository_test.go
@@ -38,7 +38,12 @@ func TestRunExtraRepository(t *testing.T) {
 	t.Parallel()
 	WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
 		name := RandomizedSuffixName("java")
-		g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--maven-repository", "https://maven.repository.redhat.com/ga@id=redhat", "--dependency", "mvn:org.jolokia:jolokia-core:1.7.1.redhat-00001", "--name", name).Execute()).To(Succeed())
+		// NOTE: the repo was allow listed during operator installation procedure
+		g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
+			"--maven-repository", "https://maven.repository.redhat.com/ga@id=redhat",
+			"--dependency", "mvn:org.jolokia:jolokia-core:1.7.1.redhat-00001",
+			"--name", name,
+		).Execute()).To(Succeed())
 
 		g.Eventually(IntegrationPodPhase(t, ctx, ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
 		g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 4db7128e5..5065fc5b2 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -19,11 +19,15 @@ package platform
 
 import (
 	"context"
+	"os"
+	"slices"
+	"strings"
 
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/v2/pkg/util/defaults"
 	"github.com/apache/camel-k/v2/pkg/util/kubernetes"
 	"github.com/apache/camel-k/v2/pkg/util/log"
+	"github.com/apache/camel-k/v2/pkg/util/maven"
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
@@ -211,3 +215,20 @@ func GetTraitProfile(p *v1.IntegrationPlatform) v1.TraitProfile {
 
 	return ""
 }
+
+// IsMavenRepoAllowed is used to verify if a given maven repository can be used or not.
+func IsMavenRepoAllowed(mavenRepo string) bool {
+	csvRepos := getEnvOrDefault("MAVEN_REPOSITORIES_ALLOWED", maven.DefaultMavenRepositories)
+	allowedRepos := strings.Split(csvRepos, ",")
+
+	return slices.Contains(allowedRepos, mavenRepo)
+}
+
+func getEnvOrDefault(key string, deflt string) string {
+	env, exists := os.LookupEnv(key)
+	if exists {
+		return env
+	} else {
+		return deflt
+	}
+}
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index 56ca48676..c06cde907 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -26,6 +26,7 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/apache/camel-k/v2/pkg/platform"
 	"github.com/apache/camel-k/v2/pkg/util/boolean"
 
 	corev1 "k8s.io/api/core/v1"
@@ -349,11 +350,17 @@ func (t *builderTrait) builderTask(e *Environment, taskConf *v1.BuildConfigurati
 	// Add Maven repositories defined in the IntegrationKit or Integration
 	if e.IntegrationKit != nil {
 		for _, repo := range e.IntegrationKit.Spec.Repositories {
+			if !platform.IsMavenRepoAllowed(repo) {
+				return nil, fmt.Errorf("maven repository %s is not allowed by the operator", repo)
+			}
 			maven.Repositories = append(maven.Repositories, mvn.NewRepository(repo))
 		}
 	}
 	if e.Integration != nil {
 		for _, repo := range e.Integration.Spec.Repositories {
+			if !platform.IsMavenRepoAllowed(repo) {
+				return nil, fmt.Errorf("maven repository %s is not allowed by the operator", repo)
+			}
 			maven.Repositories = append(maven.Repositories, mvn.NewRepository(repo))
 		}
 	}
diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index 20743248f..4ff57e58f 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -28,6 +28,7 @@ import (
 
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
+	"github.com/apache/camel-k/v2/pkg/platform"
 	"github.com/apache/camel-k/v2/pkg/util/camel"
 	"github.com/apache/camel-k/v2/pkg/util/defaults"
 	"github.com/apache/camel-k/v2/pkg/util/kubernetes"
@@ -186,6 +187,13 @@ func (t *camelTrait) loadOrCreateCatalog(e *Environment) error {
 			if e.IntegrationKit != nil && e.IntegrationKit.Spec.Repositories != nil {
 				extraRepositories = append(extraRepositories, e.IntegrationKit.Spec.Repositories...)
 			}
+			// verify extra repos are allowed
+			for _, repo := range extraRepositories {
+				if !platform.IsMavenRepoAllowed(repo) {
+					return fmt.Errorf("maven repository %s is not allowed by the operator", repo)
+				}
+			}
+
 			catalog, err = camel.CreateCatalog(e.Ctx, e.Client, catalogNamespace,
 				mavenSpec, e.Platform.Status.Build.GetTimeout().Duration, runtime, extraRepositories)
 			if err != nil {