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/20 11:53:25 UTC
(camel-k) branch main updated: feat(trait): move runtime logic into trait catalog
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 7f42ac84a feat(trait): move runtime logic into trait catalog
7f42ac84a is described below
commit 7f42ac84af480360494c0ea4492ea0a7b40a7a09
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Mar 20 11:00:20 2024 +0100
feat(trait): move runtime logic into trait catalog
---
docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 23 ++++++++++-
helm/camel-k/crds/crd-build.yaml | 46 +++++++++++++++++----
helm/camel-k/crds/crd-camel-catalog.yaml | 22 ++++++++--
pkg/apis/camel/v1/common_types.go | 11 ++++-
pkg/apis/camel/v1/zz_generated.deepcopy.go | 21 ++++++++++
.../applyconfiguration/camel/v1/capability.go | 47 +++++++++++++++++++++-
.../config/crd/bases/camel.apache.org_builds.yaml | 46 +++++++++++++++++----
.../crd/bases/camel.apache.org_camelcatalogs.yaml | 22 ++++++++--
8 files changed, 210 insertions(+), 28 deletions(-)
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index f08fee353..df8d38f86 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -1400,7 +1400,7 @@ list of dependencies needed for this scope
* <<#_camel_apache_org_v1_RuntimeSpec, RuntimeSpec>>
-Capability is a particular feature which requires a well known set of dependencies
+Capability is a particular feature which requires a well known set of dependencies and other properties
which are specified in the runtime catalog.
[cols="2,2a",options="header"]
@@ -1413,7 +1413,28 @@ which are specified in the runtime catalog.
|
+List of required Maven dependencies
+|`runtimeProperties` +
+map[string]string
+|
+
+
+Set of required Camel runtime properties
+
+|`buildTimeProperties` +
+map[string]string
+|
+
+
+Set of required Camel build time properties
+
+|`metadata` +
+map[string]string
+|
+
+
+Set of generic metadata
|===
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index ae2925cd2..77a9016f7 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -638,10 +638,17 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which
- requires a well known set of dependencies which
- are specified in the runtime catalog.
+ requires a well known set of dependencies and other
+ properties which are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time
+ properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -666,8 +673,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object
@@ -1453,10 +1468,17 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which
- requires a well known set of dependencies which
- are specified in the runtime catalog.
+ requires a well known set of dependencies and other
+ properties which are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time
+ properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -1481,8 +1503,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object
diff --git a/helm/camel-k/crds/crd-camel-catalog.yaml b/helm/camel-k/crds/crd-camel-catalog.yaml
index 4f75f02b6..99458fd96 100644
--- a/helm/camel-k/crds/crd-camel-catalog.yaml
+++ b/helm/camel-k/crds/crd-camel-catalog.yaml
@@ -372,10 +372,16 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which requires
- a well known set of dependencies which are specified in the
- runtime catalog.
+ a well known set of dependencies and other properties which
+ are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -400,8 +406,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index 93e81a213..5aef1596d 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -342,10 +342,17 @@ type RuntimeSpec struct {
Capabilities map[string]Capability `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
}
-// Capability is a particular feature which requires a well known set of dependencies
+// Capability is a particular feature which requires a well known set of dependencies and other properties
// which are specified in the runtime catalog.
type Capability struct {
- Dependencies []MavenArtifact `json:"dependencies" yaml:"dependencies"`
+ // List of required Maven dependencies
+ Dependencies []MavenArtifact `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
+ // Set of required Camel runtime properties
+ RuntimeProperties map[string]string `json:"runtimeProperties,omitempty" yaml:"runtimeProperties,omitempty"`
+ // Set of required Camel build time properties
+ BuildTimeProperties map[string]string `json:"buildTimeProperties,omitempty" yaml:"buildTimeProperties,omitempty"`
+ // Set of generic metadata
+ Metadata map[string]string `json:"metadata,omitempty" yaml:"Metadata,omitempty"`
}
const (
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 6ca63f75f..8ffebb03f 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -610,6 +610,27 @@ func (in *Capability) DeepCopyInto(out *Capability) {
*out = make([]MavenArtifact, len(*in))
copy(*out, *in)
}
+ if in.RuntimeProperties != nil {
+ in, out := &in.RuntimeProperties, &out.RuntimeProperties
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
+ if in.BuildTimeProperties != nil {
+ in, out := &in.BuildTimeProperties, &out.BuildTimeProperties
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
+ if in.Metadata != nil {
+ in, out := &in.Metadata, &out.Metadata
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Capability.
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/capability.go b/pkg/client/camel/applyconfiguration/camel/v1/capability.go
index 7d49027fa..d6d3073b2 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/capability.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/capability.go
@@ -22,7 +22,10 @@ package v1
// CapabilityApplyConfiguration represents an declarative configuration of the Capability type for use
// with apply.
type CapabilityApplyConfiguration struct {
- Dependencies []MavenArtifactApplyConfiguration `json:"dependencies,omitempty"`
+ Dependencies []MavenArtifactApplyConfiguration `json:"dependencies,omitempty"`
+ RuntimeProperties map[string]string `json:"runtimeProperties,omitempty"`
+ BuildTimeProperties map[string]string `json:"buildTimeProperties,omitempty"`
+ Metadata map[string]string `json:"metadata,omitempty"`
}
// CapabilityApplyConfiguration constructs an declarative configuration of the Capability type for use with
@@ -43,3 +46,45 @@ func (b *CapabilityApplyConfiguration) WithDependencies(values ...*MavenArtifact
}
return b
}
+
+// WithRuntimeProperties puts the entries into the RuntimeProperties field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the RuntimeProperties field,
+// overwriting an existing map entries in RuntimeProperties field with the same key.
+func (b *CapabilityApplyConfiguration) WithRuntimeProperties(entries map[string]string) *CapabilityApplyConfiguration {
+ if b.RuntimeProperties == nil && len(entries) > 0 {
+ b.RuntimeProperties = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.RuntimeProperties[k] = v
+ }
+ return b
+}
+
+// WithBuildTimeProperties puts the entries into the BuildTimeProperties field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the BuildTimeProperties field,
+// overwriting an existing map entries in BuildTimeProperties field with the same key.
+func (b *CapabilityApplyConfiguration) WithBuildTimeProperties(entries map[string]string) *CapabilityApplyConfiguration {
+ if b.BuildTimeProperties == nil && len(entries) > 0 {
+ b.BuildTimeProperties = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.BuildTimeProperties[k] = v
+ }
+ return b
+}
+
+// WithMetadata puts the entries into the Metadata field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the Metadata field,
+// overwriting an existing map entries in Metadata field with the same key.
+func (b *CapabilityApplyConfiguration) WithMetadata(entries map[string]string) *CapabilityApplyConfiguration {
+ if b.Metadata == nil && len(entries) > 0 {
+ b.Metadata = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.Metadata[k] = v
+ }
+ 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 ae2925cd2..77a9016f7 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_builds.yaml
@@ -638,10 +638,17 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which
- requires a well known set of dependencies which
- are specified in the runtime catalog.
+ requires a well known set of dependencies and other
+ properties which are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time
+ properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -666,8 +673,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object
@@ -1453,10 +1468,17 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which
- requires a well known set of dependencies which
- are specified in the runtime catalog.
+ requires a well known set of dependencies and other
+ properties which are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time
+ properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -1481,8 +1503,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_camelcatalogs.yaml b/pkg/resources/config/crd/bases/camel.apache.org_camelcatalogs.yaml
index 4f75f02b6..99458fd96 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_camelcatalogs.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_camelcatalogs.yaml
@@ -372,10 +372,16 @@ spec:
capabilities:
additionalProperties:
description: Capability is a particular feature which requires
- a well known set of dependencies which are specified in the
- runtime catalog.
+ a well known set of dependencies and other properties which
+ are specified in the runtime catalog.
properties:
+ buildTimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel build time properties
+ type: object
dependencies:
+ description: List of required Maven dependencies
items:
description: MavenArtifact defines a GAV (Group:Artifact:Type:Version:Classifier)
Maven artifact.
@@ -400,8 +406,16 @@ spec:
- groupId
type: object
type: array
- required:
- - dependencies
+ metadata:
+ additionalProperties:
+ type: string
+ description: Set of generic metadata
+ type: object
+ runtimeProperties:
+ additionalProperties:
+ type: string
+ description: Set of required Camel runtime properties
+ type: object
type: object
description: features offered by this runtime
type: object