kube-rs / controller-rs

A kubernetes reference controller
Apache License 2.0
270 stars 28 forks source link

Status update/patch #26

Closed baum closed 2 years ago

baum commented 2 years ago

Hello Eirik @clux,

Nice to meet you virtually. Thank you so much for this awesome. 🚀 codebase! Started playing with it here, evaluating it as an alternative to the canonical go lang knative source controller implementation.

Issue description

While playing with the control-rs, the latest main revision (1d97d57a2...) I've noticed the Foo resource's status is updated only on the first resource creation. For all subsequent Foo instance creations, the status would not be updated. Tried to debug this issue with additional traces. It appears that status_patch.await does not return the second time, but I could be totally wrong.

Reproduction steps

  1. Install controller

    ➜  controller-rs git:(main) ✗ k create -f yaml/foo-crd.yaml
    customresourcedefinition.apiextensions.k8s.io/foos.clux.dev created
    ➜  controller-rs git:(main) ✗ k create -f yaml/deployment.yaml
    serviceaccount/foo-controller created
    clusterrole.rbac.authorization.k8s.io/control-foos created
    clusterrolebinding.rbac.authorization.k8s.io/foo-controller-binding created
    service/foo-controller created
    deployment.apps/foo-controller created
  2. Create the first Foo instance and check if the status is updated

➜  controller-rs git:(main) ✗ k create -f yaml/instance-bad.yaml
foo.clux.dev/bad created
➜  controller-rs git:(main) ✗ k get foo bad -o yaml | grep is_bad
  is_bad: true
  1. Create a second Foo instance and check if the status is updated
➜  controller-rs git:(main) ✗ k create -f yaml/instance-good.yaml
foo.clux.dev/good created
➜  controller-rs git:(main) ✗ k get foo good -o yaml | grep is_bad
➜  controller-rs git:(main) ✗

Alternative Reproduction steps

For the following scenario same symptoms are observed:

  1. Create the first Foo instance and check if the status is updated
➜  controller-rs git:(main) ✗ k create -f yaml/instance-good.yaml
foo.clux.dev/good created
➜  controller-rs git:(main) ✗ k get foo good -o yaml | grep is_bad
  is_bad: false
  1. Delete the first instance
➜  controller-rs git:(main) ✗ k delete foo good
foo.clux.dev "good" deleted
  1. Recreate the same instance and check if the status is updated
➜  controller-rs git:(main) ✗ k create -f yaml/instance-good.yaml
foo.clux.dev/good created
➜  controller-rs git:(main) ✗ k get foo good -o yaml | grep is_bad
➜  controller-rs git:(main) ✗

Please share your thoughts...

Best regards and stay safe!

clux commented 2 years ago

Ah, thanks for this. You are totally right; you have independently discovered https://github.com/kube-rs/kube-rs/issues/829 which was present in 0.69.0 and we used this repo to reproduce it.

I will bump to 0.69.1 and it should start working again.

clux commented 2 years ago

Ok, have verified once again locally. Sorry for this, forgot to restore this repo to a good state as we rushed out the fix to this rather serious bug and then went to bed :D

Hope the knative experiments go well after this! Please let us know if you have any other problems or if things go well. Would be great to see rust options on the knative side!