Skip to content

Handle metadata.ownerReferences #120

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
morganchristiansson opened this issue Jun 19, 2021 · 3 comments · Fixed by #140
Closed

Handle metadata.ownerReferences #120

morganchristiansson opened this issue Jun 19, 2021 · 3 comments · Fixed by #140

Comments

@morganchristiansson
Copy link

morganchristiansson commented Jun 19, 2021

Describe the bug
I have secrets decrypted by sops operator. Secrets are created with metadata.ownerReferences set to Custom Resource managing the secret.

When secret is replicated metadata.ownerReferences is copied aswell which is causing issues.

To Reproduce
Create secret with metadata.ownerReferences.

Expected behavior
The ownerReferences should be removed as replicator handles deletions internally. Alternatively ownerReferences could be used instead of built-in deletion handling.

Environment:

  • Kubernetes version: 1.19
  • kubernetes-replicator version: 2.3.0

Additional context
From reviewing replicator code it neither removes or sets ownerReferences

https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/

@martin-helmich
Copy link
Member

Indeed, ownerReferences should not be copied -- they won't work across namespaces, anyway.

I'll see if I can find the time to put some work into this at some point in the (hopefully) near future. In the meantime, PRs are of course always welcome. 🙂

@morganchristiansson
Copy link
Author

morganchristiansson commented Jul 9, 2021

So it turns out someone had created SopsSecret in both src and dest namespaces aswell as enabling replicator. So replicator and sops-operator were trying to overwrite the same dest secret.

After removing SopsSecret in target namespace the war has ended. It appears metadata.ownerReferences is not being replicated.

Thank you for entertaining my hypothesis..

@jkroepke
Copy link
Contributor

@martin-helmich

We have the same problem with secrets from strimzi kafka operator.

See also strimzi/strimzi-kafka-operator#4377

Could you please re-open this issue, since it still exists? I'm happy to see that @morganchristiansson could resolve his Problem with SopsSecrets, but the root cause still there.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants