-
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
creatOrReplace() should ignore if identical to last submitted: #2060
Comments
Hi, I may be facing the same issues, having a service with a spec.type=ClusterIP. I can create it, but subsequently it fails with immutable field spec.clusterIP, although the spec is unaltered and does not specify the clusterIP.
Not must else information to provide, other than I use the 4.10.0 version of the kubernetes-client and openshift-client jar. |
@nbn : |
@rohanKanojia I just ran a debug session. My input does not have a |
I remember I fixed an issue similar to this in #1931 . Are you saying client patching |
I can only tell you what I observe. I try to roll the same spec through twice, and the second time it fails. I read a yaml list (Having it as a list) and then simply invoke it with:
The service is simple enough, though
And it is an openshift v3.11.170 |
@nbn : Will try to reproduce |
@chirlo : Your point seems valid to me. Feel free to create a PR to move this discussion forward |
@rohanKanojia Great. Let me know if you need anything from me. I'll be happy to help you. |
Any progress on this? I'm having the same issue applying a YAML file with a PVC defined.
When trying to apply for the second time.
If I take the same file and run Since |
Related to #2292 |
@longwa : Hi, I'm not able to see the same behavior of
When I create if for the first time, it gets created( I checked with fabric8-client SDK too, it gets created):
However, when I try to do
I think we should drop this |
oh, okay. It's |
Hi yes, it’s with apply. My understanding is that the createOrReplace should work like apply. IMO it was more clear with the now deprecated ‘apply’ function as that indicated a direct analog with k8s. |
I think this issue should be closed by #2372 I wrote a test for this case: Lines 180 to 225 in 14cae94
|
I'm closing this, for now. But feel free to reopen in case it's not working as expected. |
Does this issue solved in latest version of kubernetes-client? |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
I've had this problem with a
PersistentVolumeClaim
but it might apply to others. I initallycreateOrReplace
the following resource from a yaml file:which succeeds and everything runs fine. Now If i try it again I right in the following error:
This I understand is normal following a PUT, the issue is that it should haven't been PUT as it is the same resource that already exists.
I tracked the problem down to
kubernetes-client/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java
Line 144 in 22bc59d
The
ResourceCompare.equals
compares the item to be created with the reloaded item, which in this case has been added somespec
entries by the K8s cluster:The
equals
then returns false because of this added entries, and the item is then pushed although it should have been ignored.I've also observed the reloaded item includes a
metadata.annotations
with the last applied configuration in JSON form:Without any knowledge of Kubernetes internals, I'd guess that that JSON string is what needs to be compared in the 'equals' method against the item to be deployed.
This seem to be confirmed here: How apply calculates differences and merges changes
I can try to go for a PR if you think this is the way to go
The text was updated successfully, but these errors were encountered: