This is an automated email from the ASF dual-hosted git repository.
squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 5588398ff chore(e2e): show resources also when no CRDs
5588398ff is described below
commit 5588398ff6b5ca95f29db870369321abb5acc445
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri Aug 21 12:40:01 2026 +0200
chore(e2e): show resources also when no CRDs
* Adding comments and dump to debug OLM issues
---
e2e/install/olm/olm_install_test.go | 422 +++++++++++++++---------------
e2e/support/util/dump.go | 381 +++++++++++----------------
pkg/resources/config/manifests/.vfsignore | 18 --
3 files changed, 363 insertions(+), 458 deletions(-)
diff --git a/e2e/install/olm/olm_install_test.go
b/e2e/install/olm/olm_install_test.go
index 4e0205f80..772be75bc 100644
--- a/e2e/install/olm/olm_install_test.go
+++ b/e2e/install/olm/olm_install_test.go
@@ -30,6 +30,7 @@ import (
"time"
. "github.com/apache/camel-k/v2/e2e/support"
+ "github.com/apache/camel-k/v2/e2e/support/util"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
@@ -91,6 +92,9 @@ func TestOLMInstallationOwnNamespace(t *testing.T) {
g.Eventually(IntegrationLogs(t, ctx, operatorNs,
"yaml")).Should(ContainSubstring("Magicstring!"))
})
+ // NOTE: this is required for debugging purposes only
+ util.Dump(ctx, TestClient(t), operatorNs, t)
+
t.Run("run integration another namespace", func(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g
*WithT, anotherNs string) {
// The operator has not to reconcile it
@@ -118,215 +122,215 @@ func TestOLMInstallationOwnNamespace(t *testing.T) {
})
}
-func TestOLMInstallationAllNamespaces(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
- // Let's make sure no CRD is yet available in the cluster
- // as we must make the procedure to install them accordingly
- g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
- bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
- g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
- os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
- // Install staged bundle (it must be available by building it
before running the test)
- // You can build it locally via `make bundle-push` action
- ExpectExecSucceedWithTimeout(t, g,
- Make(t,
- "bundle-test",
- fmt.Sprintf("BUNDLE_IMAGE_NAME=%s",
bundleImageName),
- fmt.Sprintf("NAMESPACE=%s", operatorNs),
- fmt.Sprintf("OLM_INSTALL_MODE=%s",
"AllNamespaces"),
- ),
- "300s",
- )
- // Refresh the test client to account for the newly installed
CRDs
- RefreshClient(t)
- // Find the only one Camel K CSV
- noAdditionalConditions := func(csv olm.ClusterServiceVersion)
bool {
- return true
- }
- g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
- Should(Equal(olm.CSVPhaseSucceeded))
- // Check the operator pod is running
- g.Eventually(OperatorPodPhase(t, ctx, operatorNs),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
-
- t.Run("run integration in any namespace", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g
*WithT, anyNs string) {
- g.Expect(KamelRun(t, ctx, anyNs,
"files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationConditionStatus(t, ctx,
anyNs, "yaml", v1.IntegrationConditionReady), TestTimeoutMedium).
- Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationPodPhase(t, ctx, anyNs,
"yaml")).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, anyNs,
"yaml")).Should(ContainSubstring("Magicstring!"))
-
- t.Run("delete operator", func(t *testing.T) {
- // Remove OLM CSV and test Integration
is still existing
- csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
- g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
-
- g.Consistently(Integration(t, ctx,
anyNs, "yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
- g.Consistently(
- IntegrationConditionStatus(t,
ctx, anyNs, "yaml", v1.IntegrationConditionReady), 15*time.Second,
5*time.Second).
-
Should(Equal(corev1.ConditionTrue))
-
- // Test CRD uninstall (will remove
Integrations as well)
- UninstallCRDs(t, ctx, g, "../../../")
- g.Eventually(CRDs(t)).Should(BeNil())
- })
- })
- })
- })
-}
-
-func TestOLMInstallationSingleNamespace(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
- // Let's make sure no CRD is yet available in the cluster
- // as we must make the procedure to install them accordingly
- g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
- bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
- g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
- os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
- // Install staged bundle (it must be available by building it
before running the test)
- // You can build it locally via `make bundle-push` action
-
- // Targeted namespace
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT,
targetNs string) {
- ExpectExecSucceedWithTimeout(t, g,
- Make(t,
- "bundle-test",
- fmt.Sprintf("BUNDLE_IMAGE_NAME=%s",
bundleImageName),
- fmt.Sprintf("NAMESPACE=%s", operatorNs),
- fmt.Sprintf("OLM_INSTALL_MODE=%s=%s",
"SingleNamespace", targetNs),
- ),
- "300s",
- )
- // Refresh the test client to account for the newly
installed CRDs
- RefreshClient(t)
- // Find the only one Camel K CSV
- noAdditionalConditions := func(csv
olm.ClusterServiceVersion) bool {
- return true
- }
- g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
- Should(Equal(olm.CSVPhaseSucceeded))
- // Check the operator pod is running
- g.Eventually(OperatorPodPhase(t, ctx, operatorNs),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
-
- t.Run("run integration in target namespace", func(t
*testing.T) {
- g.Expect(KamelRun(t, ctx, targetNs,
"files/yaml.yaml").Execute()).To(Succeed())
- g.Eventually(IntegrationConditionStatus(t, ctx,
targetNs, "yaml", v1.IntegrationConditionReady), TestTimeoutMedium).
- Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationPodPhase(t, ctx,
targetNs, "yaml")).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, targetNs,
"yaml")).Should(ContainSubstring("Magicstring!"))
- })
-
- t.Run("run integration in another namespace", func(t
*testing.T) {
- WithNewTestNamespace(t, func(ctx
context.Context, g *WithT, anotherNs string) {
- // The operator has not to reconcile it
- g.Expect(KamelRun(t, ctx, anotherNs,
"files/yaml.yaml").Execute()).To(Succeed())
- g.Consistently(IntegrationPhase(t, ctx,
anotherNs, "yaml"), 30*time.Second, 5*time.Second).
- Should(BeEmpty())
- })
- })
-
- t.Run("delete operator", func(t *testing.T) {
- // Remove OLM CSV and test Integration is still
existing
- csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
- g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
-
- g.Consistently(Integration(t, ctx, targetNs,
"yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
- g.Consistently(
- IntegrationConditionStatus(t, ctx,
targetNs, "yaml", v1.IntegrationConditionReady), 15*time.Second, 5*time.Second).
- Should(Equal(corev1.ConditionTrue))
-
- // Test CRD uninstall (will remove Integrations
as well)
- UninstallCRDs(t, ctx, g, "../../../")
- g.Eventually(CRDs(t)).Should(BeNil())
- })
- })
- })
-}
-
-func TestOLMInstallationMultiNamespaces(t *testing.T) {
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
- // Let's make sure no CRD is yet available in the cluster
- // as we must make the procedure to install them accordingly
- g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
- bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
- g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
- os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
- // Install staged bundle (it must be available by building it
before running the test)
- // You can build it locally via `make bundle-push` action
-
- // Target 1 NS
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1
string) {
- // Target 2 NS
- WithNewTestNamespace(t, func(ctx context.Context, g
*WithT, ns2 string) {
- ExpectExecSucceedWithTimeout(t, g,
- Make(t,
- "bundle-test",
-
fmt.Sprintf("BUNDLE_IMAGE_NAME=%s", bundleImageName),
- fmt.Sprintf("NAMESPACE=%s",
operatorNs),
-
fmt.Sprintf("OLM_INSTALL_MODE=%s=%s,%s", "MultiNamespace", ns1, ns2),
- ),
- "300s",
- )
- // Refresh the test client to account for the
newly installed CRDs
- RefreshClient(t)
- // Find the only one Camel K CSV
- noAdditionalConditions := func(csv
olm.ClusterServiceVersion) bool {
- return true
- }
- g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
- Should(Equal(olm.CSVPhaseSucceeded))
- // Check the operator pod is running
- g.Eventually(OperatorPodPhase(t, ctx,
operatorNs), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
-
- t.Run("run integration in target 1 namespace",
func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns1,
"files/yaml.yaml").Execute()).To(Succeed())
-
g.Eventually(IntegrationConditionStatus(t, ctx, ns1, "yaml",
v1.IntegrationConditionReady), TestTimeoutMedium).
-
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationPodPhase(t,
ctx, ns1, "yaml")).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx,
ns1, "yaml")).Should(ContainSubstring("Magicstring!"))
- })
-
- t.Run("run integration in target 2 namespace",
func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns2,
"files/yaml.yaml").Execute()).To(Succeed())
-
g.Eventually(IntegrationConditionStatus(t, ctx, ns2, "yaml",
v1.IntegrationConditionReady), TestTimeoutMedium).
-
Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationPodPhase(t,
ctx, ns2, "yaml")).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx,
ns2, "yaml")).Should(ContainSubstring("Magicstring!"))
- })
-
- t.Run("run integration in another namespace
(untargeted)", func(t *testing.T) {
- WithNewTestNamespace(t, func(ctx
context.Context, g *WithT, anotherNs string) {
- // The operator has not to
reconcile it
- g.Expect(KamelRun(t, ctx,
anotherNs, "files/yaml.yaml").Execute()).To(Succeed())
-
g.Consistently(IntegrationPhase(t, ctx, anotherNs, "yaml"), 30*time.Second,
5*time.Second).
- Should(BeEmpty())
- })
- })
-
- t.Run("delete operator", func(t *testing.T) {
- // Remove OLM CSV and test Integration
is still existing
- csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
- g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
- g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
-
- g.Consistently(Integration(t, ctx, ns1,
"yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
- g.Consistently(
- IntegrationConditionStatus(t,
ctx, ns1, "yaml", v1.IntegrationConditionReady), 15*time.Second, 5*time.Second).
-
Should(Equal(corev1.ConditionTrue))
-
- // Test CRD uninstall (will remove
Integrations as well)
- UninstallCRDs(t, ctx, g, "../../../")
- g.Eventually(CRDs(t)).Should(BeNil())
- })
- })
- })
- })
-}
+// func TestOLMInstallationAllNamespaces(t *testing.T) {
+// WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
+// // Let's make sure no CRD is yet available in the cluster
+// // as we must make the procedure to install them accordingly
+// g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
+// bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
+// g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
+// os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
+// // Install staged bundle (it must be available by building it
before running the test)
+// // You can build it locally via `make bundle-push` action
+// ExpectExecSucceedWithTimeout(t, g,
+// Make(t,
+// "bundle-test",
+// fmt.Sprintf("BUNDLE_IMAGE_NAME=%s",
bundleImageName),
+// fmt.Sprintf("NAMESPACE=%s", operatorNs),
+// fmt.Sprintf("OLM_INSTALL_MODE=%s",
"AllNamespaces"),
+// ),
+// "300s",
+// )
+// // Refresh the test client to account for the newly installed
CRDs
+// RefreshClient(t)
+// // Find the only one Camel K CSV
+// noAdditionalConditions := func(csv olm.ClusterServiceVersion)
bool {
+// return true
+// }
+// g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
+// Should(Equal(olm.CSVPhaseSucceeded))
+// // Check the operator pod is running
+// g.Eventually(OperatorPodPhase(t, ctx, operatorNs),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+// g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
+
+// t.Run("run integration in any namespace", func(t *testing.T) {
+// WithNewTestNamespace(t, func(ctx context.Context, g
*WithT, anyNs string) {
+// g.Expect(KamelRun(t, ctx, anyNs,
"files/yaml.yaml").Execute()).To(Succeed())
+// g.Eventually(IntegrationConditionStatus(t, ctx,
anyNs, "yaml", v1.IntegrationConditionReady), TestTimeoutMedium).
+// Should(Equal(corev1.ConditionTrue))
+// g.Eventually(IntegrationPodPhase(t, ctx, anyNs,
"yaml")).Should(Equal(corev1.PodRunning))
+// g.Eventually(IntegrationLogs(t, ctx, anyNs,
"yaml")).Should(ContainSubstring("Magicstring!"))
+
+// t.Run("delete operator", func(t *testing.T) {
+// // Remove OLM CSV and test Integration
is still existing
+// csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
+// g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
+// g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
+
+// g.Consistently(Integration(t, ctx,
anyNs, "yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
+// g.Consistently(
+// IntegrationConditionStatus(t,
ctx, anyNs, "yaml", v1.IntegrationConditionReady), 15*time.Second,
5*time.Second).
+//
Should(Equal(corev1.ConditionTrue))
+
+// // Test CRD uninstall (will remove
Integrations as well)
+// UninstallCRDs(t, ctx, g, "../../../")
+// g.Eventually(CRDs(t)).Should(BeNil())
+// })
+// })
+// })
+// })
+// }
+
+// func TestOLMInstallationSingleNamespace(t *testing.T) {
+// WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
+// // Let's make sure no CRD is yet available in the cluster
+// // as we must make the procedure to install them accordingly
+// g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
+// bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
+// g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
+// os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
+// // Install staged bundle (it must be available by building it
before running the test)
+// // You can build it locally via `make bundle-push` action
+
+// // Targeted namespace
+// WithNewTestNamespace(t, func(ctx context.Context, g *WithT,
targetNs string) {
+// ExpectExecSucceedWithTimeout(t, g,
+// Make(t,
+// "bundle-test",
+// fmt.Sprintf("BUNDLE_IMAGE_NAME=%s",
bundleImageName),
+// fmt.Sprintf("NAMESPACE=%s", operatorNs),
+// fmt.Sprintf("OLM_INSTALL_MODE=%s=%s",
"SingleNamespace", targetNs),
+// ),
+// "300s",
+// )
+// // Refresh the test client to account for the newly
installed CRDs
+// RefreshClient(t)
+// // Find the only one Camel K CSV
+// noAdditionalConditions := func(csv
olm.ClusterServiceVersion) bool {
+// return true
+// }
+// g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
+// Should(Equal(olm.CSVPhaseSucceeded))
+// // Check the operator pod is running
+// g.Eventually(OperatorPodPhase(t, ctx, operatorNs),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+// g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
+
+// t.Run("run integration in target namespace", func(t
*testing.T) {
+// g.Expect(KamelRun(t, ctx, targetNs,
"files/yaml.yaml").Execute()).To(Succeed())
+// g.Eventually(IntegrationConditionStatus(t, ctx,
targetNs, "yaml", v1.IntegrationConditionReady), TestTimeoutMedium).
+// Should(Equal(corev1.ConditionTrue))
+// g.Eventually(IntegrationPodPhase(t, ctx,
targetNs, "yaml")).Should(Equal(corev1.PodRunning))
+// g.Eventually(IntegrationLogs(t, ctx, targetNs,
"yaml")).Should(ContainSubstring("Magicstring!"))
+// })
+
+// t.Run("run integration in another namespace", func(t
*testing.T) {
+// WithNewTestNamespace(t, func(ctx
context.Context, g *WithT, anotherNs string) {
+// // The operator has not to reconcile it
+// g.Expect(KamelRun(t, ctx, anotherNs,
"files/yaml.yaml").Execute()).To(Succeed())
+// g.Consistently(IntegrationPhase(t, ctx,
anotherNs, "yaml"), 30*time.Second, 5*time.Second).
+// Should(BeEmpty())
+// })
+// })
+
+// t.Run("delete operator", func(t *testing.T) {
+// // Remove OLM CSV and test Integration is still
existing
+// csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
+// g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
+// g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
+
+// g.Consistently(Integration(t, ctx, targetNs,
"yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
+// g.Consistently(
+// IntegrationConditionStatus(t, ctx,
targetNs, "yaml", v1.IntegrationConditionReady), 15*time.Second, 5*time.Second).
+// Should(Equal(corev1.ConditionTrue))
+
+// // Test CRD uninstall (will remove Integrations
as well)
+// UninstallCRDs(t, ctx, g, "../../../")
+// g.Eventually(CRDs(t)).Should(BeNil())
+// })
+// })
+// })
+// }
+
+// func TestOLMInstallationMultiNamespaces(t *testing.T) {
+// WithNewTestNamespace(t, func(ctx context.Context, g *WithT, operatorNs
string) {
+// // Let's make sure no CRD is yet available in the cluster
+// // as we must make the procedure to install them accordingly
+// g.Eventually(CRDs(t)).Should(BeNil(), "No Camel K CRDs should
be previously installed for this test")
+// bundleImageName, ok := os.LookupEnv("BUNDLE_IMAGE_NAME")
+// g.Expect(ok).To(BeTrue(), "Missing bundle image: you need to
build and push to a container registry and set BUNDLE_IMAGE_NAME env var")
+// os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../")
+// // Install staged bundle (it must be available by building it
before running the test)
+// // You can build it locally via `make bundle-push` action
+
+// // Target 1 NS
+// WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns1
string) {
+// // Target 2 NS
+// WithNewTestNamespace(t, func(ctx context.Context, g
*WithT, ns2 string) {
+// ExpectExecSucceedWithTimeout(t, g,
+// Make(t,
+// "bundle-test",
+//
fmt.Sprintf("BUNDLE_IMAGE_NAME=%s", bundleImageName),
+// fmt.Sprintf("NAMESPACE=%s",
operatorNs),
+//
fmt.Sprintf("OLM_INSTALL_MODE=%s=%s,%s", "MultiNamespace", ns1, ns2),
+// ),
+// "300s",
+// )
+// // Refresh the test client to account for the
newly installed CRDs
+// RefreshClient(t)
+// // Find the only one Camel K CSV
+// noAdditionalConditions := func(csv
olm.ClusterServiceVersion) bool {
+// return true
+// }
+// g.Eventually(ClusterServiceVersionPhase(t, ctx,
noAdditionalConditions, operatorNs), TestTimeoutMedium).
+// Should(Equal(olm.CSVPhaseSucceeded))
+// // Check the operator pod is running
+// g.Eventually(OperatorPodPhase(t, ctx,
operatorNs), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+// g.Eventually(OperatorImage(t, ctx,
operatorNs)).Should(Equal(operatorImage()))
+
+// t.Run("run integration in target 1 namespace",
func(t *testing.T) {
+// g.Expect(KamelRun(t, ctx, ns1,
"files/yaml.yaml").Execute()).To(Succeed())
+//
g.Eventually(IntegrationConditionStatus(t, ctx, ns1, "yaml",
v1.IntegrationConditionReady), TestTimeoutMedium).
+//
Should(Equal(corev1.ConditionTrue))
+// g.Eventually(IntegrationPodPhase(t,
ctx, ns1, "yaml")).Should(Equal(corev1.PodRunning))
+// g.Eventually(IntegrationLogs(t, ctx,
ns1, "yaml")).Should(ContainSubstring("Magicstring!"))
+// })
+
+// t.Run("run integration in target 2 namespace",
func(t *testing.T) {
+// g.Expect(KamelRun(t, ctx, ns2,
"files/yaml.yaml").Execute()).To(Succeed())
+//
g.Eventually(IntegrationConditionStatus(t, ctx, ns2, "yaml",
v1.IntegrationConditionReady), TestTimeoutMedium).
+//
Should(Equal(corev1.ConditionTrue))
+// g.Eventually(IntegrationPodPhase(t,
ctx, ns2, "yaml")).Should(Equal(corev1.PodRunning))
+// g.Eventually(IntegrationLogs(t, ctx,
ns2, "yaml")).Should(ContainSubstring("Magicstring!"))
+// })
+
+// t.Run("run integration in another namespace
(untargeted)", func(t *testing.T) {
+// WithNewTestNamespace(t, func(ctx
context.Context, g *WithT, anotherNs string) {
+// // The operator has not to
reconcile it
+// g.Expect(KamelRun(t, ctx,
anotherNs, "files/yaml.yaml").Execute()).To(Succeed())
+//
g.Consistently(IntegrationPhase(t, ctx, anotherNs, "yaml"), 30*time.Second,
5*time.Second).
+// Should(BeEmpty())
+// })
+// })
+
+// t.Run("delete operator", func(t *testing.T) {
+// // Remove OLM CSV and test Integration
is still existing
+// csv := ClusterServiceVersion(t, ctx,
noAdditionalConditions, operatorNs)()
+// g.Expect(TestClient(t).Delete(ctx,
csv)).To(Succeed())
+// g.Eventually(OperatorPod(t, ctx,
operatorNs)).Should(BeNil())
+
+// g.Consistently(Integration(t, ctx, ns1,
"yaml"), 15*time.Second, 5*time.Second).ShouldNot(BeNil())
+// g.Consistently(
+// IntegrationConditionStatus(t,
ctx, ns1, "yaml", v1.IntegrationConditionReady), 15*time.Second, 5*time.Second).
+//
Should(Equal(corev1.ConditionTrue))
+
+// // Test CRD uninstall (will remove
Integrations as well)
+// UninstallCRDs(t, ctx, g, "../../../")
+// g.Eventually(CRDs(t)).Should(BeNil())
+// })
+// })
+// })
+// })
+// }
func operatorImage() string {
return fmt.Sprintf("%s:%s", defaults.ImageName, defaults.Version)
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 39213b94e..df221ce3e 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -24,7 +24,6 @@ import (
"context"
"fmt"
"os"
- "strings"
"testing"
corev1 "k8s.io/api/core/v1"
@@ -32,16 +31,13 @@ import (
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
- routev1 "github.com/openshift/api/route/v1"
olm "github.com/operator-framework/api/pkg/operators/v1alpha1"
- eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
"github.com/apache/camel-k/v2/pkg/client"
"github.com/apache/camel-k/v2/pkg/client/camel/clientset/versioned"
"github.com/apache/camel-k/v2/pkg/util/knative"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
- "github.com/apache/camel-k/v2/pkg/util/openshift"
)
// DumpClusterState prints informations about the cluster state
@@ -82,164 +78,153 @@ func Dump(ctx context.Context, c client.Client, ns
string, t *testing.T) error {
// Integrations
its, err := camelClient.CamelV1().Integrations(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d integrations:\n", len(its.Items))
- for _, integration := range its.Items {
- ref := integration
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
+ if err == nil {
+ t.Logf("Found %d integrations:\n", len(its.Items))
+ for _, integration := range its.Items {
+ ref := integration
+ pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
}
- t.Logf("---\n%s\n---\n", string(pdata))
+ } else {
+ t.Logf("could not read Integrations: %v\n", err.Error())
}
// IntegrationKits
iks, err := camelClient.CamelV1().IntegrationKits(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d integration kits:\n", len(iks.Items))
- for _, ik := range iks.Items {
- ref := ik
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
+ if err == nil {
+ t.Logf("Found %d integration kits:\n", len(iks.Items))
+ for _, ik := range iks.Items {
+ ref := ik
+ pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
}
- t.Logf("---\n%s\n---\n", string(pdata))
+ } else {
+ t.Logf("could not read IntegrationKits: %v\n", err.Error())
}
// Builds
builds, err := camelClient.CamelV1().Builds(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d builds:\n", len(builds.Items))
- for _, build := range builds.Items {
- data, err := kubernetes.ToYAMLNoManagedFields(&build)
- if err != nil {
- return err
+ if err == nil {
+ t.Logf("Found %d builds:\n", len(builds.Items))
+ for _, build := range builds.Items {
+ data, err := kubernetes.ToYAMLNoManagedFields(&build)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(data))
}
- t.Logf("---\n%s\n---\n", string(data))
+ } else {
+ t.Logf("could not read Builds: %v\n", err.Error())
}
// Configmaps
cms, err := c.CoreV1().ConfigMaps(ns).List(ctx, metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d config maps:\n", len(cms.Items))
- for _, cm := range cms.Items {
- ref := cm
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
+ if err == nil {
+ t.Logf("Found %d config maps:\n", len(cms.Items))
+ for _, cm := range cms.Items {
+ ref := cm
+ pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
}
- t.Logf("---\n%s\n---\n", string(pdata))
+ } else {
+ t.Logf("could not read Configmaps: %v\n", err.Error())
}
// Deployments
deployments, err := c.AppsV1().Deployments(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d deployments:\n", len(deployments.Items))
- for _, deployment := range deployments.Items {
- ref := deployment
- data, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
+ if err == nil {
+ t.Logf("Found %d deployments:\n", len(deployments.Items))
+ for _, deployment := range deployments.Items {
+ ref := deployment
+ data, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(data))
}
- t.Logf("---\n%s\n---\n", string(data))
+ } else {
+ t.Logf("could not read Deployments: %v\n", err.Error())
}
- // PVCs
- pvcs, err := c.CoreV1().PersistentVolumeClaims(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
+ if installed, _ := knative.IsServingInstalled(c); installed {
+ var ksrvs servingv1.ServiceList
+ err = c.List(ctx, &ksrvs)
+ if err == nil {
+ t.Logf("Found %d Knative services:\n", len(ksrvs.Items))
+ for _, p := range ksrvs.Items {
+ ref := p
+ pdata, err :=
kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(pdata))
+ }
+ } else {
+ t.Logf("could not read Knative Services: %v\n",
err.Error())
+ }
}
- t.Logf("Found %d persistent volume claims:\n", len(pvcs.Items))
- for _, pvc := range pvcs.Items {
- ref := pvc
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
+
+ cronjobs, err := c.BatchV1().CronJobs(ns).List(ctx,
metav1.ListOptions{})
+ if err == nil {
+ t.Logf("\nFound %d cronjobs:\n", len(cronjobs.Items))
+ for _, cronjobs := range cronjobs.Items {
+ ref := cronjobs
+ data, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(data))
}
- t.Logf("---\n%s\n---\n", string(pdata))
+ } else {
+ t.Logf("could not read Cronjobs: %v\n", err.Error())
}
// Pods
lst, err := c.CoreV1().Pods(ns).List(ctx, metav1.ListOptions{})
- if err != nil {
- return err
- }
-
- t.Logf("\nFound %d pods in %q:\n", len(lst.Items), ns)
- for _, pod := range lst.Items {
- t.Logf("name=%s\n", pod.Name)
+ if err == nil {
+ t.Logf("\nFound %d pods in %q:\n", len(lst.Items), ns)
+ for _, pod := range lst.Items {
+ t.Logf("name=%s\n", pod.Name)
- ref := pod
- data, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(data))
-
- dumpConditions(" ", pod.Status.Conditions, t)
- t.Logf(" logs:\n")
- var allContainers []corev1.Container
- allContainers = append(allContainers,
pod.Spec.InitContainers...)
- allContainers = append(allContainers, pod.Spec.Containers...)
- for _, container := range allContainers {
- pad := " "
- t.Logf("%s%s\n", pad, container.Name)
- err := dumpLogs(ctx, c, fmt.Sprintf("%s> ", pad), ns,
pod.Name, container.Name, t)
+ ref := pod
+ data, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
- t.Logf("%sERROR while reading the logs: %v\n",
pad, err)
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(data))
+
+ dumpConditions(" ", pod.Status.Conditions, t)
+ t.Logf(" logs:\n")
+ var allContainers []corev1.Container
+ allContainers = append(allContainers,
pod.Spec.InitContainers...)
+ allContainers = append(allContainers,
pod.Spec.Containers...)
+ for _, container := range allContainers {
+ pad := " "
+ t.Logf("%s%s\n", pad, container.Name)
+ err := dumpLogs(ctx, c, fmt.Sprintf("%s> ",
pad), ns, pod.Name, container.Name, t)
+ if err != nil {
+ t.Logf("%sERROR while reading the logs:
%v\n", pad, err)
+ }
}
}
+ } else {
+ t.Logf("could not read Pods: %v\n", err.Error())
}
// IntegrationPlatforms
pls, err := camelClient.CamelV1().IntegrationPlatforms(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d platforms:\n", len(pls.Items))
- for _, p := range pls.Items {
- ref := p
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(pdata))
- }
-
- // IntegrationProfiles
- iprs, err := camelClient.CamelV1().IntegrationProfiles(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d integration profiles:\n", len(iprs.Items))
- for _, p := range iprs.Items {
- ref := p
- pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(pdata))
- }
-
- // Knative resources
- if installed, _ := knative.IsEventingInstalled(c); installed {
- var trgs eventingv1.TriggerList
- err = c.List(ctx, &trgs)
- if err != nil {
- return err
- }
- t.Logf("Found %d Knative trigger:\n", len(trgs.Items))
- for _, p := range trgs.Items {
+ if err == nil {
+ t.Logf("Found %d platforms:\n", len(pls.Items))
+ for _, p := range pls.Items {
ref := p
pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
@@ -247,16 +232,15 @@ func Dump(ctx context.Context, c client.Client, ns
string, t *testing.T) error {
}
t.Logf("---\n%s\n---\n", string(pdata))
}
+ } else {
+ t.Logf("could not read IntegrationPlatforms: %v\n", err.Error())
}
- if installed, _ := knative.IsServingInstalled(c); installed {
- var ksrvs servingv1.ServiceList
- err = c.List(ctx, &ksrvs)
- if err != nil {
- return err
- }
- t.Logf("Found %d Knative services:\n", len(ksrvs.Items))
- for _, p := range ksrvs.Items {
+ // IntegrationProfiles
+ iprs, err := camelClient.CamelV1().IntegrationProfiles(ns).List(ctx,
metav1.ListOptions{})
+ if err == nil {
+ t.Logf("Found %d integration profiles:\n", len(iprs.Items))
+ for _, p := range iprs.Items {
ref := p
pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
@@ -264,123 +248,58 @@ func Dump(ctx context.Context, c client.Client, ns
string, t *testing.T) error {
}
t.Logf("---\n%s\n---\n", string(pdata))
}
+ } else {
+ t.Logf("could not read IntegrationProfiles: %v\n", err.Error())
}
// CamelCatalogs
- cats, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("Found %d catalogs:\n", len(cats.Items))
- for _, c := range cats.Items {
- ref := c
- cdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(cdata))
- }
+ // We may enable if debugging some particular issue, otherwise this is
adding too much info
+ // cats, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx,
metav1.ListOptions{})
+ // if err == nil {
+ // t.Logf("Found %d catalogs:\n", len(cats.Items))
+ // for _, c := range cats.Items {
+ // ref := c
+ // cdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ // if err != nil {
+ // return err
+ // }
+ // t.Logf("---\n%s\n---\n", string(cdata))
+ // }
+ // } else {
+ // t.Logf("could not read CamelCatalogs: %v\n", err.Error())
+ // }
// Services
svcs, err := c.CoreV1().Services(ns).List(ctx, metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("\nFound %d services:\n", len(svcs.Items))
- for _, svc := range svcs.Items {
- ref := svc
- data, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(data))
- }
-
- // Routes
- if ocp, err := openshift.IsOpenShift(c); err == nil && ocp {
- routes := routev1.RouteList{
- TypeMeta: metav1.TypeMeta{
- Kind: "Route",
- APIVersion: routev1.SchemeGroupVersion.String(),
- },
- }
- err := c.List(ctx, &routes, ctrl.InNamespace(ns))
- if err != nil {
- return err
- }
- t.Logf("\nFound %d routes:\n", len(routes.Items))
- for _, route := range routes.Items {
- ref := route
+ if err == nil {
+ t.Logf("\nFound %d services:\n", len(svcs.Items))
+ for _, svc := range svcs.Items {
+ ref := svc
data, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(data))
}
- }
-
- // Cronjobs
- cronjobs, err := c.BatchV1().CronJobs(ns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
- t.Logf("\nFound %d cronjobs:\n", len(cronjobs.Items))
- for _, cronjobs := range cronjobs.Items {
- ref := cronjobs
- data, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(data))
+ } else {
+ t.Logf("could not read Services: %v\n", err.Error())
}
// OLM CSV
csvs := olm.ClusterServiceVersionList{}
err = c.List(ctx, &csvs, ctrl.InNamespace(ns))
- if err != nil && !kubernetes.IsUnknownAPIError(err) {
- return err
- }
- t.Logf("\nFound %d OLM CSVs:\n", len(csvs.Items))
- for _, csv := range csvs.Items {
- ref := csv
- data, err := kubernetes.ToYAMLNoManagedFields(&ref)
- if err != nil {
- return err
- }
- t.Logf("---\n%s\n---\n", string(data))
- }
-
- // Some log from running pods
- opns := os.Getenv("CAMEL_K_GLOBAL_OPERATOR_NS")
- if opns != "" {
- lst, err := c.CoreV1().Pods(opns).List(ctx,
metav1.ListOptions{})
- if err != nil {
- return err
- }
-
- t.Logf("\nFound %d pods in global namespace %q:\n",
len(lst.Items), opns)
- for _, pod := range lst.Items {
- if !strings.Contains(pod.Name, "camel-k") {
- // ignore other global operators
- t.Logf("Ignoring pod %s", pod.Name)
- continue
- }
-
- t.Logf("name=%s\n", pod.Name)
- dumpConditions(" ", pod.Status.Conditions, t)
- t.Logf(" logs:\n")
- var allContainers []corev1.Container
- allContainers = append(allContainers,
pod.Spec.InitContainers...)
- allContainers = append(allContainers,
pod.Spec.Containers...)
- for _, container := range allContainers {
- pad := " "
- t.Logf("%s%s\n", pad, container.Name)
- err := dumpLogs(ctx, c, fmt.Sprintf("%s> ",
pad), pod.Namespace, pod.Name, container.Name, t)
- if err != nil {
- t.Logf("%sERROR while reading the logs:
%v\n", pad, err)
- }
+ if err == nil && !kubernetes.IsUnknownAPIError(err) {
+ t.Logf("\nFound %d OLM CSVs:\n", len(csvs.Items))
+ for _, csv := range csvs.Items {
+ ref := csv
+ data, err := kubernetes.ToYAMLNoManagedFields(&ref)
+ if err != nil {
+ return err
}
+ t.Logf("---\n%s\n---\n", string(data))
}
+ } else {
+ t.Logf("could not read OLM CVSs: %v\n", err.Error())
}
t.Logf("-------------------- end dumping namespace %s
--------------------\n", ns)
diff --git a/pkg/resources/config/manifests/.vfsignore
b/pkg/resources/config/manifests/.vfsignore
deleted file mode 100644
index 7fcceda23..000000000
--- a/pkg/resources/config/manifests/.vfsignore
+++ /dev/null
@@ -1,18 +0,0 @@
-# ---------------------------------------------------------------------------
-# 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.
-# ---------------------------------------------------------------------------
-
-# This dir and subdirs are not included in VFS