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

jpoth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new eed983795 fix #2835 address comments
     new dcd7e34f7 Merge pull request #3171 from johnpoth/local-dependencies-2
eed983795 is described below

commit eed9837955991c4efd8e47da3d36e51a850a8c50
Author: John Poth <[email protected]>
AuthorDate: Tue Apr 5 16:08:19 2022 +0200

    fix #2835 address comments
---
 config/crd/bases/camel.apache.org_builds.yaml      | 28 ++++++++
 .../camel.apache.org_integrationplatforms.yaml     | 80 ++++++++++++++--------
 docs/modules/traits/pages/registry.adoc            |  2 +-
 helm/camel-k/crds/crd-build.yaml                   | 28 ++++++++
 helm/camel-k/crds/crd-integration-platform.yaml    | 80 ++++++++++++++--------
 pkg/apis/camel/v1/build_types.go                   |  2 +
 pkg/apis/camel/v1/maven_types.go                   | 11 ++-
 pkg/apis/camel/v1/zz_generated.deepcopy.go         | 19 +++--
 pkg/builder/project.go                             | 19 ++++-
 pkg/cmd/install.go                                 |  2 +-
 pkg/cmd/run.go                                     | 20 ++----
 pkg/resources/resources.go                         | 19 +++--
 pkg/trait/openapi.go                               | 16 ++++-
 pkg/trait/registry.go                              |  4 +-
 pkg/util/camel/camel_dependencies.go               |  4 +-
 pkg/util/camel/catalog.go                          | 17 ++++-
 16 files changed, 247 insertions(+), 104 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_builds.yaml 
b/config/crd/bases/camel.apache.org_builds.yaml
index 7ecfb8146..c10a60b1b 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -151,6 +151,33 @@ spec:
                             application build phase
                           properties:
                             caSecret:
+                              description: 'Deprecated: use CASecrets The 
Secret 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.'
+                              properties:
+                                key:
+                                  description: The key of the secret to select 
from.  Must
+                                    be a valid secret key.
+                                  type: string
+                                name:
+                                  description: 'Name of the referent. More 
info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                                    TODO: Add other useful fields. apiVersion, 
kind,
+                                    uid?'
+                                  type: string
+                                optional:
+                                  description: Specify whether the Secret or 
its key
+                                    must be defined
+                                  type: boolean
+                              required:
+                              - key
+                              type: object
+                            caSecrets:
                               description: The Secrets name and key, 
containing the
                                 CA certificate(s) used to connect to remote 
Maven
                                 repositories. It can contain X.509 
certificates, and
@@ -287,6 +314,7 @@ spec:
                                 type: object
                               type: array
                             servers:
+                              description: Servers (auth)
                               items:
                                 properties:
                                   configuration:
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index b54d09be6..91884f24f 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -95,6 +95,31 @@ spec:
                       applications
                     properties:
                       caSecret:
+                        description: 'Deprecated: use CASecrets The Secret 
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.'
+                        properties:
+                          key:
+                            description: The key of the secret to select from. 
 Must
+                              be a valid secret key.
+                            type: string
+                          name:
+                            description: 'Name of the referent. More info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                              TODO: Add other useful fields. apiVersion, kind, 
uid?'
+                            type: string
+                          optional:
+                            description: Specify whether the Secret or its key 
must
+                              be defined
+                            type: boolean
+                        required:
+                        - key
+                        type: object
+                      caSecrets:
                         description: 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.
@@ -156,21 +181,6 @@ spec:
                           type: string
                         description: The Maven properties.
                         type: object
-                      servers:
-                        items:
-                          properties:
-                            configuration:
-                              additionalProperties:
-                                type: string
-                              type: object
-                            id:
-                              type: string
-                            password:
-                              type: string
-                            username:
-                              type: string
-                          type: object
-                        type: array
                       settings:
                         description: A reference to the ConfigMap or Secret 
key that
                           contains the Maven settings.
@@ -360,6 +370,31 @@ spec:
                       applications
                     properties:
                       caSecret:
+                        description: 'Deprecated: use CASecrets The Secret 
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.'
+                        properties:
+                          key:
+                            description: The key of the secret to select from. 
 Must
+                              be a valid secret key.
+                            type: string
+                          name:
+                            description: 'Name of the referent. More info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                              TODO: Add other useful fields. apiVersion, kind, 
uid?'
+                            type: string
+                          optional:
+                            description: Specify whether the Secret or its key 
must
+                              be defined
+                            type: boolean
+                        required:
+                        - key
+                        type: object
+                      caSecrets:
                         description: 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.
@@ -421,21 +456,6 @@ spec:
                           type: string
                         description: The Maven properties.
                         type: object
-                      servers:
-                        items:
-                          properties:
-                            configuration:
-                              additionalProperties:
-                                type: string
-                              type: object
-                            id:
-                              type: string
-                            password:
-                              type: string
-                            username:
-                              type: string
-                          type: object
-                        type: array
                       settings:
                         description: A reference to the ConfigMap or Secret 
key that
                           contains the Maven settings.
diff --git a/docs/modules/traits/pages/registry.adoc 
b/docs/modules/traits/pages/registry.adoc
index 29dd72420..6decb9efb 100644
--- a/docs/modules/traits/pages/registry.adoc
+++ b/docs/modules/traits/pages/registry.adoc
@@ -2,7 +2,7 @@
 
 // Start of autogenerated code - DO NOT EDIT! (description)
 The Registry trait sets up Maven to use the Image registry
-as a Maven repository
+as a Maven repository.
 
 
 This trait is available in the following profiles: **Kubernetes, Knative, 
OpenShift**.
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index 7ecfb8146..c10a60b1b 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -151,6 +151,33 @@ spec:
                             application build phase
                           properties:
                             caSecret:
+                              description: 'Deprecated: use CASecrets The 
Secret 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.'
+                              properties:
+                                key:
+                                  description: The key of the secret to select 
from.  Must
+                                    be a valid secret key.
+                                  type: string
+                                name:
+                                  description: 'Name of the referent. More 
info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                                    TODO: Add other useful fields. apiVersion, 
kind,
+                                    uid?'
+                                  type: string
+                                optional:
+                                  description: Specify whether the Secret or 
its key
+                                    must be defined
+                                  type: boolean
+                              required:
+                              - key
+                              type: object
+                            caSecrets:
                               description: The Secrets name and key, 
containing the
                                 CA certificate(s) used to connect to remote 
Maven
                                 repositories. It can contain X.509 
certificates, and
@@ -287,6 +314,7 @@ spec:
                                 type: object
                               type: array
                             servers:
+                              description: Servers (auth)
                               items:
                                 properties:
                                   configuration:
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml 
b/helm/camel-k/crds/crd-integration-platform.yaml
index b54d09be6..91884f24f 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -95,6 +95,31 @@ spec:
                       applications
                     properties:
                       caSecret:
+                        description: 'Deprecated: use CASecrets The Secret 
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.'
+                        properties:
+                          key:
+                            description: The key of the secret to select from. 
 Must
+                              be a valid secret key.
+                            type: string
+                          name:
+                            description: 'Name of the referent. More info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                              TODO: Add other useful fields. apiVersion, kind, 
uid?'
+                            type: string
+                          optional:
+                            description: Specify whether the Secret or its key 
must
+                              be defined
+                            type: boolean
+                        required:
+                        - key
+                        type: object
+                      caSecrets:
                         description: 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.
@@ -156,21 +181,6 @@ spec:
                           type: string
                         description: The Maven properties.
                         type: object
-                      servers:
-                        items:
-                          properties:
-                            configuration:
-                              additionalProperties:
-                                type: string
-                              type: object
-                            id:
-                              type: string
-                            password:
-                              type: string
-                            username:
-                              type: string
-                          type: object
-                        type: array
                       settings:
                         description: A reference to the ConfigMap or Secret 
key that
                           contains the Maven settings.
@@ -360,6 +370,31 @@ spec:
                       applications
                     properties:
                       caSecret:
+                        description: 'Deprecated: use CASecrets The Secret 
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.'
+                        properties:
+                          key:
+                            description: The key of the secret to select from. 
 Must
+                              be a valid secret key.
+                            type: string
+                          name:
+                            description: 'Name of the referent. More info: 
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+                              TODO: Add other useful fields. apiVersion, kind, 
uid?'
+                            type: string
+                          optional:
+                            description: Specify whether the Secret or its key 
must
+                              be defined
+                            type: boolean
+                        required:
+                        - key
+                        type: object
+                      caSecrets:
                         description: 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.
@@ -421,21 +456,6 @@ spec:
                           type: string
                         description: The Maven properties.
                         type: object
-                      servers:
-                        items:
-                          properties:
-                            configuration:
-                              additionalProperties:
-                                type: string
-                              type: object
-                            id:
-                              type: string
-                            password:
-                              type: string
-                            username:
-                              type: string
-                          type: object
-                        type: array
                       settings:
                         description: A reference to the ConfigMap or Secret 
key that
                           contains the Maven settings.
diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go
index 2011cba54..f045fa644 100644
--- a/pkg/apis/camel/v1/build_types.go
+++ b/pkg/apis/camel/v1/build_types.go
@@ -87,6 +87,8 @@ type MavenBuildSpec struct {
        MavenSpec `json:",inline"`
        // additional repositories
        Repositories []Repository `json:"repositories,omitempty"`
+       // Servers (auth)
+       Servers []Server `json:"servers,omitempty"`
 }
 
 // PublishTask image publish configuration
