-
Notifications
You must be signed in to change notification settings - Fork 363
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
WRKLDS-593 - reordering the stack unwinding to fix how we execute the backup collection #1273
Conversation
if !runBackCollection { | ||
return | ||
} | ||
o.BackupGathering(context.TODO(), errs) |
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.
Shifting this after the getNamespace
call means that failing getNamespace()
call will bail out of Run
without performing BackupGathering
. But we want BackupGathering
even when we cannot create namespaces. Something like this could cover both:
var ns *corev1.Namespace
var cleanupNamespace func()
// ... ensure resource cleanup unless instructed otherwise ...
if !o.Keep {
defer func() {
if cleanupNamespace != nil {
cleanupNamespace()
}
}()
}
// Due to 'stack unwiding', this should happen after 'clusterState' printing, to ensure that we always
// print our ClusterState information.
runBackCollection := true
defer func() {
if runBackCollection {
o.BackupGathering(context.TODO(), errs, ns) // FIXME: also updating BackupGathering to take a possibly-nil *corev1.Namespace, which gets namespace gathering if it's not nil.
}
}()
// Get or create "working" namespace ...
var err error
ns, cleanupNamespace, err = o.getNamespace()
...
Then we'd have a flow tree like:
- Namespace creation fails
- Pop the deferred gather. Gathers the default stuff, but no temporary namespace.
- Pop the deferred namespace removal. Nothing to remove.
- Namespace creation succeeds
- The main gather still fails, so
runBackCollection
is stilltrue
.- Pop the deferred gather. Gathers the default stuff and also (new with this PR) the temporary namespace.
- Pop the deferred namespace removal. Removes the temporary namespace.
- The main gather succeeds, so runBackCollection
is
false`.- Pop the deferred gather.
runBackCollection
isfalse
, so it's a no-op. - Pop the deferred namespace removal. Removes the temporary namespace.
- Pop the deferred gather.
- The main gather still fails, so
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.
With respect to ordering, I agree with @wking.
We can still run backing up even if the getNamespace
fails and the proposed code snippet above ^ sounds reasonable to me.
However, backing up also must-gather temporary namespace might be handled in separate PR under the light of elaborated decision tree above.
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.
/approve
/assign @ardaguclu
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sferich888, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test e2e-agnostic-cmd |
/retest |
@sferich888: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
@openshift-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
No description provided.