Skip to content

Conversation

@jkroepke
Copy link
Contributor

Fixes #120

Please advise me about common mistakes for golang. I do not have much experience into it.

@jkroepke jkroepke force-pushed the strip-owner-reference branch from 71a75be to 1e55aa9 Compare September 22, 2021 10:15
@hensur
Copy link
Member

hensur commented Sep 22, 2021

Hi @jkroepke!

Thank you for taking the first step and opening this PR :) It looks good so far and will certainly fix the reported errors. Thanks for adding docs and tests as well.

I have to say, I am not sure whether globally en-/disabling this behavior is the best solution to this problem.

I'd like to propose a different approach.
I think it would be most helpful to strip ownerReferences from replicated resources by default. This will prevent the unexpected behavior when replicating resources with an ownerReference.
This will result in a breaking change. But I think the current handling of ownerReferences might be more "breaking" for most users.

I guess there are some edge cases where it might be desired to keep the ownerReferences (namespaced dependant with a clusterscoped owner). In this case we could provide an annotation (e.g. replicator.v1.mittwald.de/keep-owner-references) which allows one to decide this for each secret to be replicated.

What do you think about this approach? I can understand if you don't want to put in the additional work, I will take a look at this in the next few days then.

@jkroepke
Copy link
Contributor Author

Hi all,

thats fine for me. I will switch from CLI flag to an annotations. That covers all cases.

@jkroepke jkroepke force-pushed the strip-owner-reference branch from 25224bf to 993cbc4 Compare September 22, 2021 13:38
@jkroepke jkroepke changed the title Implement .metadata.ownerReferences handling WIP: Implement .metadata.ownerReferences handling Sep 22, 2021
@jkroepke jkroepke force-pushed the strip-owner-reference branch 9 times, most recently from 545ae6f to e17574c Compare September 22, 2021 20:46
@jkroepke jkroepke changed the title WIP: Implement .metadata.ownerReferences handling Implement .metadata.ownerReferences handling Sep 22, 2021
@jkroepke
Copy link
Contributor Author

I'm using an annotation as toggle now. Newly tests are green. Please review. Thanks

@jkroepke
Copy link
Contributor Author

jkroepke commented Oct 6, 2021

@hensur

I hope, Is the current state in aligned with you. Do you know if you could find some time for this?

@martin-helmich
Copy link
Member

Hey all; I've just been reading up on the discussion and the proposed change and am just going to throw in my 2 cents.

From my understanding, the original suggestions by @jkmw and @hensur suggested that ownerReferences should be dropped by default (ref. #140 (comment) and #140 (comment)), with an annotation than can be set if the user explicitly wants the reference to persist.
That suggestion, even if technically a breaking change, is fine with me, 👍 since the current behaviour is unexpected and presumably not the desired behaviour in most cases anyway (expect in the most edgy of edge cases).

If I read the code correctly, the proposed change as it stands now does exactly the opposite of the suggested solution (suggested: "drop ownerReferences by default, keep if explicitly desired by anntation", actual: "keep ownerReferences by default, and only drop if explicitly desired").

@jkroepke jkroepke force-pushed the strip-owner-reference branch 4 times, most recently from a8dae34 to 7bdbf5c Compare October 11, 2021 21:11
@jkroepke
Copy link
Contributor Author

Implemented, please review.

  • Fun Fact for push based replication, ownerReference was not copy by default. I found this behavior while add a test.

@jkroepke jkroepke force-pushed the strip-owner-reference branch from 7bdbf5c to d864000 Compare October 11, 2021 22:12
Copy link
Member

@hensur hensur left a comment

Choose a reason for hiding this comment

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

Hey! Sorry for my late response.

The change looks good so far! :) Just one small nitpick.

@mittwald mittwald deleted a comment from qlty-cloud-legacy bot Oct 15, 2021
@hensur hensur merged commit 43515a5 into mittwald:master Oct 15, 2021
@hensur
Copy link
Member

hensur commented Oct 15, 2021

Thank you for the contribution! I will try to respond faster next time :)

This should be available soon as v2.7.0

@jkroepke jkroepke deleted the strip-owner-reference branch November 19, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle metadata.ownerReferences

4 participants