diff --git a/pkg/apis/camel/v1/maven_types.go b/pkg/apis/camel/v1/maven_types.go
index 29313c93f..7716cd777 100644
--- a/pkg/apis/camel/v1/maven_types.go
+++ b/pkg/apis/camel/v1/maven_types.go
@@ -32,17 +32,24 @@ type MavenSpec struct {
        // A reference to the ConfigMap or Secret key that contains
        // the Maven settings.
        Settings ValueSource `json:"settings,omitempty"`
+       // Deprecated: use CASecrets
+       // The Secret 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.
+       CASecret *corev1.SecretKeySelector `json:"caSecret,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.
-       CASecret []corev1.SecretKeySelector `json:"caSecret,omitempty"`
+       CASecrets []corev1.SecretKeySelector `json:"caSecrets,omitempty"`
        // The Maven build extensions.
        // See https://maven.apache.org/guides/mini/guide-using-extensions.html.
        Extension []MavenArtifact `json:"extension,omitempty"`
-       Servers   []Server        `json:"servers,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.8.4/maven-embedder/cli.html.
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 1b10f15d9..e787e152d 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1262,6 +1262,13 @@ func (in *MavenBuildSpec) DeepCopyInto(out 
*MavenBuildSpec) {
                *out = make([]Repository, len(*in))
                copy(*out, *in)
        }
+       if in.Servers != nil {
+               in, out := &in.Servers, &out.Servers
+               *out = make([]Server, len(*in))
+               for i := range *in {
+                       (*in)[i].DeepCopyInto(&(*out)[i])
+               }
+       }
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new MavenBuildSpec.
@@ -1287,6 +1294,11 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
        in.Settings.DeepCopyInto(&out.Settings)
        if in.CASecret != nil {
                in, out := &in.CASecret, &out.CASecret
+               *out = new(corev1.SecretKeySelector)
+               (*in).DeepCopyInto(*out)
+       }
+       if in.CASecrets != nil {
+               in, out := &in.CASecrets, &out.CASecrets
                *out = make([]corev1.SecretKeySelector, len(*in))
                for i := range *in {
                        (*in)[i].DeepCopyInto(&(*out)[i])
@@ -1297,13 +1309,6 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
                *out = make([]MavenArtifact, len(*in))
                copy(*out, *in)
        }
-       if in.Servers != nil {
-               in, out := &in.Servers, &out.Servers
-               *out = make([]Server, len(*in))
-               for i := range *in {
-                       (*in)[i].DeepCopyInto(&(*out)[i])
-               }
-       }
        if in.CLIOptions != nil {
                in, out := &in.CLIOptions, &out.CLIOptions
                *out = make([]string, len(*in))
diff --git a/pkg/builder/project.go b/pkg/builder/project.go
index 97fbf903d..6efa153d5 100644
--- a/pkg/builder/project.go
+++ b/pkg/builder/project.go
@@ -24,6 +24,8 @@ import (
        "regexp"
        "strings"
 
+       corev1 "k8s.io/api/core/v1"
+
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
        "github.com/apache/camel-k/pkg/util/camel"
        "github.com/apache/camel-k/pkg/util/jvm"
@@ -76,11 +78,12 @@ func cleanUpBuildDir(ctx *builderContext) error {
 }
 
 func generateJavaKeystore(ctx *builderContext) error {
-       if ctx.Build.Maven.CASecret == nil {
+       // nolint: staticcheck
+       secrets := mergeSecrets(ctx.Build.Maven.CASecrets, 
ctx.Build.Maven.CASecret)
+       if secrets == nil {
                return nil
        }
-
-       certsData, err := kubernetes.GetSecretsRefData(ctx.C, ctx.Client, 
ctx.Namespace, ctx.Build.Maven.CASecret)
+       certsData, err := kubernetes.GetSecretsRefData(ctx.C, ctx.Client, 
ctx.Namespace, secrets)
        if err != nil {
                return err
        }
@@ -91,6 +94,16 @@ func generateJavaKeystore(ctx *builderContext) error {
        return jvm.GenerateKeystore(ctx.C, ctx.Path, ctx.Maven.TrustStoreName, 
ctx.Maven.TrustStorePass, certsData)
 }
 
+func mergeSecrets(secrets []corev1.SecretKeySelector, secret 
*corev1.SecretKeySelector) []corev1.SecretKeySelector {
+       if secrets == nil && secret == nil {
+               return nil
+       }
+       if secret == nil {
+               return secrets
+       }
+       return append(secrets, *secret)
+}
+
 func generateProjectSettings(ctx *builderContext) error {
        val, err := kubernetes.ResolveValueSource(ctx.C, ctx.Client, 
ctx.Namespace, &ctx.Build.Maven.Settings)
        if err != nil {
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index bf4f0b07c..24abcf4a3 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -432,7 +432,7 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
                        if err != nil {
                                return err
                        }
-                       platform.Spec.Build.Maven.CASecret = 
append(platform.Spec.Build.Maven.CASecret, *secret)
+                       platform.Spec.Build.Maven.CASecrets = 
append(platform.Spec.Build.Maven.CASecrets, *secret)
                }
 
                if o.ClusterType != "" {
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index b7b4bd597..c470fd742 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -59,6 +59,7 @@ import (
 
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
        "github.com/apache/camel-k/pkg/client"
+       platformutil "github.com/apache/camel-k/pkg/platform"
        "github.com/apache/camel-k/pkg/trait"
        "github.com/apache/camel-k/pkg/util"
        "github.com/apache/camel-k/pkg/util/defaults"
@@ -587,13 +588,13 @@ func (o *runCmdOptions) createOrUpdateIntegration(cmd 
*cobra.Command, c client.C
                                if !contains(o.Traits, 
"registry.enabled=false") {
                                        o.Traits = append(o.Traits, 
"registry.enabled=true")
                                }
-                               platform, err = getPlatform(o.Context, c, 
integration.Namespace)
+                               platform, err = 
platformutil.GetOrFindForResource(o.Context, c, integration, true)
                                if err != nil {
                                        return nil, err
                                }
                                if platform.Spec.Build.Registry.CA != "" {
                                        fmt.Printf("We've noticed the image 
registry is configured with a custom certificate [%s] \n", 
platform.Spec.Build.Registry.CA)
-                                       fmt.Println("Please make sure Node.js 
is configured to use it or the operation will fail.")
+                                       fmt.Println("Please make sure Kamel CLI 
is configured to use it or the operation will fail.")
                                        fmt.Println("More information can be 
found here https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file";)
                                }
                                if platform.Spec.Build.Registry.Secret != "" {
@@ -781,19 +782,6 @@ func resolvePodTemplate(ctx context.Context, cmd 
*cobra.Command, templateSrc str
        return err
 }
 
-func getPlatform(context context.Context, c client.Client, ns string) 
(*v1.IntegrationPlatform, error) {
-       list := v1.NewIntegrationPlatformList()
-       if err := c.List(context, &list, ctrl.InNamespace(ns)); err != nil {
-               return nil, errors.Wrap(err, fmt.Sprintf("could not retrieve 
integration platform from namespace %s", ns))
-       }
-       if len(list.Items) > 1 {
-               return nil, fmt.Errorf("expected 1 integration platform in the 
namespace, found: %d", len(list.Items))
-       } else if len(list.Items) == 0 {
-               return nil, errors.New("no integration platforms found in the 
namespace: run \"kamel install\" to install the platform")
-       }
-       return &list.Items[0], nil
-}
-
 func uploadFileOrDirectory(platform *v1.IntegrationPlatform, item string, 
integrationName string, cmd *cobra.Command, integration *v1.Integration) error {
        path := strings.TrimPrefix(item, "file://")
        localPath := path
@@ -839,7 +827,7 @@ func uploadFileOrDirectory(platform 
*v1.IntegrationPlatform, item string, integr
                        if err != nil {
                                return err
                        }
-                       dependency := fmt.Sprintf("docker-mvn:%s:%s:%s:%s@%s", 
gav.GroupID, gav.ArtifactID, gav.Type, gav.Version, mountPath)
+                       dependency := 
fmt.Sprintf("registry-mvn:%s:%s:%s:%s@%s", gav.GroupID, gav.ArtifactID, 
gav.Type, gav.Version, mountPath)
                        fmt.Printf("Added %s to the Integration's dependency 
list \n", dependency)
                        integration.Spec.AddDependency(dependency)
                        return uploadAsMavenArtifact(gav, path, platform, 
integration.Namespace, options)
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 77376e5cf..12f6c3274 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -117,9 +117,9 @@ var assets = func() http.FileSystem {
                "/crd/bases/camel.apache.org_builds.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_builds.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 38544,
+                       uncompressedSize: 40381,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x93\x1b\x39\x6e\xef\xfa\x15\x28\xcf\x83\xc7\x55\xfa\xd8\xdd\xdb\xbb\x6c\x26\x95\x4a\xe9\xc6\xeb\x3b\xc5\x1f\xe3\x58\xb3\xbe\xbb\xb7\xa1\xba\x21\x89\xab\x6e\xb2\x43\xb2\x47\xd6\xa5\xf2\xdf\x53\x04\xd9\xad\x96\xd4\x1f\xec\xf9\xb0\x2f\xb7\xe2\x8b\x3d\x2d\x12\x04\x01\x10\x00\x41\x90\xbc\x80\xd1\xd3\x95\xc1\x05\xbc\xe3\x11\x0a\x8d\x31\x18\x09\x66\x8d\x30\xcd\x58\xb4\x46\x98\xcb\xa5\xd9\x32\x85\xf0\x46\xe6\x22\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x73\x23\xb9\x71\xef\xfa\x15\x5d\xa7\x87\xd5\x56\x89\xe4\xdd\xf9\xec\x5c\x94\x4a\xa5\x68\xed\xad\xad\xec\x87\x94\xa5\x6e\x6d\xbf\x09\x9c\x69\x92\x30\x67\x80\x09\x80\x11\x97\x4e\xe5\xbf\xa7\xd0\x00\x86\x43\x72\x3e\x30\xfa\xd8\x75\x6c\xe1\x65\x57\x43\xa0\xd1\x68\x34\xfa\x0b\x0d\xe0\x14\x46\x4f\x57\x4e\x4e\xe1\x3d\x4f\x50\x68\x4c\xc1\x48\x30\x2b\x84\x69\xc1\x92\x15\xc2\x4c\x2e\xcc\x86\x29\x84\xb7\xb2\x14\x29\x
 [...]
                },
                "/crd/bases/camel.apache.org_camelcatalogs.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_camelcatalogs.yaml",
@@ -138,9 +138,9 @@ var assets = func() http.FileSystem {
                "/crd/bases/camel.apache.org_integrationplatforms.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             
"camel.apache.org_integrationplatforms.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 31368,
+                       uncompressedSize: 33300,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x73\xe3\x38\x72\xef\xfa\x15\x5d\xeb\x87\x99\xad\x92\xa8\xdd\xdc\x5d\xe5\xa2\x54\x2a\xe5\xd3\x78\xf6\x1c\xcf\x8c\x1d\x4b\x33\x9b\x7b\x5a\x43\x64\x8b\xc4\x09\x04\x18\x00\x94\x46\x97\xca\x7f\x4f\xa1\x41\x52\x94\x44\x52\xb4\xc7\x7b\xb9\xda\x22\x1f\x76\x3d\x22\xd0\x68\xf4\x77\x03\xdd\xd2\x15\x4c\x5e\xef\x19\x5d\xc1\x07\x1e\xa2\x34\x18\x81\x55\x60\x13\x84\xeb\x8c\x85\x09\xc2\x42\xad\xed\x8e\x69\x84\xf7\x2a\x97\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5d\x5f\x73\xe3\x38\x72\x7f\xd7\xa7\xe8\x5a\x3f\xcc\x6c\x95\x44\xed\xe6\xee\x2a\x17\xa5\x52\x29\x9d\xc6\xb3\xe7\x78\xc6\x76\x2c\xcd\x6c\xee\x69\x0d\x91\x2d\x12\x67\x10\x60\x00\x50\x1a\x5d\x2a\xdf\x3d\x85\x3f\xa4\x28\x89\xff\xe4\xf1\x6c\xb6\xb6\xc8\x87\x5d\x8f\x08\x34\x1a\xdd\x8d\x5f\x77\x03\xe8\xe2\x15\x4c\x5e\xef\x19\x5d\xc1\x07\x1a\x22\x57\x18\x81\x16\xa0\x13\x84\x79\x46\xc2\x04\x61\x29\x36\x7a\x47\x24\xc2\x7b\x
 [...]
                },
                "/crd/bases/camel.apache.org_integrations.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "camel.apache.org_integrations.yaml",
@@ -170,9 +170,9 @@ var assets = func() http.FileSystem {
                "/manager/operator-deployment.yaml": &vfsgen۰CompressedFileInfo{
                        name:             "operator-deployment.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 2395,
+                       uncompressedSize: 2668,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x55\xc1\x72\xe2\x46\x10\xbd\xeb\x2b\x5e\xa1\xcb\x6e\x95\x01\x7b\x4f\x1b\xe5\xa4\xd8\x38\xa6\xe2\x08\x0a\xb1\x71\xed\x29\x35\x8c\x1a\xa9\xcb\xa3\x19\x65\x66\x04\x4b\xbe\x3e\x35\x02\x61\x60\x1d\x27\x07\x57\xed\x9c\x40\xdd\xfd\xfa\xbd\xee\xa7\x51\x8c\xe1\xfb\x9d\x28\xc6\x23\x4b\xd2\x8e\x0a\x78\x03\x5f\x11\xd2\x46\xc8\x8a\x90\x9b\xb5\xdf\x0a\x4b\xb8\x37\xad\x2e\x84\x67\xa3\xf1\x21\xcd\xef\x3f\xa2\xd5\x05\x59\x18\x4d\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x55\xd1\x6e\xe2\x46\x14\x7d\xf7\x57\x1c\xe1\x97\x5d\x29\x98\x90\xa7\xd4\x7d\x72\x13\xd2\xa0\xa6\x06\x61\xb6\xd1\x3e\x55\xc3\xf8\x62\x8f\x18\xcf\xb8\x33\x63\x58\xfa\xf5\xd5\x18\x4c\x80\x24\x74\x57\x8a\xb4\x7e\x02\xdf\x3b\xe7\x9e\x73\xee\xb1\x1d\xa2\xff\x71\x57\x10\xe2\x49\x70\x52\x96\x72\x38\x0d\x57\x12\x92\x9a\xf1\x92\x90\xe9\xa5\xdb\x30\x43\x78\xd0\x8d\xca\x99\x13\x5a\xe1\x53\x92\x3d\x7c\x46\xa3\x72\x32\xd0\x8a\x
 [...]
                },
                "/manager/operator-service-account.yaml": 
&vfsgen۰CompressedFileInfo{
                        name:             "operator-service-account.yaml",
@@ -566,6 +566,13 @@ var assets = func() http.FileSystem {
 
                        compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\xbd\x49\x77\xdb\x3a\xb6\x36\x3c\xcf\xaf\xe0\x3a\x99\xdc\xbb\xbe\x22\xaa\x4e\x4e\x7d\xf7\xbc\x2b\xef\xc8\x51\xe2\xc4\x8e\x9d\x38\x91\x2b\x49\xd5\xe4\x2c\x88\x84\x24\x58\x24\x41\x03\xa0\x2c\xe7\xd7\xbf\x0b\x20\xd8\x4a\xd9\x6c\xbc\xe1\xab\x81\xd8\x60\xe3\xd9\xd8\x0f\x1a\xa2\xc7\xcb\x20\xc4\xfb\xbd\x78\x19\x5c\xf1\x88\x65\x8a\xc5\x81\x16\x81\xde\xb2\xe0\x2c\xa7\xd1\x96\x05\x4b\xb1\xd6\x0f\x54\xb2\xe0\x5c\x14\x59\x4c\x
 [...]
                },
+               "/camel-k-catalog-1.12.0-catalog.yaml": 
&vfsgen۰CompressedFileInfo{
+                       name:             "camel-k-catalog-1.12.0-catalog.yaml",
+                       modTime:          time.Time{},
+                       uncompressedSize: 89838,
+
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\xbd\x49\x77\xdb\x3a\xb6\x36\x3c\xcf\xaf\xe0\x3a\x99\xdc\xbb\xbe\x22\xaa\x4e\x4e\x7d\xf7\xbc\x2b\xef\xc8\x51\xe2\xc4\x8e\x9d\x38\x91\x2b\x49\xd5\xe4\x2c\x88\x84\x24\x58\x24\x41\x03\xa0\x2c\xe7\xd7\xbf\x0b\x20\xd8\x4a\xd9\x6c\xbc\xe1\xab\x81\xd8\x60\xe3\xd9\xd8\x0f\x1a\xa2\xc7\xcb\x20\xc4\xfb\xbd\x78\x19\x5c\xf1\x88\x65\x8a\xc5\x81\x16\x81\xde\xb2\xe0\x2c\xa7\xd1\x96\x05\x4b\xb1\xd6\x0f\x54\xb2\xe0\x5c\x14\x59\x4c\x
 [...]
+               },
                "/traits.yaml": &vfsgen۰CompressedFileInfo{
                        name:             "traits.yaml",
                        modTime:          time.Time{},
diff --git a/pkg/trait/openapi.go b/pkg/trait/openapi.go
index 1a27c81d0..2300946b4 100644
--- a/pkg/trait/openapi.go
+++ b/pkg/trait/openapi.go
@@ -272,9 +272,11 @@ func (t *openAPITrait) createNewOpenAPIConfigMap(e 
*Environment, resource v1.Dat
                return err
        }
        mc.GlobalSettings = data
+       // nolint: staticcheck
+       secrets := mergeSecrets(e.Platform.Status.Build.Maven.CASecrets, 
e.Platform.Status.Build.Maven.CASecret)
 
-       if e.Platform.Status.Build.Maven.CASecret != nil {
-               certsData, err := kubernetes.GetSecretsRefData(e.Ctx, e.Client, 
e.Platform.Namespace, e.Platform.Status.Build.Maven.CASecret)
+       if secrets != nil {
+               certsData, err := kubernetes.GetSecretsRefData(e.Ctx, e.Client, 
e.Platform.Namespace, secrets)
                if err != nil {
                        return err
                }
@@ -348,6 +350,16 @@ func (t *openAPITrait) createNewOpenAPIConfigMap(e 
*Environment, resource v1.Dat
        return nil
 }
 
+func mergeSecrets(secrets []corev1.SecretKeySelector, secret 
*corev1.SecretKeySelector) []corev1.SecretKeySelector {
+       if secrets == nil && secret == nil {
+               return nil
+       }
+       if secret == nil {
+               return secrets
+       }
+       return append(secrets, *secret)
+}
+
 func (t *openAPITrait) generateMavenProject(e *Environment) (maven.Project, 
error) {
        if e.CamelCatalog == nil {
                return maven.Project{}, errors.New("unknown camel catalog")
diff --git a/pkg/trait/registry.go b/pkg/trait/registry.go
index 361d3b5d7..9e6070ac5 100644
--- a/pkg/trait/registry.go
+++ b/pkg/trait/registry.go
@@ -251,13 +251,13 @@ func addImageRegistryCaToMavenBuild(registryCa string, 
build *v1.BuilderTask) er
                return err
        }
        contains := false
-       for _, ca := range build.Maven.CASecret {
+       for _, ca := range build.Maven.CASecrets {
                if ca.Name == secret.Name && ca.Key == secret.Key {
                        contains = true
                }
        }
        if !contains {
-               build.Maven.CASecret = append(build.Maven.CASecret, *secret)
+               build.Maven.CASecrets = append(build.Maven.CASecrets, *secret)
        }
        return nil
 }
diff --git a/pkg/util/camel/camel_dependencies.go 
b/pkg/util/camel/camel_dependencies.go
index 184e5d8b8..ae43f9c7f 100644
--- a/pkg/util/camel/camel_dependencies.go
+++ b/pkg/util/camel/camel_dependencies.go
@@ -104,10 +104,10 @@ func addDependencies(project *maven.Project, dependencies 
[]string, catalog *Run
                        gav := strings.TrimPrefix(d, "mvn:")
 
                        project.AddEncodedDependencyGAV(gav)
-               case strings.HasPrefix(d, "docker-mvn:"):
+               case strings.HasPrefix(d, "registry-mvn:"):
                        mapping := strings.Split(d, "@")
                        outputFileRelativePath := mapping[1]
-                       gavString := strings.TrimPrefix(mapping[0], 
"docker-mvn:")
+                       gavString := strings.TrimPrefix(mapping[0], 
"registry-mvn:")
                        gav, err := maven.ParseGAV(gavString)
                        if err != nil {
                                return err
diff --git a/pkg/util/camel/catalog.go b/pkg/util/camel/catalog.go
index c34e2201a..375d9ba47 100644
--- a/pkg/util/camel/catalog.go
+++ b/pkg/util/camel/catalog.go
@@ -23,6 +23,7 @@ import (
 
        yaml2 "gopkg.in/yaml.v2"
 
+       corev1 "k8s.io/api/core/v1"
        ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
@@ -94,8 +95,10 @@ func GenerateCatalog(
        }
 
        var caCerts [][]byte
-       if mvn.CASecret != nil {
-               caCerts, err = kubernetes.GetSecretsRefData(ctx, client, 
namespace, mvn.CASecret)
+       // nolint: staticcheck
+       secrets := mergeSecrets(mvn.CASecrets, mvn.CASecret)
+       if secrets != nil {
+               caCerts, err = kubernetes.GetSecretsRefData(ctx, client, 
namespace, secrets)
                if err != nil {
                        return nil, err
                }
@@ -104,6 +107,16 @@ func GenerateCatalog(
        return GenerateCatalogCommon(ctx, globalSettings, []byte(userSettings), 
caCerts, mvn, runtime, providerDependencies)
 }
 
+func mergeSecrets(secrets []corev1.SecretKeySelector, secret 
*corev1.SecretKeySelector) []corev1.SecretKeySelector {
+       if secrets == nil && secret == nil {
+               return nil
+       }
+       if secret == nil {
+               return secrets
+       }
+       return append(secrets, *secret)
+}
+
 func GenerateCatalogCommon(
        ctx context.Context,
        globalSettings []byte,

Reply via email to