-
Notifications
You must be signed in to change notification settings - Fork 297
fix(hooks): always remove finalizers #754
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
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 <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
pkg/sync/helper_test.go
Outdated
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.
@@ -439,7 +457,7 @@ func (sc *syncContext) Sync() { | |||
// No need to perform a dry-run on the namespace creation, because if it fails we stop anyway | |||
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
} 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.
// delete all completed hooks which have appropriate delete policy | ||
sc.deleteHooks(hooksPendingDeletionSuccessful) | ||
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 <[email protected]>
} | ||
} | ||
|
||
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 <[email protected]>
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
@@ -687,40 +793,16 @@ func (sc *syncContext) removeHookFinalizer(task *syncTask) error { | |||
}) | |||
} | |||
|
|||
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 <[email protected]>
Signed-off-by: Alexandre Gaudreault <[email protected]>
|
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
BeforeHookCreation
hooks.Tests