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 2022/06/20 12:50:36 UTC

[camel-k] branch main updated (030f95804 -> d93c44bcc)

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

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


    from 030f95804 feat(cli): promote kameletbinding support
     new 6c397ba62 Add settings security to Maven build
     new d93c44bcc New resources generated from make command

The 2 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:
 config/crd/bases/camel.apache.org_builds.yaml      |  44 +++++++
 .../camel.apache.org_integrationplatforms.yaml     |  84 ++++++++++++
 docs/modules/ROOT/pages/configuration/maven.adoc   |  33 ++++-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |   8 ++
 examples/maven/README.md                           |  17 +++
 examples/maven/ip.yaml                             |  15 +++
 helm/camel-k/crds/crd-build.yaml                   |  44 +++++++
 helm/camel-k/crds/crd-integration-platform.yaml    |  84 ++++++++++++
 pkg/apis/camel/v1/maven_types.go                   |   3 +
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |   1 +
 pkg/builder/project.go                             |   8 ++
 pkg/builder/project_test.go                        | 142 +++++++++++++++++++++
 pkg/builder/quarkus.go                             |   2 +
 pkg/builder/types.go                               |  11 +-
 pkg/resources/resources.go                         |   8 +-
 pkg/util/maven/maven_command.go                    |   7 +
 16 files changed, 501 insertions(+), 10 deletions(-)
 create mode 100644 examples/maven/README.md
 create mode 100644 examples/maven/ip.yaml


[camel-k] 01/02: Add settings security to Maven build

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

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

commit 6c397ba62c12c3acb63d1c81a9939216f49c414c
Author: haanhvu <ha...@gmail.com>
AuthorDate: Wed May 11 16:30:36 2022 +0700

    Add settings security to Maven build
---
 config/crd/bases/camel.apache.org_builds.yaml      |  44 +++++++
 .../camel.apache.org_integrationplatforms.yaml     |  84 ++++++++++++
 docs/modules/ROOT/pages/configuration/maven.adoc   |  33 ++++-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |   8 ++
 examples/maven/README.md                           |  17 +++
 examples/maven/ip.yaml                             |  15 +++
 helm/camel-k/crds/crd-build.yaml                   |  44 +++++++
 helm/camel-k/crds/crd-integration-platform.yaml    |  84 ++++++++++++
 pkg/apis/camel/v1/maven_types.go                   |   3 +
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |   1 +
 pkg/builder/project.go                             |   8 ++
 pkg/builder/project_test.go                        | 142 +++++++++++++++++++++
 pkg/builder/quarkus.go                             |   2 +
 pkg/builder/types.go                               |  11 +-
 pkg/util/maven/maven_command.go                    |   7 +
 15 files changed, 497 insertions(+), 6 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml
index 6ac023fd6..5db172705 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -373,6 +373,50 @@ spec:
                                   - key
                                   type: object
                               type: object
+                            settingsSecurity:
+                              description: A reference to the ConfigMap or Secret
+                                key that contains the security of the Maven settings.
+                              properties:
+                                configMapKeyRef:
+                                  description: Selects a key of a ConfigMap.
+                                  properties:
+                                    key:
+                                      description: The key to select.
+                                      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 ConfigMap or
+                                        its key must be defined
+                                      type: boolean
+                                  required:
+                                  - key
+                                  type: object
+                                secretKeyRef:
+                                  description: Selects a key of a secret.
+                                  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
+                              type: object
                           type: object
                         name:
                           description: name of the task
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 1b82862f5..d83005fbe 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -223,6 +223,48 @@ spec:
                             - key
                             type: object
                         type: object
+                      settingsSecurity:
+                        description: A reference to the ConfigMap or Secret key that
+                          contains the security of the Maven settings.
+                        properties:
+                          configMapKeyRef:
+                            description: Selects a key of a ConfigMap.
+                            properties:
+                              key:
+                                description: The key to select.
+                                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 ConfigMap or its
+                                  key must be defined
+                                type: boolean
+                            required:
+                            - key
+                            type: object
+                          secretKeyRef:
+                            description: Selects a key of a secret.
+                            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
+                        type: object
                     type: object
                   persistentVolumeClaim:
                     description: 'Deprecated: Use PublishStrategyOptions instead the
