Diff sometimes errors out with the message "both left and right were nil for diff"
Race condition where an object is deleted between the time it is LIST-ed versus the time it is GET-ted
@sherman-grewal something easy to start with
I can't seem to reproduce this error, would you happen to have any ideas on how I can reproduce it?
This is what I've done so far (in an attempt to reproduce the error).
- Start with the demo project:
qbec init demo --with-example - Run
qbec apply defaultto create the objects - Add the following code somewhere between the time it is LIST-ed versus the time it is GET-ted when we run
qbec diff default
internal/commands/diff.go:diff()
if ob.GetName() == "demo-deploy" {
cmd := exec.Command("./test.sh")
err := cmd.Run()
if err != nil {
return err
}
}
test.sh
#!/bin/bash
kubectl delete deployments/demo-deploy
- Run
qbec diff default
I thought by deleting the deployment object between the time it is LIST-ed versus the time it is GET-ted would reproduce the issue, but it does not seem to be the case. Let me know if I am missing something!
@gotwarlost
kubectl delete deploy probably doesn't wait for the deployment object to be removed - the pod has to go away first etc. Try sleeping for 30s or smth after running the delete
use kubectl delete deployments/demo-deploy --wait=true in the script. Also remove the demo-deploy deployment from components.