New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: controller should refresh app before running sync operation #6294
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6294 +/- ##
==========================================
- Coverage 41.09% 41.06% -0.04%
==========================================
Files 151 151
Lines 19931 19929 -2
==========================================
- Hits 8190 8183 -7
- Misses 10612 10617 +5
Partials 1129 1129
Continue to review full report at Codecov.
|
abfd17b
to
f22f401
Compare
controller/appcontroller.go
Outdated
if app.Operation != nil { | ||
// If we get here, we are about process an operation but we cannot rely on informer since it might has stale data. | ||
// So always retrieve the latest version to ensure it is not stale to avoid unnecessary syncing. | ||
freshApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.namespace).Get(context.Background(), app.ObjectMeta.Name, metav1.GetOptions{}) | ||
if err != nil { | ||
log.Errorf("Failed to retrieve latest application state: %v", err) | ||
return | ||
} | ||
app = freshApp | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor difference, but I think it might be better to put this at the beginning of processRequestedAppOperation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually nvmd. the other code would benefit from a fresh app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment that this code can be deleted after #6296 is fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
f22f401
to
a3d499e
Compare
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: Alexander Matyushentsev AMatyushentsev@gmail.com
Closes #5592
Closes #1125