Skip to content

feat: throw exception on problematic owner ference adding in dependent resources #2190

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Jan 9, 2024

No description provided.

@@ -71,6 +74,30 @@ public static String getNameFor(Class<? extends Reconciler> reconcilerClass) {
return getDefaultNameFor(reconcilerClass);
}

public static void checkIfCanAddOwnerReference(HasMetadata owner, HasMetadata resource) {
if (owner instanceof GenericKubernetesResource
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should move this code to the Fabric8 client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, so I would merge this, and will work on that to move it to fabri8 client.
If also @manusa @shawkins thinks it a good idea. Not sure if we should add it as part of an utility, or just simply to .addOwnerReference or both.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add it to addOwnerReference, personally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, me too

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be part of HasMetadata#addOwnerReference.

The other suggested alternative would involve exposing the validation method and then calling that method within addOwnerReference too. I don't really see the value of exposing that method.

@csviri csviri merged commit dfd0e8a into next Jan 9, 2024
@csviri csviri deleted the dr-different-ns branch January 9, 2024 15:34
csviri added a commit that referenced this pull request Jan 10, 2024
csviri added a commit that referenced this pull request Jan 10, 2024
csviri added a commit that referenced this pull request Jan 10, 2024
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.

Better notify user if dependent desired uses garbage collection but target namespace is not same as owner
3 participants