@@ -498,6 +540,48 @@ spec:
                             - key
                             type: object
                         type: object
+                      settingsSecurity:
+                        description: A reference to the ConfigMap or Secret key that
+                          contains the security of the Maven settings.
+                        properties:
+                          configMapKeyRef:
+                            description: Selects a key of a ConfigMap.
+                            properties:
+                              key:
+                                description: The key to select.
+                                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 ConfigMap or its
+                                  key must be defined
+                                type: boolean
+                            required:
+                            - key
+                            type: object
+                          secretKeyRef:
+                            description: Selects a key of a secret.
+                            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
+                        type: object
                     type: object
                   persistentVolumeClaim:
                     description: 'Deprecated: Use PublishStrategyOptions instead the
diff --git a/docs/modules/ROOT/pages/configuration/maven.adoc b/docs/modules/ROOT/pages/configuration/maven.adoc
index 69a71960a..1f860fd80 100644
--- a/docs/modules/ROOT/pages/configuration/maven.adoc
+++ b/docs/modules/ROOT/pages/configuration/maven.adoc
@@ -29,7 +29,38 @@ spec:
           name: maven-settings
 ----
 
-The IntegrationPlatform resource can be edited directly, to reference the ConfigMap or the Secret that contains the Maven settings, e.g.:
+[[maven-settings-security]]
+=== Maven Settings Security
+
+If your project also requires a Maven Settings Security in a `settings-security.xml` file (as described in https://maven.apache.org/guides/mini/guide-encryption.html[the official Maven Password Encryption guide]), you can create a ConfigMap or Secret for that file
+
+[source,console]
+----
+$ kubectl create configmap maven-settings-security --from-file=settings-security.xml
+----
+
+and reference it in the IntegrationPlatform resource:
+
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1
+kind: IntegrationPlatform
+metadata:
+  name: camel-k
+spec:
+  build:
+    maven:
+      settings:
+        configMapKeyRef:
+          key: settings.xml
+          name: maven-settings
+      settingsSecurity:
+        configMapKeyRef:
+          key: settings-security.xml
+          name: maven-settings-security
+----
+
+The IntegrationPlatform resource can be edited directly, to reference the ConfigMap(s) or the Secret(s) that contains the Maven settings and settings security, e.g.:
 
 [source,console]
 ----
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 445c66379..b70cc29db 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -2348,6 +2348,14 @@ The Maven properties.
 A reference to the ConfigMap or Secret key that contains
 the Maven settings.
 
+|`settingsSecurity` +
+*xref:#_camel_apache_org_v1_ValueSource[ValueSource]*
+|
+
+
+A reference to the ConfigMap or Secret key that contains
+the security of the Maven settings.
+
 |`caSecret` +
 *https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#secretkeyselector-v1-core[Kubernetes core/v1.SecretKeySelector]*
 |
diff --git a/examples/maven/README.md b/examples/maven/README.md
new file mode 100644
index 000000000..9d3c5cd3d
--- /dev/null
+++ b/examples/maven/README.md
@@ -0,0 +1,17 @@
+# Camel K Maven configuration examples
+
+In this section, you'll find examples about Maven configurations in Camel K.
+
+**Example 1: Reference Maven setting files in an IntegrationPlatform resource**
+
+If you have a `settings.xml` file and (optionally) a `settings-security.xml` file, you can create a ConfigMap or a Secret for each file in Kubernetes:
+
+`kubectl create configmap maven-settings --from-file=settings.xml`
+
+`kubectl create configmap maven-settings-security --from-file=settings-security.xml`
+
+The created ConfigMap(s) or Secret(s) can then be referenced in an IntegrationPlatform file like the example `ip.yaml`
+
+With an IntegrationPlatform file, you can then create an IntegrationPlatform in Kubernetes:
+
+`kubectl apply -f ip.yaml`
\ No newline at end of file
diff --git a/examples/maven/ip.yaml b/examples/maven/ip.yaml
new file mode 100644
index 000000000..65741a66c
--- /dev/null
+++ b/examples/maven/ip.yaml
@@ -0,0 +1,15 @@
+apiVersion: camel.apache.org/v1
+kind: IntegrationPlatform
+metadata:
+  name: camel-k
+spec:
+  build:
+    maven:
+      settings:
+        configMapKeyRef:
+          key: settings.xml
+          name: maven-settings
+      settingsSecurity:
+        configMapKeyRef:
+          key: settings-security.xml
+          name: maven-settings-security
\ No newline at end of file
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index 6ac023fd6..5db172705 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -373,6 +373,50 @@ spec:
                                   - key
                                   type: object
                               type: object
+                            settingsSecurity:
+                              description: A reference to the ConfigMap or Secret
+                                key that contains the security of the Maven settings.
+                              properties:
+                                configMapKeyRef:
+                                  description: Selects a key of a ConfigMap.
+                                  properties:
+                                    key:
+                                      description: The key to select.
+                                      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 ConfigMap or
+                                        its key must be defined
+                                      type: boolean
+                                  required:
+                                  - key
+                                  type: object
+                                secretKeyRef:
+                                  description: Selects a key of a secret.
+                                  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
+                              type: object
                           type: object
                         name:
                           description: name of the task
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml
index 1b82862f5..d83005fbe 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -223,6 +223,48 @@ spec:
                             - key
                             type: object
                         type: object
+                      settingsSecurity:
+                        description: A reference to the ConfigMap or Secret key that
+                          contains the security of the Maven settings.
+                        properties:
+                          configMapKeyRef:
+                            description: Selects a key of a ConfigMap.
+                            properties:
+                              key:
+                                description: The key to select.
+                                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 ConfigMap or its
+                                  key must be defined
+                                type: boolean
+                            required:
+                            - key
+                            type: object
+                          secretKeyRef:
+                            description: Selects a key of a secret.
+                            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
+                        type: object
                     type: object
                   persistentVolumeClaim:
                     description: 'Deprecated: Use PublishStrategyOptions instead the
@@ -498,6 +540,48 @@ spec:
                             - key
                             type: object
                         type: object
+                      settingsSecurity:
+                        description: A reference to the ConfigMap or Secret key that
+                          contains the security of the Maven settings.
+                        properties:
+                          configMapKeyRef:
+                            description: Selects a key of a ConfigMap.
+                            properties:
+                              key:
+                                description: The key to select.
+                                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 ConfigMap or its
+                                  key must be defined
+                                type: boolean
+                            required:
+                            - key
+                            type: object
+                          secretKeyRef:
+                            description: Selects a key of a secret.
+                            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
+                        type: object
                     type: object
                   persistentVolumeClaim:
                     description: 'Deprecated: Use PublishStrategyOptions instead the
diff --git a/pkg/apis/camel/v1/maven_types.go b/pkg/apis/camel/v1/maven_types.go
index 7716cd777..252cc3166 100644
--- a/pkg/apis/camel/v1/maven_types.go
+++ b/pkg/apis/camel/v1/maven_types.go
@@ -32,6 +32,9 @@ type MavenSpec struct {
 	// A reference to the ConfigMap or Secret key that contains
 	// the Maven settings.
 	Settings ValueSource `json:"settings,omitempty"`
+	// A reference to the ConfigMap or Secret key that contains
+	// the security of the Maven settings.
+	SettingsSecurity ValueSource `json:"settingsSecurity,omitempty"`
 	// Deprecated: use CASecrets
 	// The Secret name and key, containing the CA certificate(s) used to connect
 	// to remote Maven repositories.
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index f01175b95..521ba3cce 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1292,6 +1292,7 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) {
 		}
 	}
 	in.Settings.DeepCopyInto(&out.Settings)
