diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 34941e31bb..ac739495aa 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -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] diff --git a/docs/modules/ROOT/pages/configuration/integrationprofiles.adoc b/docs/modules/ROOT/pages/configuration/integrationprofiles.adoc new file mode 100644 index 0000000000..85d6304988 --- /dev/null +++ b/docs/modules/ROOT/pages/configuration/integrationprofiles.adoc @@ -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. diff --git a/docs/modules/ROOT/pages/installation/advanced/multi.adoc b/docs/modules/ROOT/pages/installation/advanced/multi.adoc index 13eeac70cc..0ca1b7a8b5 100644 --- a/docs/modules/ROOT/pages/installation/advanced/multi.adoc +++ b/docs/modules/ROOT/pages/installation/advanced/multi.adoc @@ -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. diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 0b2c1f4c49..ed08e799a5 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -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"] @@ -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"] |=== @@ -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. |=== @@ -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"] |=== @@ -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"] |=== diff --git a/helm/camel-k/crds/camel-k-crds.yaml b/helm/camel-k/crds/camel-k-crds.yaml index e3d28d264c..1d1c28c75c 100644 --- a/helm/camel-k/crds/camel-k-crds.yaml +++ b/helm/camel-k/crds/camel-k-crds.yaml @@ -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: |- @@ -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 @@ -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 diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go index 8bc6a73ba1..da4ccd4cb9 100644 --- a/pkg/apis/camel/v1/common_types.go +++ b/pkg/apis/camel/v1/common_types.go @@ -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" diff --git a/pkg/apis/camel/v1/common_types_support.go b/pkg/apis/camel/v1/common_types_support.go index 1126a4f06e..cd8680831b 100644 --- a/pkg/apis/camel/v1/common_types_support.go +++ b/pkg/apis/camel/v1/common_types_support.go @@ -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) } diff --git a/pkg/apis/camel/v1/integration_types.go b/pkg/apis/camel/v1/integration_types.go index 4fb96bbc3d..e22b5e7019 100644 --- a/pkg/apis/camel/v1/integration_types.go +++ b/pkg/apis/camel/v1/integration_types.go @@ -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"` diff --git a/pkg/apis/camel/v1/integrationprofile_types.go b/pkg/apis/camel/v1/integrationprofile_types.go index 9f6ff39057..29578afcb9 100644 --- a/pkg/apis/camel/v1/integrationprofile_types.go +++ b/pkg/apis/camel/v1/integrationprofile_types.go @@ -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"` } @@ -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. @@ -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"` diff --git a/pkg/client/camel/applyconfiguration/camel/v1/integrationplatformkameletspec.go b/pkg/client/camel/applyconfiguration/camel/v1/integrationplatformkameletspec.go index 3c07c70752..8d5629ba20 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1/integrationplatformkameletspec.go +++ b/pkg/client/camel/applyconfiguration/camel/v1/integrationplatformkameletspec.go @@ -23,7 +23,6 @@ package v1 // with apply. // // IntegrationPlatformKameletSpec define the behavior for all the Kamelets controller by the IntegrationPlatform. -// // Deprecated: to be removed in future versions. type IntegrationPlatformKameletSpecApplyConfiguration struct { // remote repository used to retrieve Kamelet catalog diff --git a/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilekameletspec.go b/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilekameletspec.go index 6fda1ca186..5d1a19b840 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilekameletspec.go +++ b/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilekameletspec.go @@ -23,6 +23,7 @@ package v1 // with apply. // // IntegrationProfileKameletSpec define the behavior for all the Kamelets controller by the IntegrationProfile. +// Deprecated: to be removed in future versions. type IntegrationProfileKameletSpecApplyConfiguration struct { // remote repository used to retrieve Kamelet catalog Repositories []KameletRepositorySpecApplyConfiguration `json:"repositories,omitempty"` diff --git a/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilespec.go b/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilespec.go index f8cfaeac77..aaa37373f8 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilespec.go +++ b/pkg/client/camel/applyconfiguration/camel/v1/integrationprofilespec.go @@ -31,6 +31,7 @@ type IntegrationProfileSpecApplyConfiguration struct { // list of traits to be executed for all the Integration/IntegrationKits built from this IntegrationProfile Traits *TraitsApplyConfiguration `json:"traits,omitempty"` // configuration to be executed to all Kamelets controlled by this IntegrationProfile + // Deprecated: to be removed in future versions. Kamelet *IntegrationProfileKameletSpecApplyConfiguration `json:"kamelet,omitempty"` } diff --git a/pkg/client/camel/applyconfiguration/camel/v1/podspec.go b/pkg/client/camel/applyconfiguration/camel/v1/podspec.go index 9f7d9a8b99..9a5b5f4033 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1/podspec.go +++ b/pkg/client/camel/applyconfiguration/camel/v1/podspec.go @@ -27,6 +27,7 @@ import ( // with apply. // // PodSpec defines a group of Kubernetes resources. +// Deprecated: to be removed in future versions. type PodSpecApplyConfiguration struct { // AutomountServiceAccountToken AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty"` diff --git a/pkg/client/camel/applyconfiguration/camel/v1/podspectemplate.go b/pkg/client/camel/applyconfiguration/camel/v1/podspectemplate.go index 2a2eb69355..04247eb14f 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1/podspectemplate.go +++ b/pkg/client/camel/applyconfiguration/camel/v1/podspectemplate.go @@ -23,6 +23,7 @@ package v1 // with apply. // // PodSpecTemplate represent a template used to deploy an Integration `Pod`. +// Deprecated: to be removed in future versions. type PodSpecTemplateApplyConfiguration struct { // the specification Spec *PodSpecApplyConfiguration `json:"spec,omitempty"` diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 862922c70d..fef8bd80a9 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -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 { diff --git a/pkg/controller/integration/monitor.go b/pkg/controller/integration/monitor.go index 890c66cb30..657196435c 100644 --- a/pkg/controller/integration/monitor.go +++ b/pkg/controller/integration/monitor.go @@ -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 diff --git a/pkg/controller/integrationkit/build.go b/pkg/controller/integrationkit/build.go index 4bbea60b5c..5f120931b8 100644 --- a/pkg/controller/integrationkit/build.go +++ b/pkg/controller/integrationkit/build.go @@ -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 } diff --git a/pkg/controller/pipe/monitor.go b/pkg/controller/pipe/monitor.go index f75e5af7df..6ce401b97f 100644 --- a/pkg/controller/pipe/monitor.go +++ b/pkg/controller/pipe/monitor.go @@ -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)) diff --git a/pkg/platform/operator.go b/pkg/platform/operator.go index d6482e50a7..3958c61284 100644 --- a/pkg/platform/operator.go +++ b/pkg/platform/operator.go @@ -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 diff --git a/pkg/platform/profile.go b/pkg/platform/profile.go index 8e028d2eb8..e5e6763ed6 100644 --- a/pkg/platform/profile.go +++ b/pkg/platform/profile.go @@ -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() diff --git a/pkg/platform/profile_test.go b/pkg/platform/profile_test.go index 238b2b4373..15a8a03e3c 100644 --- a/pkg/platform/profile_test.go +++ b/pkg/platform/profile_test.go @@ -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", }, }, diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml index 5b4e024143..425b16dad8 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml @@ -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: |- @@ -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 @@ -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 diff --git a/pkg/trait/pod.go b/pkg/trait/pod.go index 3b8ba94004..b88dc626e3 100644 --- a/pkg/trait/pod.go +++ b/pkg/trait/pod.go @@ -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 { diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go index 080e5e5d44..c5873ab2fb 100644 --- a/pkg/trait/quarkus.go +++ b/pkg/trait/quarkus.go @@ -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 { diff --git a/pkg/util/digest/digest.go b/pkg/util/digest/digest.go index 564e064029..c02c115a7d 100644 --- a/pkg/util/digest/digest.go +++ b/pkg/util/digest/digest.go @@ -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 }