Skip to content

Commit

Permalink
feat(trait): mount kamelets for runtime
Browse files Browse the repository at this point in the history
* Add a configmap as a bundle for all kamelets used by the Integration
* Mount the bundle in /etc/camel/kamelets
* Let the runtime use the Kamelets instead of trasforming into RouteTemplates
* Let the operator use the Kamelet template for capability parsing

Closes apache#4618
  • Loading branch information
squakez committed Oct 13, 2023
1 parent f2de7ff commit 2993aef
Show file tree
Hide file tree
Showing 26 changed files with 251 additions and 88 deletions.
8 changes: 8 additions & 0 deletions config/crd/bases/camel.apache.org_builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,10 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a
Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers
the org.apache.camel.k.RoutesLoader uses to pre/post
Expand Down Expand Up @@ -1424,6 +1428,10 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a
Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers
the org.apache.camel.k.RoutesLoader uses to pre/post
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/camel.apache.org_integrationkits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/camel.apache.org_integrationplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down Expand Up @@ -3024,6 +3028,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/camel.apache.org_integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7115,6 +7118,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down Expand Up @@ -7928,6 +7935,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/camel.apache.org_kameletbindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7401,6 +7404,10 @@ spec:
description: Comma separated list of Kamelet names to
load into the current integration
type: string
mountPoint:
description: The directory where the application mounts
and reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/camel.apache.org_kamelets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -1163,6 +1166,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/camel.apache.org_pipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7399,6 +7402,10 @@ spec:
description: Comma separated list of Kamelet names to
load into the current integration
type: string
mountPoint:
description: The directory where the application mounts
and reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
14 changes: 14 additions & 0 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5064,6 +5064,13 @@ Type defines the kind of source described by this object
List of property names defined in the source (e.g. if type is "template")
|`from-kamelet` +
bool
|
True if the spec is generated from a Kamelet
|===
Expand Down Expand Up @@ -6930,6 +6937,13 @@ string
Comma separated list of Kamelet names to load into the current integration
|`mountPoint` +
string
|
The directory where the application mounts and reads Kamelet spec (default `/etc/camel/kamelets`)
|===
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/traits/pages/kamelets.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ The following configuration options are available:
| string
| Comma separated list of Kamelet names to load into the current integration

| kamelets.mount-point
| string
| The directory where the application mounts and reads Kamelet spec (default `/etc/camel/kamelets`)

|===

// End of autogenerated code - DO NOT EDIT! (configuration)
8 changes: 8 additions & 0 deletions helm/camel-k/crds/crd-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,10 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a
Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers
the org.apache.camel.k.RoutesLoader uses to pre/post
Expand Down Expand Up @@ -1424,6 +1428,10 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a
Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers
the org.apache.camel.k.RoutesLoader uses to pre/post
Expand Down
3 changes: 3 additions & 0 deletions helm/camel-k/crds/crd-integration-kit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
8 changes: 8 additions & 0 deletions helm/camel-k/crds/crd-integration-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down Expand Up @@ -3024,6 +3028,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
10 changes: 10 additions & 0 deletions helm/camel-k/crds/crd-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7115,6 +7118,10 @@ spec:
description: Comma separated list of Kamelet names to load
into the current integration
type: string
mountPoint:
description: The directory where the application mounts and
reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down Expand Up @@ -7928,6 +7935,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
7 changes: 7 additions & 0 deletions helm/camel-k/crds/crd-kamelet-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7401,6 +7404,10 @@ spec:
description: Comma separated list of Kamelet names to
load into the current integration
type: string
mountPoint:
description: The directory where the application mounts
and reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
6 changes: 6 additions & 0 deletions helm/camel-k/crds/crd-kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -1163,6 +1166,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down
7 changes: 7 additions & 0 deletions helm/camel-k/crds/crd-pipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ spec:
contentType:
description: the content type (tipically text or binary)
type: string
from-kamelet:
description: True if the spec is generated from a Kamelet
type: boolean
interceptors:
description: Interceptors are optional identifiers the org.apache.camel.k.RoutesLoader
uses to pre/post process sources
Expand Down Expand Up @@ -7399,6 +7402,10 @@ spec:
description: Comma separated list of Kamelet names to
load into the current integration
type: string
mountPoint:
description: The directory where the application mounts
and reads Kamelet spec (default `/etc/camel/kamelets`)
type: string
type: object
keda:
description: 'Deprecated: for backward compatibility.'
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/camel/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ type SourceSpec struct {
Type SourceType `json:"type,omitempty"`
// List of property names defined in the source (e.g. if type is "template")
PropertyNames []string `json:"property-names,omitempty"`
// True if the spec is generated from a Kamelet
FromKamelet bool `json:"from-kamelet,omitempty"`
}

// SourceType represents an available source type.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/camel/v1/common_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,8 @@ func DecodeValueSource(input string, defaultKey string, errorMessage string) (Va

return ValueSource{}, fmt.Errorf(errorMessage)
}

// IsGeneratedFromKamelet determines is a source spec is derived from a Kamelet
func (s *SourceSpec) IsGeneratedFromKamelet() bool {
return s.FromKamelet
}
2 changes: 2 additions & 0 deletions pkg/apis/camel/v1/trait/kamelets.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ type KameletsTrait struct {
Auto *bool `property:"auto" json:"auto,omitempty"`
// Comma separated list of Kamelet names to load into the current integration
List string `property:"list" json:"list,omitempty"`
// The directory where the application mounts and reads Kamelet spec (default `/etc/camel/kamelets`)
MountPoint string `property:"mount-point" json:"mountPoint,omitempty"`
}
9 changes: 9 additions & 0 deletions pkg/client/camel/applyconfiguration/camel/v1/sourcespec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/trait/camel.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func (t *camelTrait) computeConfigMaps(e *Environment) []ctrl.Object {
Labels: map[string]string{
v1.IntegrationLabel: e.Integration.Name,
"camel.apache.org/properties.type": "user",
kubernetes.ConfigMapTypeLabel: "camel-properties",
},
},
Data: map[string]string{
Expand Down
Loading

0 comments on commit 2993aef

Please sign in to comment.