-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
CustomResourceFluentImpl produces a shallow copy #3076
Comments
cc @iocanel |
It seems that Indeed it seems that there should be a |
CustomResource should be annotated like any other Resource (from modules different to
The list should match: Lines 41 to 50 in 4eee56e
|
@shawkins : Are you interested in submitting a fix for this issue? |
I am not yet familiar with this part of the code. It would be better if I just followed what fix was applied. |
@shawkins : I think Ioannis and Marc are saying to add explicit BuildableReference annotation for ObjectMeta: diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/CustomResource.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/CustomResource.java
index 5f078a0fe..1bb42c26a 100644
--- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/CustomResource.java
+++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/CustomResource.java
@@ -34,6 +34,8 @@ import io.fabric8.kubernetes.model.annotation.ShortNames;
import io.fabric8.kubernetes.model.annotation.Version;
import io.sundr.builder.annotations.Buildable;
import java.util.Optional;
+
+import io.sundr.builder.annotations.BuildableReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,8 +68,10 @@ import org.slf4j.LoggerFactory;
"spec",
"status"
})
-@Buildable(builderPackage = "io.fabric8.kubernetes.api.builder", editableEnabled = false)
@JsonInclude(Include.NON_NULL)
+@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
+ @BuildableReference(io.fabric8.kubernetes.api.model.ObjectMeta.class),
+})
public abstract class CustomResource<S, T> implements HasMetadata {
private static final Logger LOG = LoggerFactory.getLogger(CustomResource.class);
|
Does this also mean that anyone expecting this cloning behavior will need to add refs for spec and status classes for whatever extends CustomResource as well? |
Are you using sundrio for CustomResource builder generation? I think this |
Yes We have custom resource:
Which generates a MyResourceFluentImpl:
All of the with methods are implemented in CustomResourceFluentImpl. This change will address the metadata - but I'm not quite seeing how spec and status will work. Even if I add BuildableReference for those on MyResource, the MyResourceFluentImpl is still calling the CustomResourceFluentImpl. |
Relates to #2807. |
Captured upstream as sundrio/sundrio#248 After the pr based upon @rohanKanojia suggested change above is committed, then we can close this issue. |
#3232, closing issue as the rest should be addressed upstream (if possible). |
In the CustomResourceFluentImpl, there are methods such as:
which are invoked when a reference object is passed to the builder constructor.
In core classes the implementation looks like:
which does produce a deep copy.
The text was updated successfully, but these errors were encountered: