✨ feat: Accessing old object on `watchEvent`
Overview
By using OldObject input from K8s we will have access to oldObject when modified
What this PR does / why we need it
Closes #515 I need this here: https://github.com/mhkarimi1383/reflector/pull/3
Sometimes we need to have access to older object specially if we are managing our own CRD
Special notes for your reviewer
I don't know if I have updated docs correctly, Also in Delete event we can fill OldObject instead of Object, Since we can Called removed object 'old'
@nabokihms Can you review this?
@mhkarimi1383 yes, sure. I've just put it in the queue.
I will add unit test for that later on, I have not worked with Golang unit tests alot :)
Can you give me a context of how should I test this thing? I mean testing the input and output is good enough or I have to do a more advaced test
@nabokihms Hi, I have fixed linter and unit test error.!
The only left thing is the feature unit tests :)
@nabokihms
Any updates on this? My project development blocked 😕
@nabokihms What is this error?
pkg/kube_events_manager/resource_informer.go:302: File is not `gci`-ed with --skip-generated -s standard,default,prefix(github.com/flant/) (gci)
I fixed the linter, but PR doesn't work because there are other parts missing.
For example, to finally see an old object in a hook, this file requires changes as well https://github.com/flant/shell-operator/blob/main/pkg/hook/binding_context/binding_context.go
And probably this one https://github.com/flant/shell-operator/blob/1d4c4d9320a89fbe348409750631b372671ae958/pkg/hook/controller/kubernetes_bindings_controller.go#L294-L329
One more thing, without adding tests, we will not be able to merge the PR.