This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch release-2.3.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-2.3.x by this push:
     new da510cdd5 fix(ctrl): synthetic Integration cannot set 
blockOwnerDeletion
da510cdd5 is described below

commit da510cdd5fd046a2e496212adcc17b1884cbc806
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Wed May 29 10:12:17 2024 +0200

    fix(ctrl): synthetic Integration cannot set blockOwnerDeletion
    
    Because the operator may not have permissions over the Deployment resource 
finalizers
---
 pkg/controller/synthetic/synthetic.go      | 36 +++++++++++++-----------------
 pkg/controller/synthetic/synthetic_test.go | 33 +++++++++++++--------------
 2 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/pkg/controller/synthetic/synthetic.go 
b/pkg/controller/synthetic/synthetic.go
index 974a2eb05..8e66f30d9 100644
--- a/pkg/controller/synthetic/synthetic.go
+++ b/pkg/controller/synthetic/synthetic.go
@@ -40,8 +40,7 @@ import (
 )
 
 var (
-       controller         = true
-       blockOwnerDeletion = true
+       controller = true
 )
 
 // ManageSyntheticIntegrations is the controller for synthetic Integrations. 
Consider that the lifecycle of the objects are driven
@@ -206,12 +205,11 @@ func (app *nonManagedCamelDeployment) Integration() 
*v1.Integration {
        }
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         "apps/v1",
-                       Kind:               "Deployment",
-                       Name:               app.deploy.Name,
-                       UID:                app.deploy.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: "apps/v1",
+                       Kind:       "Deployment",
+                       Name:       app.deploy.Name,
+                       UID:        app.deploy.UID,
+                       Controller: &controller,
                },
        }
        it.SetOwnerReferences(references)
@@ -251,12 +249,11 @@ func (app *NonManagedCamelCronjob) Integration() 
*v1.Integration {
        }
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         "batch/v1",
-                       Kind:               "CronJob",
-                       Name:               app.cron.Name,
-                       UID:                app.cron.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: "batch/v1",
+                       Kind:       "CronJob",
+                       Name:       app.cron.Name,
+                       UID:        app.cron.UID,
+                       Controller: &controller,
                },
        }
        it.SetOwnerReferences(references)
@@ -281,12 +278,11 @@ func (app *NonManagedCamelKnativeService) Integration() 
*v1.Integration {
        }
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         
servingv1.SchemeGroupVersion.String(),
-                       Kind:               "Service",
-                       Name:               app.ksvc.Name,
-                       UID:                app.ksvc.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: servingv1.SchemeGroupVersion.String(),
+                       Kind:       "Service",
+                       Name:       app.ksvc.Name,
+                       UID:        app.ksvc.UID,
+                       Controller: &controller,
                },
        }
        it.SetOwnerReferences(references)
diff --git a/pkg/controller/synthetic/synthetic_test.go 
b/pkg/controller/synthetic/synthetic_test.go
index ad436fa37..b5beb3be3 100644
--- a/pkg/controller/synthetic/synthetic_test.go
+++ b/pkg/controller/synthetic/synthetic_test.go
@@ -118,12 +118,11 @@ func TestNonManagedDeployment(t *testing.T) {
        }
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         "apps/v1",
-                       Kind:               "Deployment",
-                       Name:               deploy.Name,
-                       UID:                deploy.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: "apps/v1",
+                       Kind:       "Deployment",
+                       Name:       deploy.Name,
+                       UID:        deploy.UID,
+                       Controller: &controller,
                },
        }
        expectedIt.SetOwnerReferences(references)
@@ -178,12 +177,11 @@ func TestNonManagedCronJob(t *testing.T) {
        })
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         "batch/v1",
-                       Kind:               "CronJob",
-                       Name:               cron.Name,
-                       UID:                cron.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: "batch/v1",
+                       Kind:       "CronJob",
+                       Name:       cron.Name,
+                       UID:        cron.UID,
+                       Controller: &controller,
                },
        }
        expectedIt.SetOwnerReferences(references)
@@ -237,12 +235,11 @@ func TestNonManagedKnativeService(t *testing.T) {
        })
        references := []metav1.OwnerReference{
                {
-                       APIVersion:         
servingv1.SchemeGroupVersion.String(),
-                       Kind:               "Service",
-                       Name:               ksvc.Name,
-                       UID:                ksvc.UID,
-                       Controller:         &controller,
-                       BlockOwnerDeletion: &blockOwnerDeletion,
+                       APIVersion: servingv1.SchemeGroupVersion.String(),
+                       Kind:       "Service",
+                       Name:       ksvc.Name,
+                       UID:        ksvc.UID,
+                       Controller: &controller,
                },
        }
        expectedIt.SetOwnerReferences(references)

Reply via email to