Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
** xref:configuration/runtime-config.adoc[Runtime configuration]
** xref:configuration/runtime-resources.adoc[Runtime resources]
** xref:configuration/runtime-version.adoc[Camel version]
** xref:configuration/integrationprofiles.adoc[Profiles]
* xref:traits:traits.adoc[Traits]
// Start of autogenerated code - DO NOT EDIT! (trait-nav)
** xref:traits:affinity.adoc[Affinity]
Expand Down
42 changes: 42 additions & 0 deletions docs/modules/ROOT/pages/configuration/integrationprofiles.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
= Integration Profiles

Any running Camel K Integration is associated to a shared IntegrationPlatform resource that contains general configuration options.
The integration platform is located in the operator namespace and typically uses the same name as the operator id that this platform belongs to.

Users may add an IntegrationProfile resource to any namespace. The profile holds custom settings which can be applied to all Integrations.

The profile must be explicitly selected by an annotation referencing the integration profile name (any resource belonging to the "camel.apache.org" group can select a particular profile configuration).

To specify which profile should be used for an Integration, the resource can be annotated like in the following example:

[source,yaml]
----
kind: Integration
apiVersion: camel.apache.org/v1
metadata:
annotations:
camel.apache.org/integration-profile.id: my-profile
# ...
----

The value of the `camel.apache.org/integration-profile.id` annotation must match the name of an IntegrationProfile custom resource which is available in the same namespace of the Integration. Here an example of a profile:

[source,yaml]
----
kind: IntegrationProfile
apiVersion: camel.apache.org/v1
metadata:
name: my-profile
spec:
traits:
camel:
runtimeProvider: plain-quarkus
runtimeVersion: 3.30.8
owner:
targetLabels:
- camel.apache.org/app
...
# ...
----

The selection of a IntegrationProfile enables new configuration scenarios, for example, sharing global configuration options for groups of Integrations. The main configuration expected here is related to traits.
35 changes: 0 additions & 35 deletions docs/modules/ROOT/pages/installation/advanced/multi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,3 @@ In order to install more than one operator globally, you may need to change the
```
cd /install/base/config/rbac/descoped && kustomize edit set namesuffix -- -$OPERATOR_ID
```

[[advanced-installation-integration-profile]]
== Apply custom IntegrationProfile settings

Any running Camel K integration is associated to a shared IntegrationPlatform resource that contains general configuration options.
The integration platform is located in the operator namespace and typically uses the same name as the operator id that this platform belongs to.
Each Camel K operator uses exactly one single integration platform in a "Ready" state.
IntegrationPlatform resources are somewhat "singleton" in a namespace and belong to a single operator instance.

There's a way to allow customizations regarding the integration configuration.
Users may add IntegrationProfile resources to an individual namespace.
The profile holds custom integration platform settings for them to be used by integrations.
The IntegrationProfile resource allows only a subset of the IntegrationPlatform settings for customization.

The custom IntegrationProfile resource uses the operator id as an annotation to bind its reconciliation to an operator instance.
Also, the profile must be explicitly selected by an annotation referencing the integration profile name (any resource belonging to the "camel.apache.org" group can select a particular profile configuration).

To specify which profile should be used for an integration, the resource can be annotated like in the following example:

[source,yaml]
----
kind: Integration
apiVersion: camel.apache.org/v1
metadata:
annotations:
camel.apache.org/integration-profile.id: my-profile-name
# ...
----

The value of the `camel.apache.org/integration-profile.id` annotation must match the name of an IntegrationProfile custom resource.
The profile gets automatically resolved from the annotated resource namespace or from the operator namespace.
In case you need to explicitly set the integration profile namespace you can do so with the `camel.apache.org/integration-profile.namespace` annotation.

The selection of a IntegrationProfile enables new configuration scenarios, for example, sharing global configuration options for groups of integrations, or also
providing per-operator specific configuration options e.g. when you install multiple global operators in the cluster.
5 changes: 4 additions & 1 deletion docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,6 @@ IntegrationPlatformConditionType defines the type of condition.
* <<#_camel_apache_org_v1_IntegrationPlatformSpec, IntegrationPlatformSpec>>

IntegrationPlatformKameletSpec define the behavior for all the Kamelets controller by the IntegrationPlatform.

Deprecated: to be removed in future versions.

[cols="2,2a",options="header"]
Expand Down Expand Up @@ -3345,6 +3344,7 @@ IntegrationProfileConditionType defines the type of condition.
* <<#_camel_apache_org_v1_IntegrationProfileSpec, IntegrationProfileSpec>>

IntegrationProfileKameletSpec define the behavior for all the Kamelets controller by the IntegrationProfile.
Deprecated: to be removed in future versions.

[cols="2,2a",options="header"]
|===
Expand Down Expand Up @@ -3406,6 +3406,7 @@ list of traits to be executed for all the Integration/IntegrationKits built from


configuration to be executed to all Kamelets controlled by this IntegrationProfile
Deprecated: to be removed in future versions.


|===
Expand Down Expand Up @@ -5122,6 +5123,7 @@ string
* <<#_camel_apache_org_v1_PodSpecTemplate, PodSpecTemplate>>

PodSpec defines a group of Kubernetes resources.
Deprecated: to be removed in future versions.

[cols="2,2a",options="header"]
|===
Expand Down Expand Up @@ -5223,6 +5225,7 @@ PodSecurityContext
* <<#_camel_apache_org_v1_IntegrationSpec, IntegrationSpec>>

PodSpecTemplate represent a template used to deploy an Integration `Pod`.
Deprecated: to be removed in future versions.

