You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2024/05/29 15:05:32 UTC

(camel-k) branch main updated: fix(ctrl): synthetic Integration cannot set blockOwnerDeletion

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

pcongiusti 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 e8c38143a fix(ctrl): synthetic Integration cannot set blockOwnerDeletion
e8c38143a is described below

commit e8c38143ab017a4d7f5e27aba0071e7d96e20c35
Author: Pasquale Congiusti <pa...@gmail.com>
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)