diff --git a/e2e/advanced/build_max_pipelines_test.go b/e2e/advanced/build_max_pipelines_test.go index 992e0a7ce3..8da4241daa 100644 --- a/e2e/advanced/build_max_pipelines_test.go +++ b/e2e/advanced/build_max_pipelines_test.go @@ -24,8 +24,6 @@ package advanced import ( "context" - "errors" - "fmt" "testing" "time" @@ -41,10 +39,11 @@ type kitOptions struct { traits []string } -func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, buildOrderStrategy v1.BuildOrderStrategy) { +func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, condition func(runningBuilds int) bool, buildOrderStrategy v1.BuildOrderStrategy) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { InstallOperator(t, ctx, g, ns) + g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutShort).Should(Equal(v1.IntegrationPlatformPhaseReady)) pl := Platform(t, ctx, ns)() // set maximum number of running builds and order strategy pl.Spec.Build.MaxRunningBuilds = maxRunningBuilds @@ -53,6 +52,10 @@ func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, buildOrderStrategy v t.Error(err) t.FailNow() } + g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutShort).Should(Equal(v1.IntegrationPlatformPhaseReady)) + g.Eventually(PlatformHas(t, ctx, ns, func(pl *v1.IntegrationPlatform) bool { + return pl.Status.Build.MaxRunningBuilds == maxRunningBuilds + }), TestTimeoutShort).Should(BeTrue()) buildA := "integration-a" buildB := "integration-b" @@ -85,22 +88,11 @@ func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, buildOrderStrategy v }, }, v1.BuildPhaseScheduling, v1.IntegrationKitPhaseNone) - var notExceedsMaxBuildLimit = func(runningBuilds int) bool { - return runningBuilds <= 2 - } - - limit := 0 - for limit < 5 && BuildPhase(t, ctx, ns, buildA)() == v1.BuildPhaseRunning { - // verify that number of running builds does not exceed max build limit - g.Consistently(BuildsRunning(BuildPhase(t, ctx, ns, buildA), BuildPhase(t, ctx, ns, buildB), BuildPhase(t, ctx, ns, buildC)), TestTimeoutShort, 10*time.Second).Should(Satisfy(notExceedsMaxBuildLimit)) - limit++ - } - - // make sure we have verified max build limit at least once - if limit == 0 { - t.Error(errors.New(fmt.Sprintf("Unexpected build phase '%s' for %s - not able to verify max builds limit", BuildPhase(t, ctx, ns, buildA)(), buildA))) - t.FailNow() - } + g.Consistently(BuildsRunning( + BuildPhase(t, ctx, ns, buildA), + BuildPhase(t, ctx, ns, buildB), + BuildPhase(t, ctx, ns, buildC), + ), TestTimeoutShort, 10*time.Second).Should(Satisfy(condition)) // verify that all builds are successful g.Eventually(BuildPhase(t, ctx, ns, buildA), TestTimeoutLong).Should(Equal(v1.BuildPhaseSucceeded)) @@ -113,15 +105,27 @@ func kitMaxBuildLimit(t *testing.T, maxRunningBuilds int32, buildOrderStrategy v } func TestKitMaxBuildLimitSequential(t *testing.T) { - kitMaxBuildLimit(t, 2, v1.BuildOrderStrategySequential) + // We must verify we have at least 1 build at a time + var condition = func(runningBuilds int) bool { + return runningBuilds <= 1 + } + kitMaxBuildLimit(t, 2, condition, v1.BuildOrderStrategySequential) } func TestKitMaxBuildLimitFIFO(t *testing.T) { - kitMaxBuildLimit(t, 2, v1.BuildOrderStrategyFIFO) + // We may have up to 2 parallel builds + var condition = func(runningBuilds int) bool { + return runningBuilds <= 2 + } + kitMaxBuildLimit(t, 2, condition, v1.BuildOrderStrategyFIFO) } func TestKitMaxBuildLimitDependencies(t *testing.T) { - kitMaxBuildLimit(t, 2, v1.BuildOrderStrategyDependencies) + // We may have up to 2 parallel builds + var condition = func(runningBuilds int) bool { + return runningBuilds <= 2 + } + kitMaxBuildLimit(t, 2, condition, v1.BuildOrderStrategyDependencies) } func TestMaxBuildLimitWaitingBuilds(t *testing.T) { diff --git a/e2e/advanced/environment_test.go b/e2e/advanced/environment_test.go index adf5c37d75..2df9018a8f 100644 --- a/e2e/advanced/environment_test.go +++ b/e2e/advanced/environment_test.go @@ -65,7 +65,7 @@ func TestHTTPProxy(t *testing.T) { } // Install Camel K with the HTTP proxy environment variable - InstallOperatorWithConf(t, ctx, g, ns, "", + InstallOperatorWithConf(t, ctx, g, ns, "", false, map[string]string{ "HTTP_PROXY": httpProxy, "NO_PROXY": strings.Join(noProxy, ","), diff --git a/e2e/advanced/integration_profile_test.go b/e2e/advanced/integration_profile_test.go index 61cc34fb46..ef5eb9bb31 100644 --- a/e2e/advanced/integration_profile_test.go +++ b/e2e/advanced/integration_profile_test.go @@ -41,7 +41,7 @@ func TestIntegrationProfile(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { operatorID := "camel-k-integration-profile" - InstallOperatorWithConf(t, ctx, g, ns, operatorID, nil) + InstallOperatorWithConf(t, ctx, g, ns, operatorID, true, nil) integrationProfile := v1.NewIntegrationProfile(ns, "ipr-global") integrationProfile.SetOperatorID(operatorID) @@ -125,7 +125,7 @@ func TestIntegrationProfileInfluencesKit(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { operatorID := "camel-k-ipr-kit" - InstallOperatorWithConf(t, ctx, g, ns, operatorID, nil) + InstallOperatorWithConf(t, ctx, g, ns, operatorID, false, nil) integrationProfile := v1.NewIntegrationProfile(ns, "ipr-global") integrationProfile.SetOperatorID(operatorID) @@ -166,7 +166,7 @@ func TestPropagateIntegrationProfileChanges(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { operatorID := "camel-k-ipr-changes" - InstallOperatorWithConf(t, ctx, g, ns, operatorID, nil) + InstallOperatorWithConf(t, ctx, g, ns, operatorID, false, nil) integrationProfile := v1.NewIntegrationProfile(ns, "debug-profile") integrationProfile.SetOperatorID(operatorID) diff --git a/e2e/advanced/kamelet_repo_test.go b/e2e/advanced/kamelet_repo_test.go index 1be44cb154..19a803014b 100644 --- a/e2e/advanced/kamelet_repo_test.go +++ b/e2e/advanced/kamelet_repo_test.go @@ -30,6 +30,7 @@ import ( corev1 "k8s.io/api/core/v1" . "github.com/apache/camel-k/v2/e2e/support" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" ) func TestKameletFromCustomRepository(t *testing.T) { @@ -41,10 +42,11 @@ func TestKameletFromCustomRepository(t *testing.T) { kameletName := "timer-custom-source" removeKamelet(t, ctx, kameletName, ns) g.Eventually(Kamelet(t, ctx, kameletName, ns)).Should(BeNil()) + g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutShort).Should(Equal(v1.IntegrationPlatformPhaseReady)) // Add the custom repository g.Expect(Kamel(t, ctx, "kamelet", "add-repo", "github:squakez/ck-kamelet-test-repo/kamelets", "-n", ns).Execute()).To(Succeed()) g.Expect(KamelRun(t, ctx, ns, "files/TimerCustomKameletIntegration.java").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-custom-kamelet-integration"), TestTimeoutLong). + g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-custom-kamelet-integration"), TestTimeoutMedium). Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, ctx, ns, "timer-custom-kamelet-integration")).Should(ContainSubstring("hello world")) diff --git a/e2e/advanced/local_platform_test.go b/e2e/advanced/local_platform_test.go deleted file mode 100644 index 3056ef4e26..0000000000 --- a/e2e/advanced/local_platform_test.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build integration -// +build integration - -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" - -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package advanced - -import ( - "context" - "testing" - - . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - - . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait" -) - -func TestLocalPlatform(t *testing.T) { - t.Parallel() - - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - operatorID := "camel-k-platform-local" - g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed()) - g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed()) - g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--global", "--force")).To(Succeed()) - g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) - - g.Expect(UpdatePlatform(t, ctx, ns, operatorID, func(pl *v1.IntegrationPlatform) { - pl.Spec.Build.Maven.Properties = make(map[string]string) - pl.Spec.Build.Maven.Properties["build-global-prop1"] = "build-global-value1" - // set maximum number of running builds - pl.Spec.Build.MaxRunningBuilds = 1 - })).To(Succeed()) - - g.Eventually(PlatformHas(t, ctx, ns, func(pl *v1.IntegrationPlatform) bool { - return pl.Status.Build.MaxRunningBuilds == 1 - }), TestTimeoutMedium).Should(BeTrue()) - - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1 string) { - // Install platform (use the installer to get staging if present) - g.Expect(KamelInstallWithID(t, ctx, "local-platform", ns1, "--skip-operator-setup")).To(Succeed()) - - g.Expect(UpdatePlatform(t, ctx, ns1, "local-platform", func(pl *v1.IntegrationPlatform) { - pl.Spec.Build.Maven.Properties = make(map[string]string) - pl.Spec.Build.Maven.Properties["build-local-prop1"] = "build-local-value1" - pl.SetOperatorID(operatorID) - - pl.Spec.Traits.Container = &traitv1.ContainerTrait{ - LimitCPU: "0.2", - } - })).To(Succeed()) - - g.Eventually(PlatformPhase(t, ctx, ns1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) - g.Eventually(PlatformHas(t, ctx, ns1, func(pl *v1.IntegrationPlatform) bool { - return pl.Status.Cluster != "" - }), TestTimeoutShort).Should(BeTrue()) - - g.Eventually(PlatformHas(t, ctx, ns1, func(pl *v1.IntegrationPlatform) bool { - return pl.Status.Build.MaxRunningBuilds == 1 - }), TestTimeoutShort).Should(BeTrue()) - - pl := PlatformByName(t, ctx, ns, operatorID)() - local := Platform(t, ctx, ns1)() - g.Expect(local.Status.Build.PublishStrategy).To(Equal(pl.Status.Build.PublishStrategy)) - g.Expect(local.Status.Build.BuildConfiguration.Strategy).To(Equal(pl.Status.Build.BuildConfiguration.Strategy)) - g.Expect(local.Status.Build.BuildConfiguration.OrderStrategy).To(Equal(pl.Status.Build.BuildConfiguration.OrderStrategy)) - g.Expect(local.Status.Build.Maven.LocalRepository).To(Equal(pl.Status.Build.Maven.LocalRepository)) - g.Expect(local.Status.Build.Maven.CLIOptions).To(ContainElements(pl.Status.Build.Maven.CLIOptions)) - g.Expect(local.Status.Build.Maven.Extension).To(BeEmpty()) - g.Expect(local.Status.Build.Maven.Properties).To(HaveLen(2)) - g.Expect(local.Status.Build.Maven.Properties["build-global-prop1"]).To(Equal("build-global-value1")) - g.Expect(local.Status.Build.Maven.Properties["build-local-prop1"]).To(Equal("build-local-value1")) - - g.Expect(KamelRunWithID(t, ctx, operatorID, ns1, "--name", "local-integration", "files/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPod(t, ctx, ns1, "local-integration"), TestTimeoutMedium).Should(Not(BeNil())) - g.Eventually(IntegrationPodHas(t, ctx, ns1, "local-integration", func(pod *corev1.Pod) bool { - if len(pod.Spec.Containers) != 1 { - return false - } - cpuLimits := pod.Spec.Containers[0].Resources.Limits.Cpu() - return cpuLimits != nil && cpuLimits.AsApproximateFloat64() > 0 - }), TestTimeoutShort).Should(BeTrue()) - - // Clean up - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns1).Execute()).To(Succeed()) - }) - }) -} diff --git a/e2e/advanced/maven_http_proxy_test.go b/e2e/advanced/maven_http_proxy_test.go index b174ed3725..625a6bebbc 100644 --- a/e2e/advanced/maven_http_proxy_test.go +++ b/e2e/advanced/maven_http_proxy_test.go @@ -141,8 +141,12 @@ func TestMavenProxy(t *testing.T) { } noProxy = append(noProxy, svc.Spec.ClusterIPs...) - InstallOperator(t, ctx, g, ns) - + InstallOperatorWithConf(t, ctx, g, ns, "", false, + map[string]string{ + "HTTP_PROXY": fmt.Sprintf("http://%s", hostname), + "NO_PROXY": strings.Join(noProxy, ","), + }, + ) // Check that operator pod has env_vars g.Eventually(OperatorPodHas(t, ctx, ns, func(op *corev1.Pod) bool { if envVar := envvar.Get(op.Spec.Containers[0].Env, "HTTP_PROXY"); envVar != nil { @@ -186,7 +190,7 @@ func TestMavenProxyNotPresent(t *testing.T) { t.Parallel() WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - //hostname := fmt.Sprintf("%s.%s.svc", "proxy-fake", ns) + hostname := fmt.Sprintf("%s.%s.svc", "proxy-fake", ns) svc := Service(t, ctx, TestDefaultNamespace, "kubernetes")() g.Expect(svc).NotTo(BeNil()) // It may be needed to populate the values from the cluster, machine and service network CIDRs @@ -197,9 +201,12 @@ func TestMavenProxyNotPresent(t *testing.T) { } noProxy = append(noProxy, svc.Spec.ClusterIPs...) - InstallOperator(t, ctx, g, ns) - //g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--operator-env-vars", fmt.Sprintf("HTTP_PROXY=http://%s", hostname), "--operator-env-vars", "NO_PROXY="+strings.Join(noProxy, ","))).To(Succeed()) - + InstallOperatorWithConf(t, ctx, g, ns, "", false, + map[string]string{ + "HTTP_PROXY": fmt.Sprintf("http://%s", hostname), + "NO_PROXY": strings.Join(noProxy, ","), + }, + ) // Run the Integration name := RandomizedSuffixName("java") g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name", name).Execute()).To(Succeed()) diff --git a/e2e/advanced/operator_id_filtering_test.go b/e2e/advanced/operator_id_filtering_test.go index 83879f298a..8e22c70f8d 100644 --- a/e2e/advanced/operator_id_filtering_test.go +++ b/e2e/advanced/operator_id_filtering_test.go @@ -41,12 +41,12 @@ func TestOperatorIDFiltering(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsop1 string) { operator1 := "operator-1" - InstallOperatorWithConf(t, ctx, g, nsop1, operator1, nil) + InstallOperatorWithConf(t, ctx, g, nsop1, operator1, true, nil) g.Eventually(PlatformPhase(t, ctx, nsop1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsop2 string) { operator2 := "operator-2" - InstallOperatorWithConf(t, ctx, g, nsop2, operator2, nil) + InstallOperatorWithConf(t, ctx, g, nsop2, operator2, true, nil) g.Eventually(PlatformPhase(t, ctx, nsop2), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) t.Run("Operators ignore non-scoped integrations", func(t *testing.T) { diff --git a/e2e/advanced/operator_metrics_test.go b/e2e/advanced/operator_metrics_test.go index 5f1077acb4..493051a4ae 100644 --- a/e2e/advanced/operator_metrics_test.go +++ b/e2e/advanced/operator_metrics_test.go @@ -50,7 +50,7 @@ func TestMetrics(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { // Install Camel K with the log debug enabled - InstallOperatorWithConf(t, ctx, g, ns, "", + InstallOperatorWithConf(t, ctx, g, ns, "", false, map[string]string{ "LOG_LEVEL": "debug", }, diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go index f37a6fa00c..4ec4dbdefd 100644 --- a/e2e/advanced/promote_test.go +++ b/e2e/advanced/promote_test.go @@ -42,7 +42,7 @@ func TestKamelCLIPromote(t *testing.T) { // Dev environment namespace WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsDev string) { operatorDevID := "camel-k-cli-promote-dev" - InstallOperatorWithConf(t, ctx, g, nsDev, operatorDevID, nil) + InstallOperatorWithConf(t, ctx, g, nsDev, operatorDevID, false, nil) g.Eventually(SelectedPlatformPhase(t, ctx, nsDev, operatorDevID), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) // Dev content configmap @@ -88,7 +88,7 @@ func TestKamelCLIPromote(t *testing.T) { // Prod environment namespace WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsProd string) { operatorProdID := "camel-k-cli-promote-prod" - InstallOperatorWithConf(t, ctx, g, nsProd, operatorProdID, nil) + InstallOperatorWithConf(t, ctx, g, nsProd, operatorProdID, false, nil) g.Eventually(PlatformPhase(t, ctx, nsProd), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady)) t.Run("no configmap in destination", func(t *testing.T) { diff --git a/e2e/advanced/synthetic_test.go b/e2e/advanced/synthetic_test.go index f2e85b9d34..60d3f3b053 100644 --- a/e2e/advanced/synthetic_test.go +++ b/e2e/advanced/synthetic_test.go @@ -61,7 +61,7 @@ func TestSyntheticIntegrationFromDeployment(t *testing.T) { WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { // Install Camel K with the proper configuration support - InstallOperatorWithConf(t, ctx, g, ns, "", + InstallOperatorWithConf(t, ctx, g, ns, "", false, map[string]string{ "CAMEL_K_SYNTHETIC_INTEGRATIONS": "true", }, diff --git a/e2e/install/olm/olm_install_test.go b/e2e/install/olm/olm_install_test.go index 01482b4f7d..eec96e9cde 100644 --- a/e2e/install/olm/olm_install_test.go +++ b/e2e/install/olm/olm_install_test.go @@ -104,11 +104,5 @@ func TestOLMInstallation(t *testing.T) { g.Expect(operatorPod.Spec.Containers[0].SecurityContext.Capabilities).To(Equal(kubernetes.DefaultOperatorSecurityContext().Capabilities)) g.Expect(operatorPod.Spec.Containers[0].SecurityContext.SeccompProfile).To(Equal(kubernetes.DefaultOperatorSecurityContext().SeccompProfile)) g.Expect(operatorPod.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation).To(Equal(kubernetes.DefaultOperatorSecurityContext().AllowPrivilegeEscalation)) - - // Clean up - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - g.Expect(Kamel(t, ctx, "uninstall", "-n", ns).Execute()).To(Succeed()) - // Clean up cluster-wide resources that are not removed by OLM - g.Expect(Kamel(t, ctx, "uninstall", "--all", "-n", ns, "--olm=false").Execute()).To(Succeed()) }) } diff --git a/e2e/knative/knative_pipes_test.go b/e2e/knative/knative_pipes_test.go index 1f4dc6b31f..73811fac0f 100644 --- a/e2e/knative/knative_pipes_test.go +++ b/e2e/knative/knative_pipes_test.go @@ -139,7 +139,7 @@ func TestRunBroker(t *testing.T) { WithNewTestNamespaceWithKnativeBroker(t, func(ctx context.Context, g *WithT, ns string) { // This test require an adhoc operator to run properly operatorID := fmt.Sprintf("camel-k-%s", ns) - InstallOperatorWithConf(t, ctx, g, ns, operatorID, nil) + InstallOperatorWithConf(t, ctx, g, ns, operatorID, false, nil) g.Eventually(SelectedPlatformPhase(t, ctx, ns, operatorID), TestTimeoutMedium).Should(Equal(camelv1.IntegrationPlatformPhaseReady)) g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/knativeevt1.yaml").Execute()).To(Succeed()) diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go index 63d49f0fec..3dd954e1d0 100644 --- a/e2e/support/test_util.go +++ b/e2e/support/test_util.go @@ -69,11 +69,11 @@ func GetEnvOrDefault(key string, deflt string) string { // InstallOperator is in charge to install a namespaced operator. The func must be // executed in a critical section as there may be concurrent access to it. func InstallOperator(t *testing.T, ctx context.Context, g *WithT, ns string) { - InstallOperatorWithConf(t, ctx, g, ns, "", nil) + InstallOperatorWithConf(t, ctx, g, ns, "", false, nil) } // InstallOperatorWithConf is in charge to install a namespaced operator with additional configurations. -func InstallOperatorWithConf(t *testing.T, ctx context.Context, g *WithT, ns, operatorID string, envs map[string]string) { +func InstallOperatorWithConf(t *testing.T, ctx context.Context, g *WithT, ns, operatorID string, global bool, envs map[string]string) { lock.Lock() defer lock.Unlock() KAMEL_INSTALL_REGISTRY := os.Getenv("KAMEL_INSTALL_REGISTRY") @@ -96,9 +96,13 @@ func InstallOperatorWithConf(t *testing.T, ctx context.Context, g *WithT, ns, op args = append(args, fmt.Sprintf("ENV=%s", joinedArgs)) } } + makeRule := "install-k8s-ns" + if global { + makeRule = "install-k8s-global" + } os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../") ExpectExecSucceed(t, g, - Make(t, "install-k8s-ns", args...), + Make(t, makeRule, args...), ) // Let's make sure the operator has been deployed g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil()) diff --git a/pkg/cmd/kamelet_add_repo.go b/pkg/cmd/kamelet_add_repo.go index 2244764e1a..ceeb4baa86 100644 --- a/pkg/cmd/kamelet_add_repo.go +++ b/pkg/cmd/kamelet_add_repo.go @@ -80,10 +80,11 @@ func (o *kameletAddRepoCommandOptions) run(cmd *cobra.Command, args []string) er } var platform *v1.IntegrationPlatform if o.OperatorID == "" { - platform, err = o.findIntegrationPlatform(cmd, c) - } else { - platform, err = o.getIntegrationPlatform(cmd, c) + o.OperatorID = platformutil.DefaultPlatformName } + + platform, err = o.getIntegrationPlatform(cmd, c) + if err != nil { return err } else if platform == nil { diff --git a/script/Makefile b/script/Makefile index 121c785505..1776d079a7 100644 --- a/script/Makefile +++ b/script/Makefile @@ -747,6 +747,7 @@ set-operator-id: ifdef OPERATOR_ID @echo "INFO: setting operator ID to $(OPERATOR_ID)" @sed -i 's/name: .*/name: $(OPERATOR_ID)/' $(KUST_TMP)/install/overlays/platform/integration-platform.yaml + cd $(KUST_TMP)/install/overlays/platform/ && kustomize edit add annotation camel.apache.org/operator.id:$(OPERATOR_ID) @sed -i 's/value: .*/value: $(OPERATOR_ID)/' $(KUST_TMP)/$(KUSTOMIZE_DIR)/patch-operator-id.yaml else @echo "INFO: no operator ID variable \"OPERATOR_ID\" provided. Keeping default."