Skip to content

Feat: enable owner references#2688

Merged
FxKu merged 31 commits into
masterfrom
mbegenau-feat-498-ownerReferences
Aug 9, 2024
Merged

Feat: enable owner references#2688
FxKu merged 31 commits into
masterfrom
mbegenau-feat-498-ownerReferences

Conversation

@FxKu

@FxKu FxKu commented Jul 8, 2024

Copy link
Copy Markdown
Contributor

This a follow up to #2199 with some greater changes. The most important part of owner references is the cascaded removal of child resources which bypasses the delete protection offered by our operator.

Quick reminder about delete protection: this checks pre-defined annotations before calling delete code but cannot block the actual kubectl delete call itself. This you could only achieve with a K8s admission controller which, for example, does the same annotation checks.

We use the latter at Zalando, but some folks out there might rely on the protection by the operator. Therefore, we should not enable owner references by default but make it configurable.

#2199 also lacked code to update existing resources once you start using owner references or vice versa remove them. Like with the recently added annotation inheritance, this produced many code extensions. I’ve also found some oversights from #2657 which I’ve fixed along the way. All owner references syncs are done with Update API calls, which requires extending the RBAC.

A new e2e test is added which tests syncing owner references in both directions and deleting the acid-test-cluster cascadingly which was previously done in the multi namespace test. Some unit test were extended, too.

closes #2199
fixes #498

@FxKu FxKu added this to the 1.13.0 milestone Jul 8, 2024
@FxKu
FxKu marked this pull request as draft July 8, 2024 14:20
@FxKu FxKu changed the title Mbegenau feat 498 owner references Feat: enable owner references Jul 18, 2024
Comment thread manifests/operatorconfiguration.crd.yaml Outdated
@fm2022aa

Copy link
Copy Markdown

great

@FxKu
FxKu marked this pull request as ready for review July 22, 2024 07:47
@FxKu FxKu added the minor label Jul 29, 2024

@hughcapet hughcapet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need OwnerReferences on logical backup jobs?

Comment thread pkg/cluster/sync.go

if !reflect.DeepEqual(secret.ObjectMeta.OwnerReferences, generatedSecret.ObjectMeta.OwnerReferences) {
updateSecret = true
updateSecretMsg = fmt.Sprintf("secret %s owner references do not match the current ones", secretName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am wondering, shouldn't we concatenate all the update msgs instead of re-assigning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other cases are mutual exclusive to one another. This line here is the only case that might happen additionally. But given that enabling owner references is probably a one time operation, I don't think it's worth to add more logic.

Comment thread pkg/cluster/sync.go Outdated
Comment thread pkg/cluster/cluster.go Outdated
@hughcapet

Copy link
Copy Markdown
Contributor

👍

1 similar comment
@FxKu

FxKu commented Aug 9, 2024

Copy link
Copy Markdown
Contributor Author

👍

@FxKu
FxKu merged commit a87307e into master Aug 9, 2024
@FxKu
FxKu deleted the mbegenau-feat-498-ownerReferences branch August 9, 2024 15:58
@barthy1

barthy1 commented Aug 16, 2024

Copy link
Copy Markdown

Thank you for this great work!
When this feature is going to be released?

@holgerson97

Copy link
Copy Markdown

Thank you for this great work! When this feature is going to be released?

@barthy1 it's already in 1.13.0 and I am testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add ownerReference to managed entities

6 participants