Repository navigation
fix(controller): prevent RestartInProgress condition loss due to stal… - #324
Merged
Merged
Conversation
…e cache race When the PodReconciler triggers a restart (RecreateRBGOnPodRestart), the RestartInProgress condition was being permanently lost from the RBG status after the restart completed. This caused e2e test "standalone role with restartPolicy" to time out waiting for RestartInProgress=False. Root cause: a read-modify-write race between two controllers sharing the same RBG status subresource. 1) PodReconciler.setRestartCondition() used the caching client to read the RBG before Status().Update(). If the informer cache had not yet synced the RBG controller's latest status writes (Ready condition, RoleStatuses), the pod controller would overwrite those fields with stale data. 2) RoleBasedGroupReconciler.updateRBGStatus() patches status via SSA with Force=true. It only checked the API reader for RestartInProgress. If the pod controller had not yet committed its write, the condition would be absent from the patch and SSA Force=true would remove it from API. Fixes: - PodReconciler: add apiReader (non-caching) and use it in setRestartCondition to always read the authoritative API state before updating, avoiding informer cache staleness. - updateRBGStatus: check both the cached rbg AND the API reader for RestartInProgress (defense-in-depth), only falling back to the API reader when the cache does not have it. Ancillary reconcile error "workload generation not equal to observed generation" is expected and self-resolving: after the pod controller deletes and recreates a Deployment, the Deployment controller needs time to update ObservedGeneration to match Generation.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…e cache race
When the PodReconciler triggers a restart (RecreateRBGOnPodRestart), the RestartInProgress condition was being permanently lost from the RBG status after the restart completed. This caused e2e test "standalone role with restartPolicy" to time out waiting for RestartInProgress=False.
Root cause: a read-modify-write race between two controllers sharing the same RBG status subresource.
PodReconciler.setRestartCondition() used the caching client to read the
RBG before Status().Update(). If the informer cache had not yet synced
the RBG controller's latest status writes (Ready condition,
RoleStatuses), the pod controller would overwrite those fields with
stale data.
RoleBasedGroupReconciler.updateRBGStatus() patches status via SSA with
Force=true. It only checked the API reader for RestartInProgress. If
the pod controller had not yet committed its write, the condition would
be absent from the patch and SSA Force=true would remove it from API.
Fixes:
Ancillary reconcile error "workload generation not equal to observed generation" is expected and self-resolving: after the pod controller deletes and recreates a Deployment, the Deployment controller needs time to update ObservedGeneration to match Generation.
Ⅰ. Motivation
Ⅱ. Modifications
Ⅲ. Does this pull request fix one issue?
fixes #XXXX
Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Ⅴ. Describe how to verify it
VI. Special notes for reviews
Checklist
make fmt.