kubeshop / monokle

Monokle is a set of OSS tools designed to help create and maintain high-quality Kubernetes configurations throughout the application lifecycle
https://monokle.io
MIT License
1.81k stars 133 forks source link

Handling of immutable CRD objects/properties #1223

Open olensmar opened 2 years ago

olensmar commented 2 years ago

Often the schema in a CRD can define objects/properties that are written by an operator/controller and immutable for the user; Monokle should know about these and handle them accordingly, for example:

see #1097 for an example (the property status)

kingdonb commented 2 years ago

I've been apprised that our status.observedGeneration: -1 default in the CRD itself to avoid a kstatus bug is an ugly hack, and one day it will be fixed upstream, so we don't have to do this anymore.

You may want to be aware of this specific issue however, as I basically don't have a problem with the "syntax formatting / populate any missing defaults in the disk manifest" behavior of monokle except with regard to this one field in particular. I'd expect to see this type of workaround being commonly used among operator/CRD projects that implement kstatus

https://github.com/fluxcd/kustomize-controller/issues/387#issuecomment-1023983606

We include one default value in the status to avoid this specific issue with kstatus, it is not a Flux issue in particular, and here's another example from a well-known project that has acknowledged this issue with the same workaround: https://github.com/kubernetes-sigs/cluster-api/pull/3226

I don't think we set any other defaults in status in any of our controllers, and I generally think that this hack should go away. But it's a well-known hack, at least from as far as I can tell.