This is an automated email from the ASF dual-hosted git repository.
squakez pushed a commit to branch v3
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/v3 by this push:
new ecd0409b8 feat(ctrl): remove operator-id annotation
ecd0409b8 is described below
commit ecd0409b8e0ef7916dae17562812afe2d545c557
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sun Nov 8 09:44:26 2026 +0100
feat(ctrl): remove operator-id annotation
---
docs/modules/ROOT/pages/architecture/operator.adoc | 10 +-
.../ROOT/pages/contributing/local-execution.adoc | 8 --
e2e/advanced/build_max_pipelines_test.go | 2 +-
e2e/advanced/builder_test.go | 2 +-
e2e/advanced/environment_test.go | 2 +-
e2e/advanced/maven_http_proxy_test.go | 4 +-
e2e/advanced/operator_metrics_test.go | 2 +-
e2e/advanced/promote_test.go | 106 +++++++++++++--------
e2e/common/binding/binding_test.go | 12 +--
e2e/common/binding/it-binding.yaml | 5 +-
e2e/common/cli/files/my-it.yaml | 3 +
e2e/common/traits/prometheus_test.go | 65 -------------
e2e/common/traits/service_test.go | 12 ---
e2e/install/helm/setup_test.go | 2 +-
e2e/knative/knative_service_test.go | 7 +-
e2e/knative/openapi_test.go | 4 +-
e2e/support/test_support.go | 60 +++---------
e2e/support/test_util.go | 8 +-
pkg/apis/camel/v1/camelcatalog_types_support.go | 10 --
pkg/apis/camel/v1/common_types.go | 6 --
pkg/apis/camel/v1/common_types_support.go | 5 -
pkg/apis/camel/v1/integration_types_support.go | 10 --
pkg/apis/camel/v1/integrationkit_types_support.go | 10 --
.../camel/v1/integrationprofile_types_support.go | 5 -
pkg/apis/camel/v1/pipe_types_support.go | 5 -
pkg/cmd/bind.go | 7 --
pkg/cmd/promote.go | 6 +-
pkg/cmd/promote_test.go | 54 -----------
pkg/cmd/run.go | 7 --
pkg/controller/build/build_controller.go | 7 --
pkg/controller/catalog/catalog_controller.go | 7 --
pkg/controller/integration/build.go | 9 --
.../integration/integration_controller.go | 7 --
pkg/controller/integration/monitor.go | 7 --
pkg/controller/integrationkit/build.go | 10 --
.../integrationkit/integrationkit_controller.go | 7 --
pkg/controller/pipe/monitor.go | 6 +-
pkg/controller/pipe/pipe_controller.go | 7 --
pkg/platform/defaults.go | 1 -
pkg/platform/operator.go | 68 +------------
pkg/trait/camel.go | 6 --
pkg/trait/gitops.go | 4 +-
pkg/trait/quarkus.go | 9 --
pkg/util/camel/camel_runtime.go | 4 -
pkg/util/digest/digest.go | 5 -
pkg/util/gitops/gitops.go | 35 ++-----
46 files changed, 123 insertions(+), 515 deletions(-)
diff --git a/docs/modules/ROOT/pages/architecture/operator.adoc
b/docs/modules/ROOT/pages/architecture/operator.adoc
index a6b236820..79db2bec0 100644
--- a/docs/modules/ROOT/pages/architecture/operator.adoc
+++ b/docs/modules/ROOT/pages/architecture/operator.adoc
@@ -7,7 +7,7 @@ Per the Kubernetes glossary, a controller is an application
that implements a co
image::architecture/operator-control-loop.png[control-loop]
-This pattern is the foundation of every
https://kubernetes.io/docs/concepts/architecture/controller/[Controllers]
shipped by default by Kubernetes but can also be used by
https://kubernetes.io/docs/concepts/extend-kubernetes/operator[Operators] that
are controllers that encode domain specific knowledge and extends the
Kubernetes API to create, configure and manage instances of complex
applications on behalf of Kubernetes users.
+This pattern is the foundation of every
https://kubernetes.io/docs/concepts/architecture/controller/[Controllers]
shipped by default by Kubernetes but can also be used by
https://kubernetes.io/docs/concepts/extend-kubernetes/operator[Operators] that
are controllers that encode domain specific knowledge and extends the
Kubernetes API to create, configure and manage instances of complex
applications on behalf of Kubernetes users.
With the Camel K Operator we have moved this pattern to the next level as it
goes beyond the tasks to install and maintain applications but materializes
them according to the integration logic expressed through the **Camel DSL**.
@@ -25,7 +25,7 @@ To manage the interaction with them, a simple control loop
was not enough. So we
image::architecture/camel-k-operator-control-loop.png[control-loop]
-== State Machine
+== State Machine
With the exception of the `CamelCatalog`, each CR has a dedicated state
machine in charge to orchestrate the transition to the phases each CR needs to
go through to bring integrations to the desired state.
@@ -41,7 +41,7 @@ type Action interface {
}
----
<1> Determine if the action can handle the CR as an example by looking at the
phase of the CR which is stored as part of the status sub resource.
-<2> Implement the action and return a non `nil` instance to signal to the
controller that the CR needs to be updated with the new one, instead, if the
method returns a `nil` instance, then nothing will happen and unless the CR
changes outside the control of the operator, the same action will be invoked on
the next iteration. This is useful when a CR needs to delegate some work to a
different controller so the CR won't be moved to the next stage till the sub
operation has completed.
+<2> Implement the action and return a non `nil` instance to signal to the
controller that the CR needs to be updated with the new one, instead, if the
method returns a `nil` instance, then nothing will happen and unless the CR
changes outside the control of the operator, the same action will be invoked on
the next iteration. This is useful when a CR needs to delegate some work to a
different controller so the CR won't be moved to the next stage till the sub
operation has completed.
[NOTE]
====
@@ -59,8 +59,4 @@ an annotation. The annotation selects the operator that
should handle the resour
This approach allows multiple Camel K installations and operators on the same
cluster with each operator handling an explicit set of Camel K resources
identified
by the operator id.
-By default, the Camel K operator has the id `camel-k` and users with only one
single installation on the cluster will not even notice the existence of this
identifier. When an administrator wants to add more Camel K operator
installations to the cluster the
-operator id needs to be unique and resources should be annotated with the
respective annotation `camel.apache.org/operator.id=<operator-id>`. With this
approach we make sure that only one single operator installation manages
-a resource at a time.
-
Read more about this topic in xref:installation/advanced/multi.adoc[Multiple
Operators and Selective Upgrades]
diff --git a/docs/modules/ROOT/pages/contributing/local-execution.adoc
b/docs/modules/ROOT/pages/contributing/local-execution.adoc
index 1bc8fc9ec..e73090148 100644
--- a/docs/modules/ROOT/pages/contributing/local-execution.adoc
+++ b/docs/modules/ROOT/pages/contributing/local-execution.adoc
@@ -19,14 +19,6 @@ Finally, assuming you've built your application correctly we
can run the operato
./kamel operator
```
-Test the local operator by creating a test `Integration`:
-
-```bash
-./kamel run xyz.abc -n operator-test -x camel-k-dev
-```
-
-IMPORTANT: make sure no other Camel K Operators are watching this namespace,
neither you have a global Camel K Operator installed on your cluster. As you
may have more than one Camel K operator installed on the cluster, it's
important you specify the `-x` (or `--operator-id`) option.
-
[[local-minikube]]
== Local operator and local cluster
diff --git a/e2e/advanced/build_max_pipelines_test.go
b/e2e/advanced/build_max_pipelines_test.go
index 263d83ddc..5c2f2eb7e 100644
--- a/e2e/advanced/build_max_pipelines_test.go
+++ b/e2e/advanced/build_max_pipelines_test.go
@@ -35,7 +35,7 @@ import (
func TestRunBuildMaxParallelPipelines(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
map[string]string{
+ InstallOperatorWithConf(t, ctx, g, ns, false, map[string]string{
"MAX_RUNNING_BUILDS": "1",
})
integrationA := RandomizedSuffixName("java-a")
diff --git a/e2e/advanced/builder_test.go b/e2e/advanced/builder_test.go
index 21950c19d..4062df2d1 100644
--- a/e2e/advanced/builder_test.go
+++ b/e2e/advanced/builder_test.go
@@ -38,7 +38,7 @@ func TestBuilderTimeout(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
map[string]string{"BUILD_TIMEOUT_SECONDS": "10"})
+ InstallOperatorWithConf(t, ctx, g, ns, false,
map[string]string{"BUILD_TIMEOUT_SECONDS": "10"})
operatorPod := OperatorPod(t, ctx, ns)()
operatorPodImage := operatorPod.Spec.Containers[0].Image
diff --git a/e2e/advanced/environment_test.go b/e2e/advanced/environment_test.go
index 1389c2d4b..6eccfdf30 100644
--- a/e2e/advanced/environment_test.go
+++ b/e2e/advanced/environment_test.go
@@ -55,7 +55,7 @@ func TestHTTPProxy(t *testing.T) {
noProxy = append(noProxy, svc.Spec.ClusterIPs...)
// Install Camel K with the HTTP proxy environment variable
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
+ InstallOperatorWithConf(t, ctx, g, ns, false,
map[string]string{
"HTTP_PROXY": httpProxy,
"NO_PROXY": strings.Join(noProxy, ","),
diff --git a/e2e/advanced/maven_http_proxy_test.go
b/e2e/advanced/maven_http_proxy_test.go
index bf5d6437d..d1d90a81f 100644
--- a/e2e/advanced/maven_http_proxy_test.go
+++ b/e2e/advanced/maven_http_proxy_test.go
@@ -141,7 +141,7 @@ func TestMavenProxy(t *testing.T) {
}
noProxy = append(noProxy, svc.Spec.ClusterIPs...)
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
+ InstallOperatorWithConf(t, ctx, g, ns, false,
map[string]string{
"HTTP_PROXY": fmt.Sprintf("http://%s",
hostname),
"NO_PROXY": strings.Join(noProxy, ","),
@@ -201,7 +201,7 @@ func TestMavenProxyNotPresent(t *testing.T) {
}
noProxy = append(noProxy, svc.Spec.ClusterIPs...)
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
+ InstallOperatorWithConf(t, ctx, g, ns, false,
map[string]string{
"HTTP_PROXY": fmt.Sprintf("http://%s",
hostname),
"NO_PROXY": strings.Join(noProxy, ","),
diff --git a/e2e/advanced/operator_metrics_test.go
b/e2e/advanced/operator_metrics_test.go
index 3ca3d6b36..dce63c321 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, "", false,
+ 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 a37b6788f..f461e5506 100644
--- a/e2e/advanced/promote_test.go
+++ b/e2e/advanced/promote_test.go
@@ -41,8 +41,7 @@ func TestKamelCLIPromote(t *testing.T) {
two := int64(2)
// 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, false,
nil)
+ InstallOperatorWithConf(t, ctx, g, nsDev, false, nil)
// Dev content configmap
var cmData = make(map[string]string)
@@ -62,32 +61,35 @@ func TestKamelCLIPromote(t *testing.T) {
*/
t.Run("plain integration dev", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev,
"./files/promote-route.yaml", "--config", "configmap:my-cm-promote",
"--config", "secret:my-sec-promote").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, nsDev,
"./files/promote-route.yaml",
+ "--config", "configmap:my-cm-promote",
+ "--config", "secret:my-sec-promote",
+ ).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationObservedGeneration(t, ctx,
nsDev, "promote-route")).Should(Equal(&one))
- //g.Eventually(IntegrationConditionStatus(t, nsDev,
"promote-route", v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development
configmap"))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret
development"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route")).Should(ContainSubstring("I am development configmap"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route")).Should(ContainSubstring("very top secret development"))
})
t.Run("kamelet integration dev", func(t *testing.T) {
- g.Expect(CreateTimerKameletWithID(t, ctx,
operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed())
- g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev,
"./files/timer-kamelet-usage.yaml").Execute()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, nsDev,
"my-own-timer-source")()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, nsDev,
"./files/timer-kamelet-usage.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello
world"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"timer-kamelet-usage")).Should(ContainSubstring("Hello world"))
})
t.Run("binding dev", func(t *testing.T) {
- g.Expect(CreateTimerKameletWithID(t, ctx,
operatorDevID, nsDev, "kb-timer-source")()).To(Succeed())
- g.Expect(KamelBindWithID(t, ctx, operatorDevID, nsDev,
"kb-timer-source", "log:info", "-p",
"source.message=my-kamelet-binding-rocks").Execute()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, nsDev,
"kb-timer-source")()).To(Succeed())
+ g.Expect(KamelBind(t, ctx, nsDev, "kb-timer-source",
"log:info",
+ "-p", "source.message=my-kamelet-binding-rocks",
+ ).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"kb-timer-source-to-log"),
TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks"))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"kb-timer-source-to-log")).Should(ContainSubstring("my-kamelet-binding-rocks"))
})
// 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, false, nil)
+ InstallOperatorWithConf(t, ctx, g, nsProd, false, nil)
// Prod content configmap
var cmData = make(map[string]string)
@@ -103,21 +105,31 @@ func TestKamelCLIPromote(t *testing.T) {
g.Expect(Kamel(t, ctx, "promote", "-n", nsDev,
"promote-route", "--to", nsProd).Execute()).To(Succeed())
g.Eventually(IntegrationObservedGeneration(t,
ctx, nsProd, "promote-route")).Should(Equal(&one))
g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx,
nsProd, "promote-route", v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production"))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret
production"))
+ g.Eventually(IntegrationConditionStatus(t, ctx,
nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route"), TestTimeoutShort).
+ Should(ContainSubstring("I am
production"))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route"), TestTimeoutShort).
+ Should(ContainSubstring("very top
secret production"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, ctx, nsProd,
"promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev,
"promote-route")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd,
"promote-route")()).
+ Should(Equal(IntegrationPodImage(t,
ctx, nsDev, "promote-route")()))
})
t.Run("plain integration promotion update", func(t
*testing.T) {
// We need to update the Integration CR in
order the operator to restart it both in dev and prod envs
- g.Expect(KamelRunWithID(t, ctx, operatorDevID,
nsDev, "./files/promote-route-edited.yaml", "--name", "promote-route",
"--config", "configmap:my-cm-promote").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, nsDev,
"./files/promote-route-edited.yaml",
+ "--name", "promote-route",
+ "--config", "configmap:my-cm-promote",
+ ).Execute()).To(Succeed())
// The generation has to be incremented
g.Eventually(IntegrationObservedGeneration(t,
ctx, nsDev, "promote-route")).Should(Equal(&two))
- g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx,
nsDev, "promote-route", v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development
configmap"))
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"promote-route"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx,
nsDev, "promote-route", v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"promote-route")).
+ Should(ContainSubstring("I am
development configmap"))
// Update the configmap only in prod
var cmData = make(map[string]string)
cmData["my-configmap-key"] = "I am production,
but I was updated"
@@ -126,37 +138,53 @@ func TestKamelCLIPromote(t *testing.T) {
g.Expect(Kamel(t, ctx, "promote", "-n", nsDev,
"promote-route", "--to", nsProd).Execute()).To(Succeed())
// The generation has to be incremented also in
prod
g.Eventually(IntegrationObservedGeneration(t,
ctx, nsDev, "promote-route")).Should(Equal(&two))
- g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx,
nsProd, "promote-route", v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production,
but I was updated"))
+ g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "promote-route"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx,
nsProd, "promote-route", v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"promote-route")).
+ Should(ContainSubstring("I am
production, but I was updated"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, ctx, nsProd,
"promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev,
"promote-route")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd,
"promote-route")()).
+ Should(Equal(IntegrationPodImage(t,
ctx, nsDev, "promote-route")()))
})
t.Run("kamelet integration promotion", func(t
*testing.T) {
- g.Expect(CreateTimerKameletWithID(t, ctx,
operatorProdID, nsProd, "my-own-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, nsProd,
"my-own-timer-source")()).To(Succeed())
g.Expect(Kamel(t, ctx, "promote", "-n", nsDev,
"timer-kamelet-usage", "--to", nsProd).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "timer-kamelet-usage"),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello
world"))
+ g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "timer-kamelet-usage"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"timer-kamelet-usage")).
+ Should(ContainSubstring("Hello world"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, ctx, nsProd,
"timer-kamelet-usage")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev,
"timer-kamelet-usage")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd,
"timer-kamelet-usage")()).
+ Should(Equal(IntegrationPodImage(t,
ctx, nsDev, "timer-kamelet-usage")()))
})
t.Run("binding promotion", func(t *testing.T) {
- g.Expect(CreateTimerKameletWithID(t, ctx,
operatorProdID, nsProd, "kb-timer-source")()).To(Succeed())
+ g.Expect(CreateTimerKamelet(t, ctx, nsProd,
"kb-timer-source")()).To(Succeed())
g.Expect(Kamel(t, ctx, "promote", "-n", nsDev,
"kb-timer-source-to-log", "--to", nsProd).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "kb-timer-source-to-log"),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"kb-timer-source-to-log"),
TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks"))
+ g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "kb-timer-source-to-log"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"kb-timer-source-to-log")).
+
Should(ContainSubstring("my-kamelet-binding-rocks"))
// They must use the same image
- g.Expect(IntegrationPodImage(t, ctx, nsProd,
"kb-timer-source-to-log")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev,
"kb-timer-source-to-log")()))
+ g.Expect(IntegrationPodImage(t, ctx, nsProd,
"kb-timer-source-to-log")()).
+ Should(Equal(IntegrationPodImage(t,
ctx, nsDev, "kb-timer-source-to-log")()))
//Binding update
- g.Expect(KamelBindWithID(t, ctx, operatorDevID,
nsDev, "kb-timer-source", "log:info", "-p",
"source.message=my-kamelet-binding-rocks-again").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"kb-timer-source-to-log"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsDev,
"kb-timer-source-to-log"),
TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks-again"))
+ g.Expect(KamelBind(t, ctx, nsDev,
"kb-timer-source", "log:info",
+ "-p",
"source.message=my-kamelet-binding-rocks-again",
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationPodPhase(t, ctx, nsDev,
"kb-timer-source-to-log"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsDev,
"kb-timer-source-to-log")).
+
Should(ContainSubstring("my-kamelet-binding-rocks-again"))
g.Expect(Kamel(t, ctx, "promote", "-n", nsDev,
"kb-timer-source-to-log", "--to", nsProd).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "kb-timer-source-to-log"),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationLogs(t, ctx, nsProd,
"kb-timer-source-to-log"),
TestTimeoutShort).Should(ContainSubstring("my-kamelet-binding-rocks-again"))
+ g.Eventually(IntegrationPodPhase(t, ctx,
nsProd, "kb-timer-source-to-log"), TestTimeoutMedium).
+ Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, nsProd,
"kb-timer-source-to-log")).
+
Should(ContainSubstring("my-kamelet-binding-rocks-again"))
})
})
})
diff --git a/e2e/common/binding/binding_test.go
b/e2e/common/binding/binding_test.go
index ff199d098..5c414adea 100644
--- a/e2e/common/binding/binding_test.go
+++ b/e2e/common/binding/binding_test.go
@@ -35,20 +35,18 @@ import (
. "github.com/apache/camel-k/v2/e2e/support"
)
-func TestServiceTrait(t *testing.T) {
+func TestTimerToCamelIntegrationBinding(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- t.Run("Integration Binding", func(t *testing.T) {
- // Not supported when running as a Knative Service as
- // the Knative operator creates an external service
with the same name of the Integration
- g.Expect(KamelRun(t, ctx, ns, "hello.yaml", "-t",
"knative-service.enabled=false").Execute()).To(Succeed())
+ t.Run("Camel Integration binding", func(t *testing.T) {
+ g.Expect(KamelRun(t, ctx, ns,
"hello.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx, ns,
"hello",
- camelv1.IntegrationConditionReady),
TestTimeoutLong).Should(Equal(v1.ConditionTrue))
+ camelv1.IntegrationConditionReady),
TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns,
"hello")).Should(Equal(corev1.PodRunning))
ExpectExecSucceed(t, g, Kubectl("apply", "-f",
"it-binding.yaml", "-n", ns))
g.Eventually(IntegrationConditionStatus(t, ctx, ns,
"timer-to-hello-it",
- camelv1.IntegrationConditionReady),
TestTimeoutLong).Should(Equal(v1.ConditionTrue))
+ camelv1.IntegrationConditionReady),
TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns,
"timer-to-hello-it")).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationLogs(t, ctx, ns,
"timer-to-hello-it")).Should(
diff --git a/e2e/common/binding/it-binding.yaml
b/e2e/common/binding/it-binding.yaml
index 612633e8c..6d3ebea4c 100644
--- a/e2e/common/binding/it-binding.yaml
+++ b/e2e/common/binding/it-binding.yaml
@@ -30,4 +30,7 @@ spec:
properties:
path: hello
sink:
- uri: log:info
\ No newline at end of file
+ uri: log:info
+ traits:
+ pull-secret:
+ secretName: ck-dev-registry
\ No newline at end of file
diff --git a/e2e/common/cli/files/my-it.yaml b/e2e/common/cli/files/my-it.yaml
index c320190ce..b34dc257d 100644
--- a/e2e/common/cli/files/my-it.yaml
+++ b/e2e/common/cli/files/my-it.yaml
@@ -30,3 +30,6 @@ spec:
simple: Hello Camel from my-it
- log: ${body}
uri: timer:yaml
+ traits:
+ pull-secret:
+ secretName: ck-dev-registry
diff --git a/e2e/common/traits/prometheus_test.go
b/e2e/common/traits/prometheus_test.go
deleted file mode 100644
index 829a8e71a..000000000
--- a/e2e/common/traits/prometheus_test.go
+++ /dev/null
@@ -1,65 +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 common
-
-import (
- "context"
- "fmt"
- "testing"
- "time"
-
- . "github.com/onsi/gomega"
- "github.com/stretchr/testify/assert"
-
- 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 TestPrometheusTrait(t *testing.T) {
- t.Parallel()
- WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
- // Do not create PodMonitor for the time being as CI test runs
on OCP 3.11
- createPodMonitor := false
- g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
- "-t", "prometheus.enabled=true",
- "-t", fmt.Sprintf("prometheus.pod-monitor=%v",
createPodMonitor),
- ).Execute()).To(Succeed())
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java",
v1.IntegrationConditionReady), TestTimeoutMedium).
- Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, "java"),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-
- t.Run("Metrics endpoint works", func(t *testing.T) {
- pod := IntegrationPod(t, ctx, ns, "java")
- response, err :=
TestClient(t).CoreV1().RESTClient().Get().
- Timeout(30 * time.Second).
-
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/observe/metrics", ns,
pod().Name)).DoRaw(ctx)
- if err != nil {
- assert.Fail(t, err.Error())
- }
- assert.Contains(t, string(response),
"camel_exchanges_total")
- })
-
- })
-}
diff --git a/e2e/common/traits/service_test.go
b/e2e/common/traits/service_test.go
index 0c9854c18..6d08a9815 100644
--- a/e2e/common/traits/service_test.go
+++ b/e2e/common/traits/service_test.go
@@ -40,18 +40,6 @@ func TestServiceTrait(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
name := "platform-http-server"
- t.Run("NodePort service", func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java", "-t", "service.enabled=true",
- "-t",
"service.node-port=true").Execute()).To(Succeed())
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
- Should(Equal(corev1.ConditionTrue))
-
- //
- // Service names can vary with the ExternalName Service
- // sometimes being created first and being given the
root name
- //
- g.Eventually(ServicesByType(t, ctx, ns,
corev1.ServiceTypeNodePort), TestTimeoutLong).ShouldNot(BeEmpty())
- })
t.Run("Default service (ClusterIP)", func(t *testing.T) {
// Service trait is enabled by default
diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go
index d98f10f5d..a772c8919 100644
--- a/e2e/install/helm/setup_test.go
+++ b/e2e/install/helm/setup_test.go
@@ -69,7 +69,7 @@ func TestHelmInstallation(t *testing.T) {
// Test a simple route
t.Run("simple route", func(t *testing.T) {
- g.Expect(KamelRunWithID(t, ctx, operatorID, operatorNs,
"files/yaml.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, operatorNs,
"files/yaml.yaml").Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx,
operatorNs, "yaml", v1.IntegrationConditionReady),
TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, operatorNs,
"yaml")).Should(Equal(corev1.PodRunning))
diff --git a/e2e/knative/knative_service_test.go
b/e2e/knative/knative_service_test.go
index 219e62f62..8d5cea476 100644
--- a/e2e/knative/knative_service_test.go
+++ b/e2e/knative/knative_service_test.go
@@ -37,7 +37,9 @@ func TestKnativeServiceURL(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
t.Run("Service endpoint url check", func(t *testing.T) {
- g.Expect(KamelRun(t, ctx, ns,
"files/knativeurl1.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/knativeurl1.yaml",
+ "-t", "knative-service.enabled=true",
+ ).Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx, ns,
"knativeurl1", camelv1.IntegrationConditionReady),
TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns,
"knativeurl1")).Should(Equal(v1.PodRunning))
@@ -47,7 +49,8 @@ func TestKnativeServiceURL(t *testing.T) {
})
t.Run("Service multiple endpoint url check", func(t *testing.T)
{
- g.Expect(KamelRun(t, ctx, ns,
"files/knativeurl2.yaml").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns, "files/knativeurl2.yaml",
+ "-t",
"knative-service.enabled=true").Execute()).To(Succeed())
g.Eventually(IntegrationConditionStatus(t, ctx, ns,
"knativeurl2", camelv1.IntegrationConditionReady),
TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
g.Eventually(IntegrationPodPhase(t, ctx, ns,
"knativeurl2")).Should(Equal(v1.PodRunning))
diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go
index 3bb7dd107..440722577 100644
--- a/e2e/knative/openapi_test.go
+++ b/e2e/knative/openapi_test.go
@@ -48,7 +48,9 @@ func TestOpenAPIKnativeContractFirst(t *testing.T) {
CreatePlainTextConfigmap(t, ctx, ns, "my-openapi", cmDataProps)
g.Expect(KamelRun(t, ctx, ns,
- "--name", name, "--resource", "configmap:my-openapi",
"files/petstore-cf.yaml").
+ "--name", name, "--resource", "configmap:my-openapi",
"files/petstore-cf.yaml",
+ "-t", "knative-service.enabled=true",
+ ).
Execute()).To(Succeed())
g.Eventually(KnativeService(t, ctx, ns, name), TestTimeoutLong).
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 515f6cdb7..4ae8ad882 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -62,7 +62,6 @@ import (
servingv1
"github.com/apache/camel-k/v2/pkg/apis/duck/knative/serving/v1"
"github.com/apache/camel-k/v2/pkg/client"
"github.com/apache/camel-k/v2/pkg/cmd"
- "github.com/apache/camel-k/v2/pkg/platform"
v2util "github.com/apache/camel-k/v2/pkg/util"
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/log"
@@ -194,41 +193,33 @@ func Kamel(t *testing.T, ctx context.Context, args
...string) *cobra.Command {
}
func KamelRun(t *testing.T, ctx context.Context, namespace string, args
...string) *cobra.Command {
- return KamelRunWithID(t, ctx, platform.DefaultPlatformName, namespace,
args...)
+ return kamelRunWithContext(t, ctx, namespace, args...)
}
-func KamelRunWithID(t *testing.T, ctx context.Context, operatorID string,
namespace string, args ...string) *cobra.Command {
- return kamelRunWithContext(t, ctx, operatorID, namespace, args...)
-}
-
-func kamelRunWithContext(t *testing.T, ctx context.Context, operatorID string,
namespace string, args ...string) *cobra.Command {
+func kamelRunWithContext(t *testing.T, ctx context.Context, namespace string,
args ...string) *cobra.Command {
if os.Getenv("E2E_TEST_REGISTRY_SECRET_COPY") == "true" {
args = append(args, "-t",
"pull-secret.secret-name="+registrySecret)
}
- return kamelCommandWithContext(t, ctx, "run", operatorID, namespace,
args...)
+ return kamelCommandWithContext(t, ctx, "run", namespace, args...)
}
func KamelBind(t *testing.T, ctx context.Context, namespace string, args
...string) *cobra.Command {
- return KamelBindWithID(t, ctx, platform.DefaultPlatformName, namespace,
args...)
-}
-
-func KamelBindWithID(t *testing.T, ctx context.Context, operatorID string,
namespace string, args ...string) *cobra.Command {
- return kamelBindWithContext(t, ctx, operatorID, namespace, args...)
+ return kamelBindWithContext(t, ctx, namespace, args...)
}
-func kamelBindWithContext(t *testing.T, ctx context.Context, operatorID
string, namespace string, args ...string) *cobra.Command {
- return kamelCommandWithContext(t, ctx, "bind", operatorID, namespace,
args...)
+func kamelBindWithContext(t *testing.T, ctx context.Context, namespace string,
args ...string) *cobra.Command {
+ if os.Getenv("E2E_TEST_REGISTRY_SECRET_COPY") == "true" {
+ args = append(args, "-t",
"pull-secret.secret-name="+registrySecret)
+ }
+ return kamelCommandWithContext(t, ctx, "bind", namespace, args...)
}
-func kamelCommandWithContext(t *testing.T, ctx context.Context, command
string, operatorID string, namespace string, args ...string) *cobra.Command {
+func kamelCommandWithContext(t *testing.T, ctx context.Context, command
string, namespace string, args ...string) *cobra.Command {
// Avoid concurrent access to the CLI
cmdMutex.Lock()
defer cmdMutex.Unlock()
cmdArgs := []string{command, "-n", namespace}
- if operatorID != platform.DefaultPlatformName {
- cmdArgs = append(cmdArgs, "--operator-id", operatorID)
- }
cmdArgs = append(cmdArgs, args...)
return KamelWithContext(t, ctx, cmdArgs...)
}
@@ -616,16 +607,6 @@ func IntegrationConditionStatus(t *testing.T, ctx
context.Context, ns string, na
}
}
-func AssignIntegrationToOperator(t *testing.T, ctx context.Context, ns, name,
operator string) error {
- it := Integration(t, ctx, ns, name)()
- if it == nil {
- return fmt.Errorf("cannot assign integration %q to operator:
integration not found", name)
- }
-
- it.SetOperatorID(operator)
- return TestClient(t).Update(ctx, it)
-}
-
func Annotations(object metav1.Object) map[string]string {
return object.GetAnnotations()
}
@@ -1033,16 +1014,6 @@ func ScalePipe(t *testing.T, ctx context.Context, ns
string, name string, replic
})
}
-func AssignPipeToOperator(t *testing.T, ctx context.Context, ns, name,
operator string) error {
- klb := Pipe(t, ctx, ns, name)()
- if klb == nil {
- return fmt.Errorf("cannot assign Pipe %q to operator:Pipe not
found", name)
- }
-
- klb.SetOperatorID(operator)
- return TestClient(t).Update(ctx, klb)
-}
-
type KitFilter interface {
Match(*v1.IntegrationKit) bool
}
@@ -1771,10 +1742,6 @@ func ScaleOperator(t *testing.T, ctx context.Context, ns
string, replicas int32)
}
func CreateKamelet(t *testing.T, ctx context.Context, ns string, name string,
template map[string]interface{}, properties map[string]v1.JSONSchemaProp,
labels map[string]string) func() error {
- return CreateKameletWithID(t, platform.DefaultPlatformName, ctx, ns,
name, template, properties, labels)
-}
-
-func CreateKameletWithID(t *testing.T, operatorID string, ctx context.Context,
ns string, name string, template map[string]interface{}, properties
map[string]v1.JSONSchemaProp, labels map[string]string) func() error {
return func() error {
kamelet := v1.Kamelet{
ObjectMeta: metav1.ObjectMeta{
@@ -1792,16 +1759,11 @@ func CreateKameletWithID(t *testing.T, operatorID
string, ctx context.Context, n
},
}
- v1.SetAnnotation(&kamelet.ObjectMeta, v1.OperatorIDAnnotation,
operatorID)
return TestClient(t).Create(ctx, &kamelet)
}
}
func CreateTimerKamelet(t *testing.T, ctx context.Context, ns string, name
string) func() error {
- return CreateTimerKameletWithID(t, ctx, platform.DefaultPlatformName,
ns, name)
-}
-
-func CreateTimerKameletWithID(t *testing.T, ctx context.Context, operatorID
string, ns string, name string) func() error {
props := map[string]v1.JSONSchemaProp{
"message": {
Type: "string",
@@ -1824,7 +1786,7 @@ func CreateTimerKameletWithID(t *testing.T, ctx
context.Context, operatorID stri
},
}
- return CreateKameletWithID(t, operatorID, ctx, ns, name, flow, props,
nil)
+ return CreateKamelet(t, ctx, ns, name, flow, props, nil)
}
func asTemplate(t *testing.T, source map[string]interface{}) *v1.Template {
diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go
index da3cb9572..1e7f2aa68 100644
--- a/e2e/support/test_util.go
+++ b/e2e/support/test_util.go
@@ -68,19 +68,15 @@ 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, "", false, 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, global bool, envs map[string]string) {
+func InstallOperatorWithConf(t *testing.T, ctx context.Context, g *WithT, ns
string, global bool, envs map[string]string) {
lock.Lock()
defer lock.Unlock()
args := []string{fmt.Sprintf("NAMESPACE=%s", ns)}
- if operatorID != "" {
- fmt.Printf("Setting operator ID property as %s\n", operatorID)
- args = append(args, fmt.Sprintf("OPERATOR_ID=%s", operatorID))
- }
if envs != nil {
envArgs := make([]string, len(envs))
for k, v := range envs {
diff --git a/pkg/apis/camel/v1/camelcatalog_types_support.go
b/pkg/apis/camel/v1/camelcatalog_types_support.go
index 3ca23c354..8f451aa3c 100644
--- a/pkg/apis/camel/v1/camelcatalog_types_support.go
+++ b/pkg/apis/camel/v1/camelcatalog_types_support.go
@@ -53,16 +53,6 @@ func NewCamelCatalogList() CamelCatalogList {
}
}
-// GetOperatorID returns the operator id as an annotation.
-func (c *CamelCatalog) GetOperatorID() string {
- return GetAnnotation(OperatorIDAnnotation, c)
-}
-
-// SetOperatorID sets the given operator id as an annotation.
-func (c *CamelCatalog) SetOperatorID(operatorID string) {
- SetAnnotation(&c.ObjectMeta, OperatorIDAnnotation, operatorID)
-}
-
// GetType --.
func (c *CamelCatalogCondition) GetType() string {
return string(c.Type)
diff --git a/pkg/apis/camel/v1/common_types.go
b/pkg/apis/camel/v1/common_types.go
index 265b19b50..ab7edef8d 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -24,12 +24,6 @@ import (
)
const (
- // OperatorIDAnnotation operator id annotation label.
- //
- // Deprecated: will be removed in the future.
- OperatorIDAnnotation = "camel.apache.org/operator.id"
- // PlatformSelectorAnnotation platform id annotation label.
- PlatformSelectorAnnotation = "camel.apache.org/platform.id"
// IntegrationProfileAnnotation integration profile id annotation label.
IntegrationProfileAnnotation = "camel.apache.org/integration-profile.id"
// IntegrationProfileNamespaceAnnotation integration profile namespace
annotation label.
diff --git a/pkg/apis/camel/v1/common_types_support.go
b/pkg/apis/camel/v1/common_types_support.go
index 9b3a6e61e..1438938f2 100644
--- a/pkg/apis/camel/v1/common_types_support.go
+++ b/pkg/apis/camel/v1/common_types_support.go
@@ -161,11 +161,6 @@ func (m *RawMessage) String() string {
var _ json.Marshaler = (*RawMessage)(nil)
var _ json.Unmarshaler = (*RawMessage)(nil)
-// GetOperatorIDAnnotation to safely get the operator id annotation value.
-func GetOperatorIDAnnotation(obj metav1.Object) string {
- return GetAnnotation(OperatorIDAnnotation, obj)
-}
-
// GetAnnotation safely get the annotation value.
func GetAnnotation(name string, obj metav1.Object) string {
if obj == nil || obj.GetAnnotations() == nil {
diff --git a/pkg/apis/camel/v1/integration_types_support.go
b/pkg/apis/camel/v1/integration_types_support.go
index ea3a4a864..a6d7bb64c 100644
--- a/pkg/apis/camel/v1/integration_types_support.go
+++ b/pkg/apis/camel/v1/integration_types_support.go
@@ -257,16 +257,6 @@ func NewSourceSpec(name string, content string, language
Language) SourceSpec {
}
}
-// GetOperatorID returns the operator id as an annotation.
-func (in *Integration) GetOperatorID() string {
- return GetAnnotation(OperatorIDAnnotation, in)
-}
-
-// SetOperatorID sets the given operator id as an annotation.
-func (in *Integration) SetOperatorID(operatorID string) {
- SetAnnotation(&in.ObjectMeta, OperatorIDAnnotation, operatorID)
-}
-
func (in *Integration) SetIntegrationKit(kit *IntegrationKit) {
if kit == nil {
in.Status.IntegrationKit = nil
diff --git a/pkg/apis/camel/v1/integrationkit_types_support.go
b/pkg/apis/camel/v1/integrationkit_types_support.go
index 825eb730c..4dc5cf177 100644
--- a/pkg/apis/camel/v1/integrationkit_types_support.go
+++ b/pkg/apis/camel/v1/integrationkit_types_support.go
@@ -54,16 +54,6 @@ func (in *IntegrationKitSpec) Configurations()
[]ConfigurationSpec {
return in.Configuration
}
-// GetOperatorID returns the operator id as an annotation.
-func (in *IntegrationKit) GetOperatorID() string {
- return GetAnnotation(OperatorIDAnnotation, in)
-}
-
-// SetOperatorID sets the given operator id as an annotation.
-func (in *IntegrationKit) SetOperatorID(operatorID string) {
- SetAnnotation(&in.ObjectMeta, OperatorIDAnnotation, operatorID)
-}
-
func (in *IntegrationKit) Configurations() []ConfigurationSpec {
if in == nil {
return []ConfigurationSpec{}
diff --git a/pkg/apis/camel/v1/integrationprofile_types_support.go
b/pkg/apis/camel/v1/integrationprofile_types_support.go
index fe899397f..13e384beb 100644
--- a/pkg/apis/camel/v1/integrationprofile_types_support.go
+++ b/pkg/apis/camel/v1/integrationprofile_types_support.go
@@ -32,11 +32,6 @@ func NewIntegrationProfile(namespace string, name string)
IntegrationProfile {
}
}
-// SetOperatorID sets the given operator id as an annotation.
-func (in *IntegrationProfile) SetOperatorID(operatorID string) {
- SetAnnotation(&in.ObjectMeta, OperatorIDAnnotation, operatorID)
-}
-
// GetTimeout returns the specified duration or a default one.
func (b *IntegrationProfileBuildSpec) GetTimeout() metav1.Duration {
if b.Timeout == nil {
diff --git a/pkg/apis/camel/v1/pipe_types_support.go
b/pkg/apis/camel/v1/pipe_types_support.go
index d56626196..ce31ed8d5 100644
--- a/pkg/apis/camel/v1/pipe_types_support.go
+++ b/pkg/apis/camel/v1/pipe_types_support.go
@@ -66,11 +66,6 @@ func (c *PipeCondition) GetMessage() string {
return c.Message
}
-// SetOperatorID sets the given operator id as an annotation.
-func (in *Pipe) SetOperatorID(operatorID string) {
- SetAnnotation(&in.ObjectMeta, OperatorIDAnnotation, operatorID)
-}
-
// SetTraits add the Trait specification to the Pipe.
func (in *Pipe) SetTraits(traits *Traits) {
in.Spec.Traits = traits
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index 72165c432..4f2be292f 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -61,7 +61,6 @@ func newCmdBind(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *bindCmdOptions
cmd.Flags().Bool("skip-checks", false, "Do not verify the binding for
compliance with Kamelets and other Kubernetes resources")
cmd.Flags().StringArray("step", nil, `Add binding steps as Kubernetes
resources. Endpoints are expected in the format
"[[apigroup/]version:]kind:[namespace/]name", plain Camel URIs or Kamelet
name.`)
cmd.Flags().StringArrayP("trait", "t", nil, `Add a trait to the
corresponding Integration.`)
- cmd.Flags().StringP("operator-id", "x", "", "Deprecated. Operator id
selected to manage this Pipe.")
cmd.Flags().StringArray("annotation", nil, "Add an annotation to the
Pipe. E.g. \"--annotation my.company=hello\"")
cmd.Flags().String("service-account", "", "The SA to use to run this
binding")
cmd.Flags().StringArrayP("dependency", "d", nil, `A dependency that
should be included, e.g., "camel:mail" for a Camel component,
"mvn:org.my:app:1.0" for a Maven dependency`)
@@ -86,7 +85,6 @@ type bindCmdOptions struct {
SkipChecks bool `mapstructure:"skip-checks"
yaml:",omitempty"`
Steps []string `mapstructure:"steps"
yaml:",omitempty"`
Traits []string `mapstructure:"traits"
yaml:",omitempty"`
- OperatorID string `mapstructure:"operator-id"
yaml:",omitempty"`
Annotations []string `mapstructure:"annotations"
yaml:",omitempty"`
ServiceAccount string `mapstructure:"service-account"
yaml:",omitempty"`
Dependencies []string `mapstructure:"dependencies"
yaml:",omitempty"`
@@ -237,11 +235,6 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args
[]string) error {
pipe.Spec.ServiceAccountName = o.ServiceAccount
}
- // --operator-id={id} is a syntax sugar for '--annotation
camel.apache.org/operator.id={id}'
- if o.OperatorID != "" {
- pipe.SetOperatorID(strings.TrimSpace(o.OperatorID))
- }
-
if o.Annotations != nil {
if pipe.Annotations == nil {
pipe.Annotations = map[string]string{}
diff --git a/pkg/cmd/promote.go b/pkg/cmd/promote.go
index 0e622a175..8f9717be2 100644
--- a/pkg/cmd/promote.go
+++ b/pkg/cmd/promote.go
@@ -45,7 +45,6 @@ func newCmdPromote(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *promoteCmdO
}
cmd.Flags().String("to", "", "The namespace where to promote the
Integration/Pipe")
- cmd.Flags().StringP("to-operator", "x", "", "The operator id which will
reconcile the promoted Integration/Pipe")
cmd.Flags().StringP("output", "o", "", "Output format. One of:
json|yaml")
cmd.Flags().BoolP("image", "i", false, "Output the container image
only")
cmd.Flags().String("export-gitops-dir", "", "Export to a Kustomize
GitOps overlay structure")
@@ -58,7 +57,6 @@ type promoteCmdOptions struct {
*RootCmdOptions
To string `mapstructure:"to" yaml:",omitempty"`
- ToOperator string `mapstructure:"to-operator" yaml:",omitempty"`
OutputFormat string `mapstructure:"output" yaml:",omitempty"`
Image bool `mapstructure:"image" yaml:",omitempty"`
ToGitOpsDir string `mapstructure:"export-gitops-dir" yaml:",omitempty"`
@@ -122,7 +120,7 @@ func (o *promoteCmdOptions) run(cmd *cobra.Command, args
[]string) error {
// Pipe promotion
if promotePipe {
- destPipe := util.EditPipe(sourcePipe, sourceIntegration,
sourceKit, o.To, o.ToOperator)
+ destPipe := util.EditPipe(sourcePipe, sourceIntegration,
sourceKit, o.To)
if o.OutputFormat != "" {
return showPipeOutput(cmd, destPipe, o.OutputFormat,
c.GetScheme())
}
@@ -149,7 +147,7 @@ func (o *promoteCmdOptions) run(cmd *cobra.Command, args
[]string) error {
}
// Plain Integration promotion
- destIntegration := util.EditIntegration(sourceIntegration, sourceKit,
o.To, o.ToOperator)
+ destIntegration := util.EditIntegration(sourceIntegration, sourceKit,
o.To)
if o.OutputFormat != "" {
return showIntegrationOutput(cmd, destIntegration,
o.OutputFormat)
}
diff --git a/pkg/cmd/promote_test.go b/pkg/cmd/promote_test.go
index 522ec5ab1..31514df59 100644
--- a/pkg/cmd/promote_test.go
+++ b/pkg/cmd/promote_test.go
@@ -240,60 +240,6 @@ func TestPipeImageOnly(t *testing.T) {
assert.Equal(t, "my-special-image\n", output)
}
-func TestIntegrationToOperatorId(t *testing.T) {
- defaultIntegration, defaultKit := nominalIntegration("my-it-test")
- srcCatalog := createTestCamelCatalog("default",
v1.RuntimeProviderQuarkus, defaults.DefaultRuntimeVersion)
- dstCatalog := createTestCamelCatalog("prod-namespace",
v1.RuntimeProviderQuarkus, defaults.DefaultRuntimeVersion)
-
- // Verify default (missing) operator Id
- promoteCmdOptions, promoteCmd, _ := initializePromoteCmdOptions(t,
&defaultIntegration, &defaultKit, &srcCatalog, &dstCatalog)
- output, err := ExecuteCommand(promoteCmd, cmdPromote, "my-it-test",
"-x", "my-prod-operator", "-o", "yaml", "--to", "prod")
- assert.Equal(t, "yaml", promoteCmdOptions.OutputFormat)
- require.NoError(t, err)
- assert.Equal(t, `apiVersion: camel.apache.org/v1
-kind: Integration
-metadata:
- annotations:
- camel.apache.org/operator.id: my-prod-operator
- name: my-it-test
- namespace: prod
-spec:
- traits:
- camel:
- runtimeVersion: 1.2.3
- container:
- image: my-special-image
- jvm:
- classpath: /path/to/artifact-1/*:/path/to/artifact-2/*
-status: {}
-`, output)
- // Verify also when the operator Id is set in the integration
- defaultIntegration.Annotations = map[string]string{
- "camel.apache.org/operator.id": "camel-k",
- }
- promoteCmdOptions, promoteCmd, _ = initializePromoteCmdOptions(t,
&defaultIntegration, &defaultKit, &srcCatalog, &dstCatalog)
- output, err = ExecuteCommand(promoteCmd, cmdPromote, "my-it-test",
"-x", "my-prod-operator", "-o", "yaml", "--to", "prod")
- assert.Equal(t, "yaml", promoteCmdOptions.OutputFormat)
- require.NoError(t, err)
- assert.Equal(t, `apiVersion: camel.apache.org/v1
-kind: Integration
-metadata:
- annotations:
- camel.apache.org/operator.id: my-prod-operator
- name: my-it-test
- namespace: prod
-spec:
- traits:
- camel:
- runtimeVersion: 1.2.3
- container:
- image: my-special-image
- jvm:
- classpath: /path/to/artifact-1/*:/path/to/artifact-2/*
-status: {}
-`, output)
-}
-
func TestIntegrationWithSavedTraitsDryRun(t *testing.T) {
defaultIntegration, defaultKit := nominalIntegration("my-it-test")
defaultIntegration.Status.Traits = &v1.Traits{
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index b3ae9931e..b32f42f72 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -91,7 +91,6 @@ func newCmdRun(rootCmdOptions *RootCmdOptions)
(*cobra.Command, *runCmdOptions)
cmd.Flags().StringArray("maven-repository", nil, "Add a maven
repository")
cmd.Flags().Bool("logs", false, "Print integration logs")
cmd.Flags().Bool("use-flows", true, "Write yaml sources as Flow objects
in the integration custom resource")
- cmd.Flags().StringP("operator-id", "x", "", "Operator id selected to
manage this integration.")
cmd.Flags().String("profile", "", "Trait profile used for deployment")
cmd.Flags().String("integration-profile", "", "Integration profile used
for deployment")
cmd.Flags().StringArrayP("trait", "t", nil, "Configure a trait. E.g.
\"-t service.enabled=false\"")
@@ -137,7 +136,6 @@ type runCmdOptions struct {
GitPath string `mapstructure:"git-path"
yaml:",omitempty"`
Profile string `mapstructure:"profile"
yaml:",omitempty"`
IntegrationProfile string `mapstructure:"integration-profile"
yaml:",omitempty"`
- OperatorID string `mapstructure:"operator-id"
yaml:",omitempty"`
OutputFormat string `mapstructure:"output"
yaml:",omitempty"`
// Deprecated: won't be supported in the future
PodTemplate string `mapstructure:"pod-template"
yaml:",omitempty"`
@@ -599,11 +597,6 @@ func (o *runCmdOptions) applyAnnotations(it
*v1.Integration) {
it.Annotations = make(map[string]string)
}
- // --operator-id={id} is a syntax sugar for '--annotation
camel.apache.org/operator.id={id}'
- if o.OperatorID != "" {
- it.SetOperatorID(strings.TrimSpace(o.OperatorID))
- }
-
// --integration-profile={id} is a syntax sugar for '--annotation
camel.apache.org/integration-profile.id={id}'
if o.IntegrationProfile != "" {
v1.SetAnnotation(&it.ObjectMeta,
v1.IntegrationProfileAnnotation, o.IntegrationProfile)
diff --git a/pkg/controller/build/build_controller.go
b/pkg/controller/build/build_controller.go
index fcfdec74e..24411d31c 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -139,13 +139,6 @@ func (r *reconcileBuild) Reconcile(ctx context.Context,
request reconcile.Reques
return reconcile.Result{}, err
}
- // Only process resources assigned to the operator
- if !platform.IsOperatorHandlerConsideringLock(ctx, r.client,
request.Namespace, &instance) {
- rlog.Info("Ignoring request because resource is not assigned to
current operator")
-
- return reconcile.Result{}, nil
- }
-
target := instance.DeepCopy()
targetLog := rlog.ForBuild(target)
diff --git a/pkg/controller/catalog/catalog_controller.go
b/pkg/controller/catalog/catalog_controller.go
index a8a3aa0d8..2fbe00392 100644
--- a/pkg/controller/catalog/catalog_controller.go
+++ b/pkg/controller/catalog/catalog_controller.go
@@ -143,13 +143,6 @@ func (r *reconcileCatalog) Reconcile(ctx context.Context,
request reconcile.Requ
return reconcile.Result{}, err
}
- // Only process resources assigned to the operator
- if !platform.IsOperatorHandlerConsideringLock(ctx, r.client,
request.Namespace, &instance) {
- rlog.Info("Ignoring request because resource is not assigned to
current operator")
-
- return reconcile.Result{}, nil
- }
-
var targetPhase v1.CamelCatalogPhase
target := instance.DeepCopy()
diff --git a/pkg/controller/integration/build.go
b/pkg/controller/integration/build.go
index fe700d043..24bad1f32 100644
--- a/pkg/controller/integration/build.go
+++ b/pkg/controller/integration/build.go
@@ -22,8 +22,6 @@ import (
"fmt"
"strings"
- "github.com/apache/camel-k/v2/pkg/util/defaults"
-
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
@@ -97,13 +95,6 @@ func (action *buildAction) createBuild(ctx context.Context,
it *v1.Integration)
labels := kubernetes.FilterCamelCreatorLabels(it.Labels)
annotations := make(map[string]string)
-
- operatorID := defaults.OperatorID()
- if operatorID != "" {
- //nolint:staticcheck
- annotations[v1.OperatorIDAnnotation] = operatorID
- }
-
timeout := env.Platform.BuildTimeout
// We may need to change certain builder configuration values
diff --git a/pkg/controller/integration/integration_controller.go
b/pkg/controller/integration/integration_controller.go
index f02e62748..9f2cf866b 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -421,13 +421,6 @@ func (r *reconcileIntegration) Reconcile(ctx
context.Context, request reconcile.
return reconcile.Result{}, err
}
- // Only process resources assigned to the operator
- if !platform.IsOperatorHandlerConsideringLock(ctx, r.client,
request.Namespace, &instance) {
- rlog.Info("Ignoring request because resource is not assigned to
current operator")
-
- return reconcile.Result{}, nil
- }
-
target := instance.DeepCopy()
targetLog := rlog.ForIntegration(target)
diff --git a/pkg/controller/integration/monitor.go
b/pkg/controller/integration/monitor.go
index 024f8e342..b81ba0ef4 100644
--- a/pkg/controller/integration/monitor.go
+++ b/pkg/controller/integration/monitor.go
@@ -240,13 +240,6 @@ func isIntegrationKitResetRequired(integration
*v1.Integration, kit *v1.Integrat
return false
}
- if v1.GetOperatorIDAnnotation(integration) != "" &&
- v1.GetOperatorIDAnnotation(integration) !=
v1.GetOperatorIDAnnotation(kit) {
- // Operator to reconcile the integration has changed. Reset
integration kit
- // so new operator can handle the kit reference
- return true
- }
-
if kubernetes.GetIntegrationProfileResource(integration) != "" &&
kubernetes.GetIntegrationProfileResource(integration) !=
kubernetes.GetIntegrationProfileResource(kit) {
// Integration profile for the integration has changed. Reset
integration kit
diff --git a/pkg/controller/integrationkit/build.go
b/pkg/controller/integrationkit/build.go
index f4403ebff..dc2b830f1 100644
--- a/pkg/controller/integrationkit/build.go
+++ b/pkg/controller/integrationkit/build.go
@@ -24,7 +24,6 @@ import (
"strings"
"time"
- "github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/log"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
@@ -113,9 +112,6 @@ func (action *buildAction) createBuild(ctx context.Context,
kit *v1.IntegrationK
labels[v1.IntegrationKitLayoutLabel] =
kit.Labels[v1.IntegrationKitLayoutLabel]
annotations := make(map[string]string)
- if v, ok := kit.Annotations[v1.PlatformSelectorAnnotation]; ok {
- annotations[v1.PlatformSelectorAnnotation] = v
- }
if v, ok := kit.Annotations[v1.IntegrationProfileAnnotation]; ok {
annotations[v1.IntegrationProfileAnnotation] = v
@@ -124,12 +120,6 @@ func (action *buildAction) createBuild(ctx
context.Context, kit *v1.IntegrationK
annotations[v1.IntegrationProfileNamespaceAnnotation] = v
}
- operatorID := defaults.OperatorID()
- if operatorID != "" {
- //nolint:staticcheck
- annotations[v1.OperatorIDAnnotation] = operatorID
- }
-
buildConfig := v1.ConfigurationTasksByName(env.Pipeline, "builder")
if buildConfig.IsEmpty() {
// default to IntegrationPlatform configuration
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go
b/pkg/controller/integrationkit/integrationkit_controller.go
index 724fff464..aeea87ac4 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -178,13 +178,6 @@ func (r *reconcileIntegrationKit) Reconcile(ctx
context.Context, request reconci
return reconcile.Result{}, err
}
- // Only process resources assigned to the operator
- if !platform.IsOperatorHandlerConsideringLock(ctx, r.client,
request.Namespace, &instance) {
- rlog.Info("Ignoring request because resource is not assigned to
current operator")
-
- return reconcile.Result{}, nil
- }
-
target := instance.DeepCopy()
targetLog := rlog.ForIntegrationKit(target)
diff --git a/pkg/controller/pipe/monitor.go b/pkg/controller/pipe/monitor.go
index f706f6669..ec3d06e7d 100644
--- a/pkg/controller/pipe/monitor.go
+++ b/pkg/controller/pipe/monitor.go
@@ -66,9 +66,6 @@ func (action *monitorAction) Handle(ctx context.Context, pipe
*v1.Pipe) (*v1.Pip
return nil, fmt.Errorf("could not load integration for Pipe %q:
%w", pipe.Name, err)
}
- operatorIDChanged := v1.GetOperatorIDAnnotation(pipe) != "" &&
- (v1.GetOperatorIDAnnotation(pipe) !=
v1.GetOperatorIDAnnotation(&it))
-
integrationProfileChanged :=
kubernetes.GetIntegrationProfileResource(pipe) != "" &&
(kubernetes.GetIntegrationProfileResource(pipe) !=
kubernetes.GetIntegrationProfileResource(&it))
@@ -92,11 +89,10 @@ func (action *monitorAction) Handle(ctx context.Context,
pipe *v1.Pipe) (*v1.Pip
semanticEquality := equality.Semantic.DeepDerivative(expected.Spec,
it.Spec)
- if !semanticEquality || operatorIDChanged || integrationProfileChanged
|| !sameTraits {
+ if !semanticEquality || integrationProfileChanged || !sameTraits {
action.L.Info(
"Pipe needs a rebuild",
"semantic-equality", !semanticEquality,
- "operatorid-changed", operatorIDChanged,
"integration-profile-changed",
integrationProfileChanged,
"traits-changed", !sameTraits)
diff --git a/pkg/controller/pipe/pipe_controller.go
b/pkg/controller/pipe/pipe_controller.go
index 958f36109..8c98f4e5e 100644
--- a/pkg/controller/pipe/pipe_controller.go
+++ b/pkg/controller/pipe/pipe_controller.go
@@ -176,13 +176,6 @@ func (r *ReconcilePipe) Reconcile(ctx context.Context,
request reconcile.Request
return reconcile.Result{}, err
}
- // Only process resources assigned to the operator
- if !platform.IsOperatorHandlerConsideringLock(ctx, r.client,
request.Namespace, &instance) {
- rlog.Info("Ignoring request because resource is not assigned to
current operator")
-
- return reconcile.Result{}, nil
- }
-
var err error
target := instance.DeepCopy()
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 3a8c14e6c..532bd8cb9 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -23,7 +23,6 @@ import (
)
const (
- DefaultPlatformName = "camel-k"
DefaultBuildTimeout = 5 * time.Minute
DefaultMavenCLIOptions =
"-V,--no-transfer-progress,-Dstyle.color=never"
DefaultMaxRunningBuildsPodStrategy = 10
diff --git a/pkg/platform/operator.go b/pkg/platform/operator.go
index c333fdd55..8b97e8ea4 100644
--- a/pkg/platform/operator.go
+++ b/pkg/platform/operator.go
@@ -22,7 +22,6 @@ import (
"os"
"strings"
- camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/util/defaults"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
coordination "k8s.io/api/coordination/v1"
@@ -119,56 +118,7 @@ func IsOperatorAllowedOnNamespace(ctx context.Context, c
ctrl.Reader, namespace
return !alreadyOwned, nil
}
-// IsOperatorHandler checks on resource operator id annotation and this
operator instance id.
-// Operators matching the annotation operator id are allowed to reconcile.
-// For legacy resources that are missing a proper operator id annotation the
default global operator or the local
-// operator in this namespace are candidates for reconciliation.
-func IsOperatorHandler(object ctrl.Object) bool {
- if object == nil {
- return true
- }
- resourceID := camelv1.GetOperatorIDAnnotation(object)
- operatorID := defaults.OperatorID()
-
- // allow operator with matching id to handle the resource
- if resourceID == operatorID {
- return true
- }
-
- return resourceID == ""
-}
-
-// IsOperatorHandlerConsideringLock uses normal IsOperatorHandler checks and
adds additional check for legacy resources
-// that are missing a proper operator id annotation. In general two kind of
operators race for reconcile these legacy resources.
-// The local operator for this namespace and the default global operator
instance. Based on the existence of a namespace
-// lock the current local operator has precedence. When no lock exists the
default global operator should reconcile.
-func IsOperatorHandlerConsideringLock(ctx context.Context, c ctrl.Reader,
namespace string, object ctrl.Object) bool {
- isHandler := IsOperatorHandler(object)
- if !isHandler {
- return false
- }
-
- resourceID := camelv1.GetOperatorIDAnnotation(object)
- // add additional check on resources missing an operator id
- if resourceID == "" {
- operatorNamespace := GetOperatorNamespace()
- if operatorNamespace == namespace {
- // Global operator is allowed on its own namespace
- return true
- }
-
- if locked, err := IsNamespaceLocked(ctx, c, namespace); err !=
nil || locked {
- // namespace is locked so local operators do have
precedence
- return !IsCurrentOperatorGlobal()
- }
- }
-
- return true
-}
-
-// FilteringFuncs do preliminary checks to determine if certain events should
be handled by the controller
-// based on labels on the resources (e.g. camel.apache.org/operator.id) and
the operator configuration,
-// before handing the computation over to the user code.
+// FilteringFuncs do preliminary checks to determine if certain events should
be handled by the controller.
type FilteringFuncs[T ctrl.Object] struct {
// Create returns true if the Create event should be processed
CreateFunc func(event.TypedCreateEvent[T]) bool
@@ -184,9 +134,6 @@ type FilteringFuncs[T ctrl.Object] struct {
}
func (f FilteringFuncs[T]) Create(e event.TypedCreateEvent[T]) bool {
- if !IsOperatorHandler(e.Object) {
- return false
- }
if f.CreateFunc != nil {
return f.CreateFunc(e)
}
@@ -195,9 +142,6 @@ func (f FilteringFuncs[T]) Create(e
event.TypedCreateEvent[T]) bool {
}
func (f FilteringFuncs[T]) Delete(e event.TypedDeleteEvent[T]) bool {
- if !IsOperatorHandler(e.Object) {
- return false
- }
if f.DeleteFunc != nil {
return f.DeleteFunc(e)
}
@@ -206,13 +150,6 @@ func (f FilteringFuncs[T]) Delete(e
event.TypedDeleteEvent[T]) bool {
}
func (f FilteringFuncs[T]) Update(e event.TypedUpdateEvent[T]) bool {
- if !IsOperatorHandler(e.ObjectNew) {
- return false
- }
- if camelv1.GetOperatorIDAnnotation(e.ObjectOld) !=
camelv1.GetOperatorIDAnnotation(e.ObjectNew) {
- // Always force reconciliation when the object becomes managed
by the current operator
- return true
- }
if kubernetes.GetIntegrationProfileResource(e.ObjectOld) !=
kubernetes.GetIntegrationProfileResource(e.ObjectNew) {
// Always force reconciliation when the object gets attached to
a new integration profile
return true
@@ -225,9 +162,6 @@ func (f FilteringFuncs[T]) Update(e
event.TypedUpdateEvent[T]) bool {
}
func (f FilteringFuncs[T]) Generic(e event.TypedGenericEvent[T]) bool {
- if !IsOperatorHandler(e.Object) {
- return false
- }
if f.GenericFunc != nil {
return f.GenericFunc(e)
}
diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index 459490aa3..97497b34a 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -175,17 +175,11 @@ func (t *camelTrait) loadOrCreateCatalog(e *Environment)
error {
// provide the same setting to the catalog
operatorId := ""
if e.Integration != nil {
- if e.Integration.GetOperatorID() != "" {
- operatorId =
e.Integration.GetOperatorID()
- }
if e.Integration.Spec.Repositories != nil {
extraRepositories =
append(extraRepositories, e.Integration.Spec.Repositories...)
}
}
if e.IntegrationKit != nil {
- if e.IntegrationKit.GetOperatorID() != "" {
- operatorId =
e.IntegrationKit.GetOperatorID()
- }
if e.IntegrationKit.Spec.Repositories != nil {
extraRepositories =
append(extraRepositories, e.IntegrationKit.Spec.Repositories...)
}
diff --git a/pkg/trait/gitops.go b/pkg/trait/gitops.go
index d5eab2b93..d776c4f53 100644
--- a/pkg/trait/gitops.go
+++ b/pkg/trait/gitops.go
@@ -160,7 +160,7 @@ func (t *gitOpsTrait) pushGitOpsItInGitRepo(ctx
context.Context, it *v1.Integrat
if pipe != nil {
for _, overlay := range t.getOverlays() {
- destPipe := util.EditPipe(pipe, it, kit, overlay, "")
+ destPipe := util.EditPipe(pipe, it, kit, overlay)
err = util.AppendKustomizePipe(destPipe, ciCdDir,
t.getOverwriteOverlay())
if err != nil {
return err
@@ -168,7 +168,7 @@ func (t *gitOpsTrait) pushGitOpsItInGitRepo(ctx
context.Context, it *v1.Integrat
}
} else {
for _, overlay := range t.getOverlays() {
- destIntegration := util.EditIntegration(it, kit,
overlay, "")
+ destIntegration := util.EditIntegration(it, kit,
overlay)
err = util.AppendKustomizeIntegration(destIntegration,
ciCdDir, t.getOverwriteOverlay())
if err != nil {
return err
diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index b1c8f50d0..5808d97ce 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -269,19 +269,10 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment,
packageType quarkusPack
kubernetes.CamelCreatorLabelNamespace: integration.Namespace,
kubernetes.CamelCreatorLabelVersion:
integration.ResourceVersion,
}
-
- if v, ok := integration.Annotations[v1.PlatformSelectorAnnotation]; ok {
- v1.SetAnnotation(&kit.ObjectMeta,
v1.PlatformSelectorAnnotation, v)
- }
-
if v, ok := integration.Annotations[v1.IntegrationProfileAnnotation];
ok {
v1.SetAnnotation(&kit.ObjectMeta,
v1.IntegrationProfileAnnotation, v)
v1.SetAnnotation(&kit.ObjectMeta,
v1.IntegrationProfileNamespaceAnnotation, integration.Namespace)
}
- operatorID := defaults.OperatorID()
- if operatorID != "" {
- kit.SetOperatorID(operatorID)
- }
kit.Spec = v1.IntegrationKitSpec{
Dependencies: e.Integration.Status.Dependencies,
Repositories: e.Integration.Spec.Repositories,
diff --git a/pkg/util/camel/camel_runtime.go b/pkg/util/camel/camel_runtime.go
index 2945acb30..26d57fcf7 100644
--- a/pkg/util/camel/camel_runtime.go
+++ b/pkg/util/camel/camel_runtime.go
@@ -53,10 +53,6 @@ func CreateCatalog(
cx.Labels[kubernetes.CamelLabelRuntimeProvider] =
string(runtime.Provider)
cx.Labels["camel.apache.org/catalog.generated"] = "true"
- if operatorId != "" {
- cx.SetOperatorID(operatorId)
- }
-
if err := client.Create(ctx, &cx); err != nil {
if k8serrors.IsAlreadyExists(err) {
// It's still possible that catalog wasn't yet found at
the time of loading
diff --git a/pkg/util/digest/digest.go b/pkg/util/digest/digest.go
index 076de7fc8..202277c66 100644
--- a/pkg/util/digest/digest.go
+++ b/pkg/util/digest/digest.go
@@ -52,11 +52,6 @@ func ComputeForIntegration(integration *v1.Integration,
configmapVersions []stri
return "", err
}
- // Integration operator id is relevant
- if _, err :=
hash.Write([]byte(v1.GetOperatorIDAnnotation(integration))); err != nil {
- return "", err
- }
-
// Integration profile is relevant
if _, err :=
hash.Write([]byte(kubernetes.GetIntegrationProfileResource(integration))); err
!= nil {
return "", err
diff --git a/pkg/util/gitops/gitops.go b/pkg/util/gitops/gitops.go
index 1120f02b1..f7140000d 100644
--- a/pkg/util/gitops/gitops.go
+++ b/pkg/util/gitops/gitops.go
@@ -45,12 +45,12 @@ resources:
`
// EditIntegration is in charge to create an Integration with the content
required by the GitOps operations.
-func EditIntegration(it *v1.Integration, kit *v1.IntegrationKit, toNamespace,
toOperator string) *v1.Integration {
+func EditIntegration(it *v1.Integration, kit *v1.IntegrationKit, toNamespace
string) *v1.Integration {
contImage := it.Status.Image
// Integration
dstIt := v1.NewIntegration(toNamespace, it.Name)
dstIt.Spec = *it.Spec.DeepCopy()
- dstIt.Annotations = cloneAnnotations(it.Annotations, toOperator)
+ dstIt.Annotations = cloneAnnotations(it.Annotations)
dstIt.Labels = cloneLabels(it.Labels)
dstIt.Spec.IntegrationKit = nil
if it.Status.Traits != nil {
@@ -115,27 +115,14 @@ func getClasspathSet(cps string) *sets.Set {
return s
}
-// Return all annotations overriding the operator Id if provided.
-func cloneAnnotations(ann map[string]string, operatorID string)
map[string]string {
- operatorIDAnnotationSet := false
+// Return all annotations but
"kubectl.kubernetes.io/last-applied-configuration".
+func cloneAnnotations(ann map[string]string) map[string]string {
newMap := make(map[string]string)
for k, v := range ann {
if k == "kubectl.kubernetes.io/last-applied-configuration" {
continue
}
- //nolint:staticcheck
- if k == v1.OperatorIDAnnotation {
- if operatorID != "" {
- newMap[v1.OperatorIDAnnotation] = operatorID
- operatorIDAnnotationSet = true
- }
- } else {
- newMap[k] = v
- }
- }
- //nolint:staticcheck
- if !operatorIDAnnotationSet && operatorID != "" {
- newMap[v1.OperatorIDAnnotation] = operatorID
+ newMap[k] = v
}
return newMap
@@ -150,12 +137,12 @@ func cloneLabels(lbs map[string]string) map[string]string
{
}
// EditPipe is in charge to create a Pipe with the content required by the
GitOps operations.
-func EditPipe(kb *v1.Pipe, it *v1.Integration, kit *v1.IntegrationKit,
toNamespace, toOperator string) *v1.Pipe {
+func EditPipe(kb *v1.Pipe, it *v1.Integration, kit *v1.IntegrationKit,
toNamespace string) *v1.Pipe {
contImage := it.Status.Image
// Pipe
dst := v1.NewPipe(toNamespace, kb.Name)
dst.Spec = *kb.Spec.DeepCopy()
- dst.Annotations = cloneAnnotations(kb.Annotations, toOperator)
+ dst.Annotations = cloneAnnotations(kb.Annotations)
dst.Labels = cloneLabels(kb.Labels)
traits := it.Status.Traits
if traits == nil {
@@ -214,10 +201,6 @@ func AppendKustomizeIntegration(dstIt *v1.Integration,
destinationDir string, ov
baseIt := dstIt.DeepCopy()
baseIt.Namespace = ""
- if baseIt.Annotations != nil {
- //nolint:staticcheck
- delete(baseIt.Annotations, v1.OperatorIDAnnotation)
- }
appFolderName := strings.ToLower(baseIt.Name)
newpath := filepath.Join(destinationDir, appFolderName, "routes")
@@ -419,10 +402,6 @@ func AppendKustomizePipe(dstPipe *v1.Pipe, destinationDir
string, overwrite bool
basePipe := dstPipe.DeepCopy()
basePipe.Namespace = ""
- if basePipe.Annotations != nil {
- //nolint:staticcheck
- delete(basePipe.Annotations, v1.OperatorIDAnnotation)
- }
appFolderName := strings.ToLower(basePipe.Name)
newpath := filepath.Join(destinationDir, appFolderName, "base")