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 2024/03/13 15:51:52 UTC

(camel-k) branch main updated: chore: propagate capabilities to Kit

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


The following commit(s) were added to refs/heads/main by this push:
     new d2ec89c9e chore: propagate capabilities to Kit
d2ec89c9e is described below

commit d2ec89c9ed29e086f1d7ebac591113a7f3f5b206
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Mar 13 15:32:22 2024 +0100

    chore: propagate capabilities to Kit
    
    Useful in order to know what are the capabilities instead of inspecting the dependencies. It may also enable finer tuning on the kits matching.
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc             |  7 +++++++
 helm/camel-k/crds/crd-integration-kit.yaml                    |  5 +++++
 pkg/apis/camel/v1/integrationkit_types.go                     |  2 ++
 pkg/apis/camel/v1/zz_generated.deepcopy.go                    |  5 +++++
 .../camel/applyconfiguration/camel/v1/integrationkitspec.go   | 11 +++++++++++
 .../config/crd/bases/camel.apache.org_integrationkits.yaml    |  5 +++++
 pkg/trait/quarkus.go                                          |  7 +++----
 7 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index b81ddd851..f08fee353 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -2494,6 +2494,13 @@ Maven repositories that can be used by the kit
 
 the sources to add at build time
 
+|`capabilities` +
+[]string
+|
+
+
+features offered by the IntegrationKit
+
 
 |===
 
diff --git a/helm/camel-k/crds/crd-integration-kit.yaml b/helm/camel-k/crds/crd-integration-kit.yaml
index 28880c09c..29bf85c96 100644
--- a/helm/camel-k/crds/crd-integration-kit.yaml
+++ b/helm/camel-k/crds/crd-integration-kit.yaml
@@ -88,6 +88,11 @@ spec:
           spec:
             description: the desired configuration
             properties:
+              capabilities:
+                description: features offered by the IntegrationKit
+                items:
+                  type: string
+                type: array
               configuration:
                 description: 'Deprecated: Use camel trait (camel.properties) to manage
                   properties Use mount trait (mount.configs) to manage configs Use
diff --git a/pkg/apis/camel/v1/integrationkit_types.go b/pkg/apis/camel/v1/integrationkit_types.go
index 876323731..d8b0864c4 100644
--- a/pkg/apis/camel/v1/integrationkit_types.go
+++ b/pkg/apis/camel/v1/integrationkit_types.go
@@ -74,6 +74,8 @@ type IntegrationKitSpec struct {
 	Repositories []string `json:"repositories,omitempty"`
 	// the sources to add at build time
 	Sources []SourceSpec `json:"sources,omitempty"`
+	// features offered by the IntegrationKit
+	Capabilities []string `json:"capabilities,omitempty"`
 }
 
 // IntegrationKitTraits defines traits assigned to an `IntegrationKit`.
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 96f5e5fc6..6ca63f75f 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -1248,6 +1248,11 @@ func (in *IntegrationKitSpec) DeepCopyInto(out *IntegrationKitSpec) {
 			(*in)[i].DeepCopyInto(&(*out)[i])
 		}
 	}
+	if in.Capabilities != nil {
+		in, out := &in.Capabilities, &out.Capabilities
+		*out = make([]string, len(*in))
+		copy(*out, *in)
+	}
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntegrationKitSpec.
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/integrationkitspec.go b/pkg/client/camel/applyconfiguration/camel/v1/integrationkitspec.go
index 19bd2e613..9d85a6829 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/integrationkitspec.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/integrationkitspec.go
@@ -33,6 +33,7 @@ type IntegrationKitSpecApplyConfiguration struct {
 	Configuration []ConfigurationSpecApplyConfiguration   `json:"configuration,omitempty"`
 	Repositories  []string                                `json:"repositories,omitempty"`
 	Sources       []SourceSpecApplyConfiguration          `json:"sources,omitempty"`
+	Capabilities  []string                                `json:"capabilities,omitempty"`
 }
 
 // IntegrationKitSpecApplyConfiguration constructs an declarative configuration of the IntegrationKitSpec type for use with
@@ -110,3 +111,13 @@ func (b *IntegrationKitSpecApplyConfiguration) WithSources(values ...*SourceSpec
 	}
 	return b
 }
+
+// WithCapabilities adds the given value to the Capabilities 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 Capabilities field.
+func (b *IntegrationKitSpecApplyConfiguration) WithCapabilities(values ...string) *IntegrationKitSpecApplyConfiguration {
+	for i := range values {
+		b.Capabilities = append(b.Capabilities, values[i])
+	}
+	return b
+}
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 28880c09c..29bf85c96 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -88,6 +88,11 @@ spec:
           spec:
             description: the desired configuration
             properties:
+              capabilities:
+                description: features offered by the IntegrationKit
+                items:
+                  type: string
+                type: array
               configuration:
                 description: 'Deprecated: Use camel trait (camel.properties) to manage
                   properties Use mount trait (mount.configs) to manage configs Use
diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index 3803cb24f..6b75d4b97 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -273,27 +273,26 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment, packageType quarkusPack
 			v1.SetAnnotation(&kit.ObjectMeta, v1.IntegrationProfileNamespaceAnnotation, e.Integration.Namespace)
 		}
 	}
-
 	for k, v := range integration.Annotations {
 		if strings.HasPrefix(k, v1.TraitAnnotationPrefix) {
 			v1.SetAnnotation(&kit.ObjectMeta, k, v)
 		}
 	}
-
 	operatorID := defaults.OperatorID()
 	if operatorID != "" {
 		kit.SetOperatorID(operatorID)
 	}
-
 	kit.Spec = v1.IntegrationKitSpec{
 		Dependencies: e.Integration.Status.Dependencies,
 		Repositories: e.Integration.Spec.Repositories,
 		Traits:       propagateKitTraits(e),
 	}
-
 	if packageType == nativeSourcesPackageType {
 		kit.Spec.Sources = propagateSourcesRequiredAtBuildTime(e)
 	}
+	if e.Integration.Status.Capabilities != nil {
+		kit.Spec.Capabilities = e.Integration.Status.Capabilities
+	}
 	return kit
 }