Comments (10)
Hey @iocanel ! Sorry for the slow response, at the moment I'm pretty busy too 🙁
To help this issue move forward what I can commit to do is to try to apply the experimental Maven Plugin: https://github.com/andreaTP/poc-class-dedup
to your kubevirt
project with an "allowList" for classes to be deduplicated.
This way, we can start experimenting with the feature on a real-world use-case.
Thoughts?
from kubernetes-client.
Hi @iocanel , and thanks for opening this super interesting discussion.
I have been tinkering around those things for a while, but couldn't get convinced about one possible implementation and ended up delaying it, thanks for bumping it up!
The big show-stopper for me has been forward compatibility, imagine the following scenario.
V1:
class1
->class1.metadata1
class2
->class2.metadata2
the 2 metadata fields are identical and we squash them into one object, so it becomes:class1
->root.metadata
class2
->root.metadata
This is nice from the deduplication POV, code size etc. etc.
But we don't have control over the shape of metadata, as it's defined by the user, and, for the next V1 release they can add a field to metadata2
and not to metadata1
which is a fair non-breaking change.
Unfortunately, we end up being unable to "refactor" the metadata classes, causing a breaking generated code change (package names etc. etc.).
Your proposal is interesting, as it means that the user is still in control of "what to reuse", although it potentially has the same drawback explained above.
For completeness, at some point, I have prototyped a Maven plugin to do the refactoring as a separate step:
https://github.com/andreaTP/poc-class-dedup
Not sure if it still works ... but a more "configurable" and generic version of it might provide the functionality.
wdyt?
from kubernetes-client.
More thoughts ...
I think that the are three kinds of duplicates:
- core kubernetes types
- cross apiVersion
- cross apiGroup (but not core).
The simplest case to deal with is 2 as in most cases we want no reuse.
What in comes to types coming from the core kubernetes model (case 1), we could possibly reuse them, as we already do with the buildable references (we use a curated list classes that we consider reusable).
Which brings us down to cross apiGroup (case 3) and beyond the known core model classes. I think that the safest thing to do is to do nothing out of the box but provide users with the ability to define what is meant to be reused via configuration.
from kubernetes-client.
What in comes to types coming from the core kubernetes model (case 1), we could possibly reuse them, as we already do with the buildable references (we use a curated list classes that we consider reusable).
This is interesting, as it's valid reasoning, but based on assumptions.
More often than not the CRD is generated by something like kubebuilder
and we don't have any guarantee that the object "backing" the Json schema is the "core Kuberentes type" or a slightly modified version of it, or even something completely different but with a matching shape.
I like the idea of leaving this decision to the user though, and this is probably the deal-breaker for implementing this feature.
from kubernetes-client.
I think that when it comes to core types, it safe enough to assume that if name (e.g. metadata) matches and shape matches then reuse. I really doubt that anyone would replicate them and not reuse them instead. Again, I am not talking about any type, but a handpicked set (like we do for BuildableReferences). As long as there is a way for the user to override our defaults I think it should be fine.
from kubernetes-client.
I'm adding an example I'm aware of: https://github.com/Apicurio/apicurio-registry-operator/blob/94d81decf63b5692bde34a35d8a612caff43933f/api/v1/apicurioregistry_types.go#L291
But I agree with your reasoning @iocanel , I think that the question becomes, should we embed this functionality in the java-generator
itself or try a different approach with an additional plugin?
from kubernetes-client.
But I agree with your reasoning @iocanel , I think that the question becomes, should we embed this functionality in the
java-generator
itself or try a different approach with an additional plugin?
I think it needs to be in the java-generator
else we won't be able to use the contextual info.
from kubernetes-client.
we won't be able to use the contextual info
I think that we need only class names and shapes, and configuring it with the "original" kubernetes yaml
/json
seems appealing. That said, are you gonna take a stab at it?
from kubernetes-client.
I think that we need only class names and shapes, and configuring it with the "original" kubernetes
yaml
/json
seems appealing. That said, are you gonna take a stab at it?
Unfortunately, I don't have the time needed.
from kubernetes-client.
Something interesting I encountered while playing with kubevirt. I have 17 different implementations for Secret
. Not sure if all of them could be replaced by upstream Secret, but my guess is that they could.
from kubernetes-client.
Related Issues (20)
- Consider splitting OpenShift Client module (GraalVM performance) HOT 2
- What is the reason for this problem “io.fabric8.kubernetes.client.KubernetesClientException: Failure executing“ HOT 3
- Upload file/dir to pod does not work in GKE HOT 17
- Align CRD generator behavior with Jackson HOT 6
- java.lang.IllegalArgumentException: Failure in creating proxy URL. Proxy port is required! HOT 2
- Is it normal that informer's WebSocket is frequently closed and reopened? HOT 7
- KubernetesMockServer does not implement garbage collection / cascading of deletion based on owner references HOT 9
- Support authentication with certificate in exec-credentials HOT 1
- Upgrade kubernetes-server-mock to okhttp4 mockwebserver to avoid vulnerability warning on old junit transitive dependency HOT 2
- Compile failures since 6.9.1 (io.fabric8.kubernetes.api.builder.Editable not found) HOT 10
- Push Sundrio generated code to the version control system
- Memory Leak in Kubernetes Client HOT 3
- Unable to update lease lock in fabric client with kubernetes version : v1.25.11-eks-a5565ad HOT 10
- Support for OVN networking API (k8s.ovn.org/v1) for Openshift 4.12+ HOT 7
- Add support for x-kubernetes-patch-merge-key and x-kubernetes-patch-strategy
- Upgrade Fabric8 Kubernetes Model to Kubernetes v1.29 HOT 1
- unable to handle pinniped-provided mTLS credentials
- Update base container image for model generators HOT 2
- The v1 Version gateway-api not yet supported HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubernetes-client.