This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch release-2.3.x in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit b895cfc9020c28c3cf8f62f1a8ca99fcd4b3cf14 Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Mon Apr 22 17:14:25 2024 +0200 fix(trait): synthetic Kit While working on #5378 I realized the concept of external Kit is used widely also for the concept of what is a Synthetic Kit. An external Kit is a kit coming from a build from the operator, whilst a synthetic Kit is not coming from an operator. --- docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 9 +++++++-- docs/modules/traits/pages/container.adoc | 4 ++++ docs/modules/traits/pages/jvm.adoc | 2 -- e2e/advanced/operator_id_filtering_test.go | 2 +- e2e/install/cli/global_test.go | 2 +- helm/camel-k/crds/crd-integration-platform.yaml | 8 ++++++++ helm/camel-k/crds/crd-integration-profile.yaml | 8 ++++++++ helm/camel-k/crds/crd-integration.yaml | 4 ++++ helm/camel-k/crds/crd-kamelet-binding.yaml | 4 ++++ helm/camel-k/crds/crd-pipe.yaml | 4 ++++ pkg/apis/camel/v1/integrationkit_types.go | 8 +++++--- pkg/apis/camel/v1/integrationkit_types_support.go | 5 +++++ pkg/apis/camel/v1/trait/container.go | 2 ++ pkg/apis/camel/v1/trait/jvm.go | 2 -- pkg/apis/camel/v1/trait/zz_generated.deepcopy.go | 5 +++++ pkg/cmd/promote.go | 16 ++++------------ pkg/cmd/promote_test.go | 18 ++++++------------ .../integrationkit/integrationkit_controller.go | 2 +- .../bases/camel.apache.org_integrationplatforms.yaml | 8 ++++++++ .../bases/camel.apache.org_integrationprofiles.yaml | 8 ++++++++ .../crd/bases/camel.apache.org_integrations.yaml | 4 ++++ .../crd/bases/camel.apache.org_kameletbindings.yaml | 4 ++++ .../config/crd/bases/camel.apache.org_pipes.yaml | 4 ++++ pkg/trait/container.go | 5 ++++- pkg/trait/jvm.go | 8 ++------ pkg/trait/jvm_test.go | 20 +------------------- pkg/trait/trait_condition_types.go | 4 ---- 27 files changed, 104 insertions(+), 66 deletions(-) diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index edb8c1408..f8586842d 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -6523,6 +6523,13 @@ string The main container image +|`imageWasKit` + +bool +| + + +A flag to mark the image used is coming from an IntegrationKit created externally. + |`imagePullPolicy` + *https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#pullpolicy-v1-core[Kubernetes core/v1.PullPolicy]* | @@ -7195,8 +7202,6 @@ The JVM trait is used to configure the JVM that runs the Integration. This trait (bound to a container image) built by Camel K operator. If the system detects the usage of a different container image (ie, built externally), then, the trait is disabled by the platform. -WARNING: you can still enable the trait explicitly even when it is disabled by the platform but you should be aware that some configurations could fail. - [cols="2,2a",options="header"] |=== diff --git a/docs/modules/traits/pages/container.adoc b/docs/modules/traits/pages/container.adoc index 65925bc46..3be9861b6 100755 --- a/docs/modules/traits/pages/container.adoc +++ b/docs/modules/traits/pages/container.adoc @@ -77,6 +77,10 @@ The following configuration options are available: | string | The main container image +| container.image-was-kit +| bool +| A flag to mark the image used is coming from an IntegrationKit created externally. + | container.image-pull-policy | PullPolicy | The pull policy: Always\|Never\|IfNotPresent diff --git a/docs/modules/traits/pages/jvm.adoc b/docs/modules/traits/pages/jvm.adoc index 5a2cc1540..376461004 100755 --- a/docs/modules/traits/pages/jvm.adoc +++ b/docs/modules/traits/pages/jvm.adoc @@ -5,8 +5,6 @@ The JVM trait is used to configure the JVM that runs the Integration. This trait (bound to a container image) built by Camel K operator. If the system detects the usage of a different container image (ie, built externally), then, the trait is disabled by the platform. -WARNING: you can still enable the trait explicitly even when it is disabled by the platform but you should be aware that some configurations could fail. - This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**. diff --git a/e2e/advanced/operator_id_filtering_test.go b/e2e/advanced/operator_id_filtering_test.go index 390d010c8..c67e3677f 100644 --- a/e2e/advanced/operator_id_filtering_test.go +++ b/e2e/advanced/operator_id_filtering_test.go @@ -100,7 +100,7 @@ func TestOperatorIDFiltering(t *testing.T) { // Save resources by deleting "moving" integration g.Expect(Kamel(t, ctx, "delete", "moving", "-n", ns).Execute()).To(Succeed()) - g.Expect(KamelRunWithID(t, ctx, "operator-x", ns, "files/yaml.yaml", "--name", "pre-built", "--force", "-t", fmt.Sprintf("container.image=%s", image), "-t", "jvm.enabled=true").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, "operator-x", ns, "files/yaml.yaml", "--name", "pre-built", "--force", "-t", fmt.Sprintf("container.image=%s", image), "-t", "container.image-was-kit=true").Execute()).To(Succeed()) g.Consistently(IntegrationPhase(t, ctx, ns, "pre-built"), 10*time.Second).Should(BeEmpty()) g.Expect(AssignIntegrationToOperator(t, ctx, ns, "pre-built", operator2)).To(Succeed()) g.Eventually(IntegrationPhase(t, ctx, ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning)) diff --git a/e2e/install/cli/global_test.go b/e2e/install/cli/global_test.go index 436c92e63..303ca07b9 100644 --- a/e2e/install/cli/global_test.go +++ b/e2e/install/cli/global_test.go @@ -140,7 +140,7 @@ func TestRunGlobalInstall(t *testing.T) { } g.Expect(TestClient(t).Create(ctx, &externalKit)).Should(BeNil()) - g.Expect(KamelRun(t, ctx, ns5, "files/Java.java", "--name", "ext", "--kit", "external", "-t", "jvm.enabled=true").Execute()).To(Succeed()) + g.Expect(KamelRun(t, ctx, ns5, "files/Java.java", "--name", "ext", "--kit", "external").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, ns5, "ext"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, ctx, ns5, "ext"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) g.Expect(IntegrationKit(t, ctx, ns5, "ext")()).Should(Equal("external")) diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml index 9d04b2ad8..12f95132a 100644 --- a/helm/camel-k/crds/crd-integration-platform.yaml +++ b/helm/camel-k/crds/crd-integration-platform.yaml @@ -701,6 +701,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string @@ -2603,6 +2607,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/helm/camel-k/crds/crd-integration-profile.yaml b/helm/camel-k/crds/crd-integration-profile.yaml index 21e0c9334..c587cc5a6 100644 --- a/helm/camel-k/crds/crd-integration-profile.yaml +++ b/helm/camel-k/crds/crd-integration-profile.yaml @@ -578,6 +578,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string @@ -2363,6 +2367,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/helm/camel-k/crds/crd-integration.yaml b/helm/camel-k/crds/crd-integration.yaml index 48c5885ed..0a4b17f32 100644 --- a/helm/camel-k/crds/crd-integration.yaml +++ b/helm/camel-k/crds/crd-integration.yaml @@ -6597,6 +6597,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/helm/camel-k/crds/crd-kamelet-binding.yaml b/helm/camel-k/crds/crd-kamelet-binding.yaml index d856f765f..eb3476d63 100644 --- a/helm/camel-k/crds/crd-kamelet-binding.yaml +++ b/helm/camel-k/crds/crd-kamelet-binding.yaml @@ -6882,6 +6882,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/helm/camel-k/crds/crd-pipe.yaml b/helm/camel-k/crds/crd-pipe.yaml index 860e4c44b..8b7e891f6 100644 --- a/helm/camel-k/crds/crd-pipe.yaml +++ b/helm/camel-k/crds/crd-pipe.yaml @@ -6880,6 +6880,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/pkg/apis/camel/v1/integrationkit_types.go b/pkg/apis/camel/v1/integrationkit_types.go index d8b0864c4..b87eda9b4 100644 --- a/pkg/apis/camel/v1/integrationkit_types.go +++ b/pkg/apis/camel/v1/integrationkit_types.go @@ -147,12 +147,14 @@ const ( // IntegrationKitTypeLabel labels the kit type. IntegrationKitTypeLabel = "camel.apache.org/kit.type" - // IntegrationKitTypePlatform identifies a kit created by the platform. + // IntegrationKitTypePlatform identifies a Kit created by the platform. IntegrationKitTypePlatform = "platform" - // IntegrationKitTypeUser identifies a kit created by the user. + // IntegrationKitTypeUser identifies a Kit created by the user. IntegrationKitTypeUser = "user" - // IntegrationKitTypeExternal identifies a kit created by any third party. + // IntegrationKitTypeExternal identifies a Kit created by any third party. IntegrationKitTypeExternal = "external" + // IntegrationKitTypeSynthetic identifies a synthetic Kit (generated for any container image for which the operator cannot make any assumption). + IntegrationKitTypeSynthetic = "synthetic" // IntegrationKitLayoutLabel labels the kit layout. IntegrationKitLayoutLabel = "camel.apache.org/kit.layout" diff --git a/pkg/apis/camel/v1/integrationkit_types_support.go b/pkg/apis/camel/v1/integrationkit_types_support.go index c1c8d2a5f..b58653227 100644 --- a/pkg/apis/camel/v1/integrationkit_types_support.go +++ b/pkg/apis/camel/v1/integrationkit_types_support.go @@ -106,6 +106,11 @@ func (in *IntegrationKit) IsExternal() bool { return in.Labels[IntegrationKitTypeLabel] == IntegrationKitTypeExternal } +// IsSynthetic returns true for synthetic IntegrationKits. +func (in *IntegrationKit) IsSynthetic() bool { + return in.Labels[IntegrationKitTypeLabel] == IntegrationKitTypeSynthetic +} + // HasCapability returns true if the Kit is enabled with such a capability. func (in *IntegrationKit) HasCapability(capability string) bool { for _, cap := range in.Spec.Capabilities { diff --git a/pkg/apis/camel/v1/trait/container.go b/pkg/apis/camel/v1/trait/container.go index d5791ec38..4d426993a 100644 --- a/pkg/apis/camel/v1/trait/container.go +++ b/pkg/apis/camel/v1/trait/container.go @@ -51,6 +51,8 @@ type ContainerTrait struct { Name string `property:"name" json:"name,omitempty"` // The main container image Image string `property:"image" json:"image,omitempty"` + // A flag to mark the image used is coming from an IntegrationKit created externally. + ImageWasKit *bool `property:"image-was-kit" json:"imageWasKit,omitempty"` // The pull policy: Always|Never|IfNotPresent // +kubebuilder:validation:Enum=Always;Never;IfNotPresent ImagePullPolicy corev1.PullPolicy `property:"image-pull-policy" json:"imagePullPolicy,omitempty"` diff --git a/pkg/apis/camel/v1/trait/jvm.go b/pkg/apis/camel/v1/trait/jvm.go index b439381c3..abe1e1185 100644 --- a/pkg/apis/camel/v1/trait/jvm.go +++ b/pkg/apis/camel/v1/trait/jvm.go @@ -21,8 +21,6 @@ package trait // (bound to a container image) built by Camel K operator. If the system detects the usage of a different container image (ie, built externally), then, the // trait is disabled by the platform. // -// WARNING: you can still enable the trait explicitly even when it is disabled by the platform but you should be aware that some configurations could fail. -// // +camel-k:trait=jvm. type JVMTrait struct { Trait `property:",squash" json:",inline"` diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go index 3aa125359..5fc1d1964 100644 --- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go @@ -186,6 +186,11 @@ func (in *ContainerTrait) DeepCopyInto(out *ContainerTrait) { *out = new(bool) **out = **in } + if in.ImageWasKit != nil { + in, out := &in.ImageWasKit, &out.ImageWasKit + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerTrait. diff --git a/pkg/cmd/promote.go b/pkg/cmd/promote.go index 9b73e71ee..a807191f4 100644 --- a/pkg/cmd/promote.go +++ b/pkg/cmd/promote.go @@ -469,12 +469,8 @@ func (o *promoteCmdOptions) editIntegration(it *v1.Integration) *v1.Integration dst.Spec.Traits.Container = &traitv1.ContainerTrait{} } dst.Spec.Traits.Container.Image = contImage - if dst.Spec.Traits.JVM == nil { - dst.Spec.Traits.JVM = &traitv1.JVMTrait{} - } - if dst.Spec.Traits.JVM.Enabled == nil { - dst.Spec.Traits.JVM.Enabled = pointer.Bool(true) - } + dst.Spec.Traits.Container.ImageWasKit = pointer.Bool(true) + return &dst } @@ -520,12 +516,8 @@ func (o *promoteCmdOptions) editPipe(kb *v1.Pipe, it *v1.Integration) *v1.Pipe { dst.Spec.Integration.Traits.Container = &traitv1.ContainerTrait{} } dst.Spec.Integration.Traits.Container.Image = contImage - if dst.Spec.Integration.Traits.JVM == nil { - dst.Spec.Integration.Traits.JVM = &traitv1.JVMTrait{} - } - if dst.Spec.Integration.Traits.JVM.Enabled == nil { - dst.Spec.Integration.Traits.JVM.Enabled = pointer.Bool(true) - } + dst.Spec.Integration.Traits.Container.ImageWasKit = pointer.Bool(true) + if dst.Spec.Source.Ref != nil { dst.Spec.Source.Ref.Namespace = o.To } diff --git a/pkg/cmd/promote_test.go b/pkg/cmd/promote_test.go index 91ebce901..78779fb4e 100644 --- a/pkg/cmd/promote_test.go +++ b/pkg/cmd/promote_test.go @@ -102,8 +102,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true status: {} `, output) } @@ -144,8 +143,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true sink: {} source: {} status: {} @@ -202,8 +200,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true status: {} `, output) } @@ -248,8 +245,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true sink: {} source: {} status: {} @@ -325,8 +321,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true status: {} `, output) // Verify also when the operator Id is set in the integration @@ -349,8 +344,7 @@ spec: traits: container: image: my-special-image - jvm: - enabled: true + imageWasKit: true status: {} `, output) } diff --git a/pkg/controller/integrationkit/integrationkit_controller.go b/pkg/controller/integrationkit/integrationkit_controller.go index 6c3c21745..b1431fa3a 100644 --- a/pkg/controller/integrationkit/integrationkit_controller.go +++ b/pkg/controller/integrationkit/integrationkit_controller.go @@ -237,7 +237,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx context.Context, request reconci if target.Status.Phase == v1.IntegrationKitPhaseNone || target.Status.Phase == v1.IntegrationKitPhaseWaitingForPlatform { rlog.Debug("Preparing to shift integration kit phase") - if target.IsExternal() { + if target.IsExternal() || target.IsSynthetic() { target.Status.Phase = v1.IntegrationKitPhaseInitialization return r.update(ctx, &instance, target) } diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml index 9d04b2ad8..12f95132a 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml @@ -701,6 +701,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string @@ -2603,6 +2607,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string 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 21e0c9334..c587cc5a6 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml @@ -578,6 +578,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string @@ -2363,6 +2367,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml index 48c5885ed..0a4b17f32 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml @@ -6597,6 +6597,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml b/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml index d856f765f..eb3476d63 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml @@ -6882,6 +6882,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml index 860e4c44b..8b7e891f6 100644 --- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml +++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml @@ -6880,6 +6880,10 @@ spec: - Never - IfNotPresent type: string + imageWasKit: + description: A flag to mark the image used is coming from + an IntegrationKit created externally. + type: boolean limitCPU: description: The maximum amount of CPU required. type: string diff --git a/pkg/trait/container.go b/pkg/trait/container.go index 7d32a06d6..ecb5d160f 100644 --- a/pkg/trait/container.go +++ b/pkg/trait/container.go @@ -137,12 +137,15 @@ func (t *containerTrait) configureImageIntegrationKit(e *Environment) error { // Add some information for post-processing, this may need to be refactored // to a proper data structure kit.Labels = map[string]string{ - v1.IntegrationKitTypeLabel: v1.IntegrationKitTypeExternal, + v1.IntegrationKitTypeLabel: v1.IntegrationKitTypeSynthetic, kubernetes.CamelCreatorLabelKind: v1.IntegrationKind, kubernetes.CamelCreatorLabelName: e.Integration.Name, kubernetes.CamelCreatorLabelNamespace: e.Integration.Namespace, kubernetes.CamelCreatorLabelVersion: e.Integration.ResourceVersion, } + if pointer.BoolDeref(t.ImageWasKit, false) { + kit.Labels[v1.IntegrationKitTypeLabel] = v1.IntegrationKitTypeExternal + } if v, ok := e.Integration.Annotations[v1.PlatformSelectorAnnotation]; ok { v1.SetAnnotation(&kit.ObjectMeta, v1.PlatformSelectorAnnotation, v) diff --git a/pkg/trait/jvm.go b/pkg/trait/jvm.go index c9e3b3264..858ac33e4 100644 --- a/pkg/trait/jvm.go +++ b/pkg/trait/jvm.go @@ -70,12 +70,8 @@ func (t *jvmTrait) Configure(e *Environment) (bool, *TraitCondition, error) { } } - if e.IntegrationKit != nil && e.IntegrationKit.IsExternal() { - if pointer.BoolDeref(t.Enabled, false) { - return true, NewIntegrationConditionUserEnabledWithMessage("JVM", "integration kit was not created via Camel K operator"), nil - } else { - return false, newIntegrationConditionPlatformDisabledWithMessage("JVM", "integration kit was not created via Camel K operator"), nil - } + if e.IntegrationKit != nil && e.IntegrationKit.IsSynthetic() { + return false, newIntegrationConditionPlatformDisabledWithMessage("JVM", "integration kit was not created via Camel K operator"), nil } return true, nil, nil diff --git a/pkg/trait/jvm_test.go b/pkg/trait/jvm_test.go index b3f33f65d..3e3906d13 100644 --- a/pkg/trait/jvm_test.go +++ b/pkg/trait/jvm_test.go @@ -95,7 +95,7 @@ func TestConfigureJvmTraitInWrongJvmDisabled(t *testing.T) { } func TestConfigureJvmTraitInWrongIntegrationKitPhaseExternal(t *testing.T) { - trait, environment := createNominalJvmTest(v1.IntegrationKitTypeExternal) + trait, environment := createNominalJvmTest(v1.IntegrationKitTypeSynthetic) expectedCondition := NewIntegrationCondition( "JVM", @@ -111,24 +111,6 @@ func TestConfigureJvmTraitInWrongIntegrationKitPhaseExternal(t *testing.T) { assert.Equal(t, expectedCondition, condition) } -func TestConfigureJvmTraitInRightIntegrationKitPhaseExternalAndJvmEnabled(t *testing.T) { - trait, environment := createNominalJvmTest(v1.IntegrationKitTypeExternal) - trait.Enabled = pointer.Bool(true) - - expectedCondition := NewIntegrationCondition( - "JVM", - v1.IntegrationConditionTraitInfo, - corev1.ConditionTrue, - "TraitConfiguration", - "explicitly enabled by the user: integration kit was not created via Camel K operator", - ) - configured, condition, err := trait.Configure(environment) - require.NoError(t, err) - assert.True(t, configured) - assert.NotNil(t, condition) - assert.Equal(t, expectedCondition, condition) -} - func TestApplyJvmTraitWithDeploymentResource(t *testing.T) { trait, environment := createNominalJvmTest(v1.IntegrationKitTypePlatform) diff --git a/pkg/trait/trait_condition_types.go b/pkg/trait/trait_condition_types.go index 906cf3b57..216993a27 100644 --- a/pkg/trait/trait_condition_types.go +++ b/pkg/trait/trait_condition_types.go @@ -56,10 +56,6 @@ func NewIntegrationConditionUserDisabled(traitID string) *TraitCondition { return NewIntegrationCondition(traitID, v1.IntegrationConditionTraitInfo, corev1.ConditionTrue, traitConfigurationReason, userDisabledMessage) } -func NewIntegrationConditionUserEnabledWithMessage(traitID string, message string) *TraitCondition { - return NewIntegrationCondition(traitID, v1.IntegrationConditionTraitInfo, corev1.ConditionTrue, traitConfigurationReason, fmt.Sprintf("%s: %s", userEnabledMessage, message)) -} - func newIntegrationConditionPlatformDisabledWithMessage(traitID string, message string) *TraitCondition { return NewIntegrationCondition(traitID, v1.IntegrationConditionTraitInfo, corev1.ConditionTrue, traitConfigurationReason, fmt.Sprintf("%s: %s", platformDisabledMessage, message)) }