+	in.SettingsSecurity.DeepCopyInto(&out.SettingsSecurity)
 	if in.CASecret != nil {
 		in, out := &in.CASecret, &out.CASecret
 		*out = new(corev1.SecretKeySelector)
diff --git a/pkg/builder/project.go b/pkg/builder/project.go
index 6efa153d5..28878c8d1 100644
--- a/pkg/builder/project.go
+++ b/pkg/builder/project.go
@@ -124,6 +124,14 @@ func generateProjectSettings(ctx *builderContext) error {
 	}
 	ctx.Maven.GlobalSettings = data
 
+	settingsSecurity, err := kubernetes.ResolveValueSource(ctx.C, ctx.Client, ctx.Namespace, &ctx.Build.Maven.SettingsSecurity)
+	if err != nil {
+		return err
+	}
+	if settingsSecurity != "" {
+		ctx.Maven.SettingsSecurity = []byte(settingsSecurity)
+	}
+
 	return nil
 }
 
diff --git a/pkg/builder/project_test.go b/pkg/builder/project_test.go
index e816b745d..15bd9f212 100644
--- a/pkg/builder/project_test.go
+++ b/pkg/builder/project_test.go
@@ -239,6 +239,77 @@ func TestMavenSettingsFromConfigMap(t *testing.T) {
 	assert.Equal(t, []byte("setting-data"), ctx.Maven.UserSettings)
 }
 
+func TestMavenSettingsWithSettingsSecurityFromConfigMap(t *testing.T) {
+	catalog, err := camel.DefaultCatalog()
+	assert.Nil(t, err)
+
+	c, err := test.NewFakeClient(
+		&corev1.ConfigMap{
+			TypeMeta: metav1.TypeMeta{
+				APIVersion: "v1",
+				Kind:       "ConfigMap",
+			},
+			ObjectMeta: metav1.ObjectMeta{
+				Namespace: "ns",
+				Name:      "maven-settings",
+			},
+			Data: map[string]string{
+				"settings.xml": "setting-data",
+			},
+		},
+		&corev1.ConfigMap{
+			TypeMeta: metav1.TypeMeta{
+				APIVersion: "v1",
+				Kind:       "ConfigMap",
+			},
+			ObjectMeta: metav1.ObjectMeta{
+				Namespace: "ns",
+				Name:      "maven-settings-security",
+			},
+			Data: map[string]string{
+				"settings-security.xml": "setting-security-data",
+			},
+		},
+	)
+
+	assert.Nil(t, err)
+
+	ctx := builderContext{
+		Catalog:   catalog,
+		Client:    c,
+		Namespace: "ns",
+		Build: v1.BuilderTask{
+			Runtime: catalog.Runtime,
+			Maven: v1.MavenBuildSpec{
+				MavenSpec: v1.MavenSpec{
+					Settings: v1.ValueSource{
+						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
+							LocalObjectReference: corev1.LocalObjectReference{
+								Name: "maven-settings",
+							},
+							Key: "settings.xml",
+						},
+					},
+					SettingsSecurity: v1.ValueSource{
+						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
+							LocalObjectReference: corev1.LocalObjectReference{
+								Name: "maven-settings-security",
+							},
+							Key: "settings-security.xml",
+						},
+					},
+				},
+			},
+		},
+	}
+
+	err = Project.GenerateProjectSettings.execute(&ctx)
+	assert.Nil(t, err)
+
+	assert.Equal(t, []byte("setting-data"), ctx.Maven.UserSettings)
+	assert.Equal(t, []byte("setting-security-data"), ctx.Maven.SettingsSecurity)
+}
+
 func TestMavenSettingsFromSecret(t *testing.T) {
 	catalog, err := camel.DefaultCatalog()
 	assert.Nil(t, err)
@@ -288,6 +359,77 @@ func TestMavenSettingsFromSecret(t *testing.T) {
 	assert.Equal(t, []byte("setting-data"), ctx.Maven.UserSettings)
 }
 
+func TestMavenSettingsWithSettingsSecurityFromSecret(t *testing.T) {
+	catalog, err := camel.DefaultCatalog()
+	assert.Nil(t, err)
+
+	c, err := test.NewFakeClient(
+		&corev1.Secret{
+			TypeMeta: metav1.TypeMeta{
+				APIVersion: "v1",
+				Kind:       "Secret",
+			},
+			ObjectMeta: metav1.ObjectMeta{
+				Namespace: "ns",
+				Name:      "maven-settings",
+			},
+			Data: map[string][]byte{
+				"settings.xml": []byte("setting-data"),
+			},
+		},
+		&corev1.Secret{
+			TypeMeta: metav1.TypeMeta{
+				APIVersion: "v1",
+				Kind:       "Secret",
+			},
+			ObjectMeta: metav1.ObjectMeta{
+				Namespace: "ns",
+				Name:      "maven-settings-security",
+			},
+			Data: map[string][]byte{
+				"settings-security.xml": []byte("setting-security-data"),
+			},
+		},
+	)
+
+	assert.Nil(t, err)
+
+	ctx := builderContext{
+		Catalog:   catalog,
+		Client:    c,
+		Namespace: "ns",
+		Build: v1.BuilderTask{
+			Runtime: catalog.Runtime,
+			Maven: v1.MavenBuildSpec{
+				MavenSpec: v1.MavenSpec{
+					Settings: v1.ValueSource{
+						SecretKeyRef: &corev1.SecretKeySelector{
+							LocalObjectReference: corev1.LocalObjectReference{
+								Name: "maven-settings",
+							},
+							Key: "settings.xml",
+						},
+					},
+					SettingsSecurity: v1.ValueSource{
+						SecretKeyRef: &corev1.SecretKeySelector{
+							LocalObjectReference: corev1.LocalObjectReference{
+								Name: "maven-settings-security",
+							},
+							Key: "settings-security.xml",
+						},
+					},
+				},
+			},
+		},
+	}
+
+	err = Project.GenerateProjectSettings.execute(&ctx)
+	assert.Nil(t, err)
+
+	assert.Equal(t, []byte("setting-data"), ctx.Maven.UserSettings)
+	assert.Equal(t, []byte("setting-security-data"), ctx.Maven.SettingsSecurity)
+}
+
 func TestInjectEmptyServersIntoDefaultMavenSettings(t *testing.T) {
 	settings, err := maven.NewSettings(maven.DefaultRepositories)
 	assert.Nil(t, err)
diff --git a/pkg/builder/quarkus.go b/pkg/builder/quarkus.go
index 6f2d2d240..f8cd30786 100644
--- a/pkg/builder/quarkus.go
+++ b/pkg/builder/quarkus.go
@@ -153,6 +153,7 @@ func buildQuarkusRunner(ctx *builderContext) error {
 	mc := maven.NewContext(path.Join(ctx.Path, "maven"))
 	mc.GlobalSettings = ctx.Maven.GlobalSettings
 	mc.UserSettings = ctx.Maven.UserSettings
+	mc.SettingsSecurity = ctx.Maven.SettingsSecurity
 	mc.LocalRepository = ctx.Build.Maven.LocalRepository
 	mc.AdditionalArguments = ctx.Build.Maven.CLIOptions
 
@@ -200,6 +201,7 @@ func computeQuarkusDependencies(ctx *builderContext) error {
 	mc := maven.NewContext(path.Join(ctx.Path, "maven"))
 	mc.GlobalSettings = ctx.Maven.GlobalSettings
 	mc.UserSettings = ctx.Maven.UserSettings
+	mc.SettingsSecurity = ctx.Maven.SettingsSecurity
 	mc.LocalRepository = ctx.Build.Maven.LocalRepository
 	mc.AdditionalArguments = ctx.Build.Maven.CLIOptions
 
diff --git a/pkg/builder/types.go b/pkg/builder/types.go
index bb2a2f204..5d3fef9b6 100644
--- a/pkg/builder/types.go
+++ b/pkg/builder/types.go
@@ -84,10 +84,11 @@ type builderContext struct {
 	SelectedArtifacts []v1.Artifact
 	Resources         []resource
 	Maven             struct {
-		Project        maven.Project
-		UserSettings   []byte
-		GlobalSettings []byte
-		TrustStoreName string
-		TrustStorePass string
+		Project          maven.Project
+		UserSettings     []byte
+		GlobalSettings   []byte
+		SettingsSecurity []byte
+		TrustStoreName   string
+		TrustStorePass   string
 	}
 }
diff --git a/pkg/util/maven/maven_command.go b/pkg/util/maven/maven_command.go
index 750c4b786..2440a4328 100644
--- a/pkg/util/maven/maven_command.go
+++ b/pkg/util/maven/maven_command.go
@@ -147,6 +147,7 @@ type Context struct {
 	ExtraMavenOpts      []string
 	GlobalSettings      []byte
 	UserSettings        []byte
+	SettingsSecurity    []byte
 	AdditionalArguments []string
 	AdditionalEntries   map[string]interface{}
 	LocalRepository     string
@@ -193,6 +194,12 @@ func generateProjectStructure(context Context, project Project) error {
 		}
 	}
 
+	if context.SettingsSecurity != nil {
+		if err := util.WriteFileWithContent(path.Join(context.Path, "settings-security.xml"), context.SettingsSecurity); err != nil {
+			return err
+		}
+	}
+
 	for k, v := range context.AdditionalEntries {
 		var bytes []byte
 		var err error


[camel-k] 02/02: New resources generated from make command

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

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

commit d93c44bcc85b3c9369238a28b196e5b70524a7a7
Author: haanhvu <ha...@gmail.com>
AuthorDate: Wed May 18 22:17:12 2022 +0700

    New resources generated from make command
---
 pkg/resources/resources.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index dafa8498c..8bd9fad71 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: 40596,
+			uncompressedSize: 43260,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x6b\x73\xe3\x38\x72\xdf\xfd\x2b\xba\xd6\x1f\xc6\x53\x65\x49\xbb\x7b\x8f\x6c\x9c\x4a\xa5\x74\x9e\x9d\x3d\x67\x1e\x76\x46\xde\xb9\xbb\x6f\x86\xc8\x96\x84\x13\x09\x30\x00\x68\x8d\x2e\x95\xff\x9e\x42\x03\xa0\x28\x89\x0f\xd0\x8f\x99\xcb\x9d\xf1\x65\xc6\x14\xd8\xe8\x6e\x34\xfa\x85\x06\x78\x0a\xa3\xa7\x6b\x27\xa7\xf0\x9e\x27\x28\x34\xa6\x60\x24\x98\x15\xc2\xb4\x60\xc9\x0a\x61\x26\x17\x66\xc3\x14\xc2\x5b\x59\x8a\x94\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x73\x1b\x39\x8e\xef\xfe\x15\xa8\xf1\x43\x9c\x2a\x4b\x9a\x99\xfd\xb8\x39\x5f\x5d\x5d\x69\x9d\x99\x59\x5f\x3e\x9c\x8b\x3c\xd9\xdd\x37\x53\xdd\x90\xc4\x51\x37\xd9\x47\xb2\xad\x68\xaf\xee\xbf\x5f\x11\x24\x5b\x2d\xa9\x3f\xd8\x8e\x9d\xec\xed\x88\x2f\x89\x5b\x24\x08\x82\x20\x00\x82\x20\x78\x0e\xa3\xa7\x2b\x67\xe7\xf0\x86\x27\x28\x34\xa6\x60\x24\x98\x15\xc2\xb4\x60\xc9\x0a\x61\x26\x17\x66\xc3\x14\xc2\x4f\xb2\x14\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: 33529,
+			uncompressedSize: 38193,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5d\xdd\x73\xe3\x38\x72\x7f\xd7\x5f\xd1\xb5\x7e\x98\xd9\x2a\x89\xda\xcd\x7d\xe4\xa2\x54\x2a\xa5\xd3\x78\xf6\x1c\xcf\xd8\x8e\xa5\x99\xcd\x3d\xad\x21\xb2\x45\xe2\x0c\x02\x0c\x00\x4a\xa3\x4b\xe5\x7f\x4f\xe1\x83\x14\x25\xf1\x4b\x1e\xcf\x65\x6b\x8b\x7c\xd8\xf5\x88\x40\xa3\xd1\xdd\xe8\xfe\x35\x80\x2e\x5e\xc1\xe4\xf5\x9e\xd1\x15\x7c\xa0\x21\x72\x85\x11\x68\x01\x3a\x41\x98\x67\x24\x4c\x10\x96\x62\xa3\x77\x44\x22\xbc\x17\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xdf\x93\xdb\x38\x72\xff\xbb\xfe\x8a\xae\x9d\x07\x7b\xab\x24\x6a\xf7\x7b\x3f\xbe\x97\x49\xa5\x52\x3a\x79\xbc\x37\x19\xdb\x33\x19\xc9\xde\xdc\xd3\x0e\x44\xb6\x44\xdc\x80\x00\x03\x80\x92\x75\xa9\xfc\xef\x29\x34\x40\x89\x92\x48\x8a\x1a\xdb\x97\xad\x0d\xf9\xb0\x3b\x26\x81\x46\xa3\xbb\xd1\xfd\x01\x89\x6e\x5d\xc1\xe8\xeb\x5d\x83\x2b\x78\xc7\x63\x94\x06\x13\xb0\x0a\x6c\x8a\x30\xc9\x59\x9c\x22\xcc\xd4\xd2\x6e\x98\x46\x [...]
 		},
 		"/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrations.yaml",