[cols="2,2a",options="header"]
|===
Expand Down
21 changes: 7 additions & 14 deletions helm/camel-k/crds/camel-k-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8356,16 +8356,7 @@ spec:
singular: integrationprofile
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The integration profile phase
jsonPath: .status.phase
name: Phase
type: string
- description: The default runtime version
jsonPath: .status.build.runtimeVersion
name: Default runtime
type: string
name: v1
- name: v1
schema:
openAPIV3Schema:
description: |-
Expand Down Expand Up @@ -8680,8 +8671,9 @@ spec:
type: string
type: object
kamelet:
description: configuration to be executed to all Kamelets controlled
by this IntegrationProfile
description: |-
configuration to be executed to all Kamelets controlled by this IntegrationProfile
Deprecated: to be removed in future versions.
properties:
repositories:
description: remote repository used to retrieve Kamelet catalog
Expand Down Expand Up @@ -11050,8 +11042,9 @@ spec:
type: object
type: array
kamelet:
description: configuration to be executed to all Kamelets controlled
by this IntegrationProfile
description: |-
configuration to be executed to all Kamelets controlled by this IntegrationProfile
Deprecated: to be removed in future versions.
properties:
repositories:
description: remote repository used to retrieve Kamelet catalog
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 @@ -35,6 +35,8 @@ const (
// IntegrationProfileAnnotation integration profile id annotation label.
IntegrationProfileAnnotation = "camel.apache.org/integration-profile.id"
// IntegrationProfileNamespaceAnnotation integration profile id annotation label.
//
// Deprecated: won't be supported in future releases.
IntegrationProfileNamespaceAnnotation = "camel.apache.org/integration-profile.namespace"
// IntegrationDontRunAfterBuildAnnotation -- .
IntegrationDontRunAfterBuildAnnotation = "camel.apache.org/dont-run-after-build"
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/camel/v1/common_types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ func GetIntegrationProfileAnnotation(obj metav1.Object) string {
}

// GetIntegrationProfileNamespaceAnnotation to safely get the integration profile namespace annotation value.
//
// Deprecated: won't be supported in future releases.
func GetIntegrationProfileNamespaceAnnotation(obj metav1.Object) string {
return GetAnnotation(IntegrationProfileNamespaceAnnotation, obj)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/camel/v1/integration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,16 @@ type IntegrationCondition struct {
}

// PodSpecTemplate represent a template used to deploy an Integration `Pod`.
//
// Deprecated: to be removed in future versions.
type PodSpecTemplate struct {
// the specification
Spec PodSpec `json:"spec,omitempty"`
}

// PodSpec defines a group of Kubernetes resources.
//
// Deprecated: to be removed in future versions.
type PodSpec struct {
// AutomountServiceAccountToken
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" protobuf:"varint,21,opt,name=automountServiceAccountToken"`
Expand Down
6 changes: 4 additions & 2 deletions pkg/apis/camel/v1/integrationprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type IntegrationProfileSpec struct {
// list of traits to be executed for all the Integration/IntegrationKits built from this IntegrationProfile
Traits Traits `json:"traits,omitempty"`
// configuration to be executed to all Kamelets controlled by this IntegrationProfile
//
// Deprecated: to be removed in future versions.
Kamelet IntegrationProfileKameletSpec `json:"kamelet,omitempty"`
}

Expand All @@ -52,8 +54,6 @@ type IntegrationProfileStatus struct {
// +kubebuilder:resource:path=integrationprofiles,scope=Namespaced,shortName=ipr,categories=kamel;camel
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="The integration profile phase"
// +kubebuilder:printcolumn:name="Default runtime",type=string,JSONPath=`.status.build.runtimeVersion`,description="The default runtime version"

// IntegrationProfile is the resource used to apply user defined settings to the Camel K operator behavior.
// It defines the behavior of all Custom Resources (`IntegrationKit`, `Integration`, `Kamelet`) in the given namespace.
Expand Down Expand Up @@ -95,6 +95,8 @@ type IntegrationProfileBuildSpec struct {
}

// IntegrationProfileKameletSpec define the behavior for all the Kamelets controller by the IntegrationProfile.
//
// Deprecated: to be removed in future versions.
type IntegrationProfileKameletSpec struct {
// remote repository used to retrieve Kamelet catalog
Repositories []KameletRepositorySpec `json:"repositories,omitempty"`
Expand Down

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

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

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

1 change: 1 addition & 0 deletions pkg/client/camel/applyconfiguration/camel/v1/podspec.go

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

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

1 change: 1 addition & 0 deletions pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ func (o *runCmdOptions) applyAnnotations(it *v1.Integration) {
if o.IntegrationProfile != "" {
if strings.Contains(o.IntegrationProfile, "/") {
namespacedName := strings.SplitN(o.IntegrationProfile, "/", 2)
//nolint:staticcheck
v1.SetAnnotation(&it.ObjectMeta, v1.IntegrationProfileNamespaceAnnotation, namespacedName[0])
v1.SetAnnotation(&it.ObjectMeta, v1.IntegrationProfileAnnotation, namespacedName[1])
} else {
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/integration/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ func isIntegrationKitResetRequired(integration *v1.Integration, kit *v1.Integrat
return true
}

//nolint:staticcheck
if v1.GetIntegrationProfileNamespaceAnnotation(integration) != "" &&
//nolint:staticcheck
v1.GetIntegrationProfileNamespaceAnnotation(integration) != v1.GetIntegrationProfileNamespaceAnnotation(kit) {
// Integration profile namespace for the integration has changed. Reset integration kit
// so new profile can be applied
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/integrationkit/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (action *buildAction) createBuild(ctx context.Context, kit *v1.IntegrationK
if v, ok := kit.Annotations[v1.IntegrationProfileAnnotation]; ok {
annotations[v1.IntegrationProfileAnnotation] = v

//nolint:staticcheck
if v, ok := kit.Annotations[v1.IntegrationProfileNamespaceAnnotation]; ok {
annotations[v1.IntegrationProfileNamespaceAnnotation] = v
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/pipe/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (action *monitorAction) Handle(ctx context.Context, pipe *v1.Pipe) (*v1.Pip
integrationProfileChanged := v1.GetIntegrationProfileAnnotation(pipe) != "" &&
(v1.GetIntegrationProfileAnnotation(pipe) != v1.GetIntegrationProfileAnnotation(&it))

//nolint:staticcheck
integrationProfileNamespaceChanged := v1.GetIntegrationProfileNamespaceAnnotation(pipe) != "" &&
(v1.GetIntegrationProfileNamespaceAnnotation(pipe) != v1.GetIntegrationProfileNamespaceAnnotation(&it))

Expand Down
1 change: 1 addition & 0 deletions pkg/platform/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func (f FilteringFuncs[T]) Update(e event.TypedUpdateEvent[T]) bool {
// Always force reconciliation when the object gets attached to a new integration profile
return true
}
//nolint:staticcheck
if camelv1.GetIntegrationProfileNamespaceAnnotation(e.ObjectOld) != camelv1.GetIntegrationProfileNamespaceAnnotation(e.ObjectNew) {
// Always force reconciliation when the object gets attached to a new integration profile
return true
Expand Down
1 change: 1 addition & 0 deletions pkg/platform/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func ApplyIntegrationProfile(ctx context.Context, c k8sclient.Reader, o k8sclien
// findIntegrationProfile finds profile from given resource annotations and resolves the profile in given resource namespace or operator namespace as a fallback option.
func findIntegrationProfile(ctx context.Context, c k8sclient.Reader, o k8sclient.Object) (*v1.IntegrationProfile, error) {
if profileName := v1.GetIntegrationProfileAnnotation(o); profileName != "" {
//nolint:staticcheck
namespace := v1.GetIntegrationProfileNamespaceAnnotation(o)
if namespace == "" {
namespace = o.GetNamespace()
Expand Down
3 changes: 2 additions & 1 deletion pkg/platform/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ func TestFindIntegrationProfileWithNamespace(t *testing.T) {
Name: "test",
Namespace: "ns",
Annotations: map[string]string{
v1.IntegrationProfileAnnotation: "custom",
v1.IntegrationProfileAnnotation: "custom",
//nolint:staticcheck
v1.IntegrationProfileNamespaceAnnotation: "other",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,7 @@ spec:
singular: integrationprofile
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The integration profile phase
jsonPath: .status.phase
name: Phase
type: string
- description: The default runtime version
jsonPath: .status.build.runtimeVersion
name: Default runtime
type: string
name: v1
- name: v1
schema:
openAPIV3Schema:
description: |-
Expand Down Expand Up @@ -360,8 +351,9 @@ spec:
type: string
type: object
kamelet:
description: configuration to be executed to all Kamelets controlled
by this IntegrationProfile
description: |-
configuration to be executed to all Kamelets controlled by this IntegrationProfile
Deprecated: to be removed in future versions.
properties:
repositories:
description: remote repository used to retrieve Kamelet catalog
Expand Down Expand Up @@ -2730,8 +2722,9 @@ spec:
type: object
type: array
kamelet:
description: configuration to be executed to all Kamelets controlled
by this IntegrationProfile
description: |-
configuration to be executed to all Kamelets controlled by this IntegrationProfile
Deprecated: to be removed in future versions.
properties:
repositories:
description: remote repository used to retrieve Kamelet catalog
Expand Down
1 change: 1 addition & 0 deletions pkg/trait/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (t *podTrait) Apply(e *Environment) error {
return nil
}

//nolint:staticcheck
func (t *podTrait) applyChangesTo(podSpec *corev1.PodSpec, changes v1.PodSpec) (*corev1.PodSpec, error) {
patch, err := json.Marshal(changes)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/trait/quarkus.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment, packageType quarkusPack
if v, ok := integration.Annotations[v1.IntegrationProfileAnnotation]; ok {
v1.SetAnnotation(&kit.ObjectMeta, v1.IntegrationProfileAnnotation, v)

//nolint:staticcheck
if v, ok := e.Integration.Annotations[v1.IntegrationProfileNamespaceAnnotation]; ok {
v1.SetAnnotation(&kit.ObjectMeta, v1.IntegrationProfileNamespaceAnnotation, v)
} else {
Expand Down
1 change: 1 addition & 0 deletions pkg/util/digest/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func ComputeForIntegration(integration *v1.Integration, configmapVersions []stri
if _, err := hash.Write([]byte(v1.GetIntegrationProfileAnnotation(integration))); err != nil {
return "", err
}
//nolint:staticcheck
if _, err := hash.Write([]byte(v1.GetIntegrationProfileNamespaceAnnotation(integration))); err != nil {
return "", err
}
Expand Down
Loading