Skip to content
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

Merged
merged 1 commit into from May 21, 2021

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented May 21, 2021

Signed-off-by: Alexander Matyushentsev AMatyushentsev@gmail.com

Closes #5592
Closes #1125

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #6294 (a3d499e) into master (0e9823e) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
controller/appcontroller.go 53.05% <0.00%> (-0.10%) ⬇️
util/settings/settings.go 46.34% <0.00%> (-0.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e9823e...a3d499e. Read the comment docs.

@alexmt alexmt force-pushed the 5592-fix-operation-stale-app branch from abfd17b to f22f401 Compare May 21, 2021 19:46
@alexmt alexmt requested a review from jessesuen May 21, 2021 19:46
@alexmt alexmt marked this pull request as ready for review May 21, 2021 19:47
Comment on lines 668 to 679
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
}

Copy link
Member

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Collaborator Author

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>
@alexmt alexmt force-pushed the 5592-fix-operation-stale-app branch from f22f401 to a3d499e Compare May 21, 2021 20:02
@alexmt alexmt merged commit 6966106 into argoproj:master May 21, 2021
@alexmt alexmt deleted the 5592-fix-operation-stale-app branch May 21, 2021 20:32
alexmt pushed a commit that referenced this pull request May 21, 2021
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
@jannfis jannfis added the needs-verification PR requires pre-release verification label Jun 25, 2021
@alexmt alexmt removed the needs-verification PR requires pre-release verification label Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants