ansh0014 commented on issue #7002:
URL: https://github.com/apache/camel-k/issues/7002#issuecomment-7299433983
hey @squakez
I checked the code and can confirm this race condition exists:
- `pkg/cmd/deploy.go` uses `ctrl.MergeFrom(existing)` without
`ctrl.MergeFromWithOptimisticLock{}`, so `metadata.resourceVersion` is omitted
from the status merge patch.
- If `kamel rebuild` (`pkg/cmd/rebuild.go`) clears `it.Status` via
`Status().Update` between `deploy`'s `Get` and `Status().Patch`, Kubernetes
applies `phase: Deploying` on top of the wiped status, and `monitorAction`
(`pkg/controller/integration/monitor.go`) gets stuck at the `IntegrationKit ==
nil && Image == ""` check.
Switching `pkg/cmd/deploy.go` to `ctrl.MergeFromWithOptions(existing,
ctrl.MergeFromWithOptimisticLock{})` should ensure a stale `deploy` fails with
a conflict instead of overwriting a concurrent `rebuild`.
@AkhDmitrii If you'd like to work on this, please feel free to go ahead!
Otherwise, if you're not planning to pick it up, I'd love to take it.
@squakez WDYT about this fix? If it looks good to you and @AkhDmitrii isn't
taking it, could you please assign this issue to me?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]