-
Notifications
You must be signed in to change notification settings - Fork 220
Controller name as finalizer by default #223
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
Controller name as finalizer by default #223
Conversation
operator-framework/src/main/java/io/javaoperatorsdk/operator/api/ResourceController.java
Outdated
Show resolved
Hide resolved
@@ -28,4 +28,10 @@ | |||
*/ | |||
UpdateControl<R> createOrUpdateResource(R resource, Context<R> context); | |||
|
|||
// What about we let developer to set the finalizer Name through overriding | |||
// this method rather than setting it as attribute in annotation? | |||
default String getDefaultFinalizerName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several places in the code finalizer references are named defaultFinalzer
. Any objection to renaming them all to finalizer
? I suppose they are indeed referring to the finalizer and not the default one.
e.g.
Several spots in this file:
https://github.com/java-operator-sdk/java-operator-sdk/blob/master/operator-framework/src/main/java/io/javaoperatorsdk/operator/processing/EventDispatcher.java#L24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.. sounds like we're calling everything defaultFinalizer even though we just mean the finalizer. This is actually confusing as there a thing called the default finalizer name. @csviri can you confirm we're seeing this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the default finalizer to finalizer or similar everywhere in docs, logs and code for now.
LMK if you have any objection/thoughts about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psycho-ir looks good, yep it jus tfinalizer in most of the cases not default finalizer.
I don't think we should use default method in the interface however. Would stick to the annotation to override the finalizer name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I have removed this method already.
Some of Integration tests are failing due to the long finalized name. i.e ->
We can either truncate the package name or add validation on the |
How about not putting the package name in the finalizer at all? |
It may result in conflict. What I also found risky about using the class name is that refactoring the code may cause unintended different finalizer name. What about using the |
Good thinking, CRD name is better. If that changes than you really need to think about migration strategy anyway. Do we need to add |
I had a look into a few finalizers and didn't any de facto in naming conventions.
|
I picked |
I'll give this a test today and merge if it's alright |
This is actually incorrect according to the spec: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#finalizers where a custom finalizer is supposed to be Note also that #229 uses the |
Good catch! so I'll go with |
Added the |
LGTM! |
@psycho-ir do you recall which test failed if the name was too long? The problem with using the CRD name is that, while the group should usually be a valid domain name, it doesn't appear to be mandatory. This is causing issues still with the k8s client 5.0 upgrade. I've opened an issue for this: #233 |
closes #57
closes #218