- 
                Notifications
    
You must be signed in to change notification settings  - Fork 298
 
fix(hooks): always remove finalizers #754
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
          Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##           master     #754      +/-   ##
==========================================
- Coverage   54.26%   48.32%   -5.95%     
==========================================
  Files          64       64              
  Lines        6164     6639     +475     
==========================================
- Hits         3345     3208     -137     
- Misses       2549     3170     +621     
+ Partials      270      261       -9     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
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.
Move functions importing sync/common to a helper since they cannot be in utils/testing.
sync/common imports utils/kube for a type, utils/kube tests use utils/testing which would use sync/common creating a cycle.
| sc.log.WithValues("task", nsCreateTask).Info("Creating namespace") | ||
| if sc.runTasks(nsSyncTasks, false) == failed { | ||
| sc.setOperationFailed(syncTasks{}, nsSyncTasks, "the namespace failed to apply") | ||
| sc.executeSyncFailPhase(syncTasks{}, nsSyncTasks, "the namespace failed to apply") | 
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.
setOperationFailed was renamed to executeSyncFailPhase
| sc.setResourceResult(task, task.syncStatus, common.OperationError, fmt.Sprintf("failed to get resource health: %v", err)) | ||
| } else { | ||
| sc.setResourceResult(task, "", operationState, message) | ||
| sc.setResourceResult(task, task.syncStatus, operationState, message) | 
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.
Always preserve the current syncStatus in resource results instead of deleting it.
| sc.setOperationPhase(common.OperationSucceeded, "successfully synced (all tasks run)") | ||
| } else { | ||
| sc.setRunningPhase(remainingTasks, false) | ||
| sc.setRunningPhase(tasks, false) | 
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.
fixed the incorrect message. When we are running, we care about the current running task, not the remaining tasks that are still pending.
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
| } | ||
| } | ||
| 
               | 
          ||
| func (sc *syncContext) GetState() (common.OperationPhase, string, []common.ResourceSyncResult) { | 
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.
Moved GetState(), no changes
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
| terminateSuccessful := true | ||
| sc.log.V(1).Info("terminating") | ||
| tasks, _ := sc.getSyncTasks() | ||
| for _, task := range tasks { | 
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.
Part of terminateHooksPreemptively now
| }) | ||
| } | ||
| 
               | 
          ||
| func (sc *syncContext) updateResource(task *syncTask) error { | 
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.
moved
Co-authored-by: Dan Garfield <dan@codefresh.io>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
          
 | 
    
| 
           The gitops-engine repository is migrating to https://github.com/argoproj/argo-cd. Can you please update the PR by resolving the conflicts / If it's not relevant anymore, feel free to close it  | 
    



Closes argoproj/argo-cd#23226
Description
The new finalizer on hooks allow us to observe the hook state before Kubernetes tries to delete it. Multiple issue where found causing the finalizers not to be properly removed on hooks managed by the sync.
Changes
BeforeHookCreationhooks.Tests