Skip to content

Commit

Permalink
fix(ctrl): synthetic Integration cannot set blockOwnerDeletion
Browse files Browse the repository at this point in the history
Because the operator may not have permissions over the Deployment resource finalizers
  • Loading branch information
squakez committed May 30, 2024
1 parent 264c343 commit da510cd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 38 deletions.
36 changes: 16 additions & 20 deletions pkg/controller/synthetic/synthetic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
33 changes: 15 additions & 18 deletions pkg/controller/synthetic/synthetic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit da510cd

Please sign in to comment.