Remove useless default values for CRD#639
Conversation
|
As @maltesander mentioned in #626, those CRD files are generated. This is something that would need to be changed in kube-derive, which should then trickle down into all our operators. That said, if Argo gets confused by explicitly initializing empty values then that sounds like a bug on their side. |
|
Hi @nightkr , here is some detailed informations: this situation arises due to how Kubernetes handles default values in its API and the implications for tools like Argo CD. When a Kubernetes object is created, the API server automatically applies default values to fields that are not explicitly specified. However, these default values are not stored in etcd, the key-value store backing Kubernetes. Instead, only explicitly set values are retained in etcd. On the other hand, Argo CD performs a comparison between the live state of the resource (as seen in etcd) and the desired state defined by Helm charts. Since the stackable Helm templates for CRDs explicitly include a few fields with their default values, discrepancies arise during the comparison: Helm-generated manifests: These contain explicitly defined default values. This issue is unlikely to be resolved in Argo CD because it would require the tool to know all default values for every Kubernetes object, including CRDs. Handling this would mean Argo CD needs to fetch and interpret OpenAPI schemas for every resource and Kubernetes version, including custom CRDs. That's why I propose to remove the some default values from stackable CRDs, it is a simple and efficient short-term solution. |
|
In addition, I have created a tiny kube-derive poc, do you think it is possible to configure it not to print fields with default values? https://github.com/k8s-school/kube-derive-poc |
Description
Removed default values from CRDs as they were causing issues with synchronization in ArgoCD. When Kubernetes stored the CRDs inside etcd, it stripped fields with default values, which led to ArgoCD being unable to reconcile the changes properly. By eliminating default values, we ensure that the synchronization process in ArgoCD works without issues.
Definition of Done Checklist
Author
Reviewer
Acceptance
Let me know if further refinements are needed!