-
Notifications
You must be signed in to change notification settings - Fork 816
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
Support force clean finalizer in networkchaos/netem #415
Conversation
f99dbe5
to
d62b147
Compare
controllers/common/types.go
Outdated
@@ -29,6 +29,13 @@ import ( | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
) | |||
|
|||
const ( | |||
// AnnotationCleanFinalizer key | |||
AnnotationCleanFinalizer = `cleanFinalizer` |
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.
We may need a common prefix for chaos-mesh annotations. @cwen0
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.
LGTM
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.
LGTM
|
||
1. Run `setup.sh` to simulate a condition of unable to clean finalizers. | ||
2. Press `Ctrl + C` to break | ||
3. Run `test.sh` to annotate chaos resource and force cleaning finalizers. |
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.
I suggest demonstrating the detailed operation for force cleanup instead of executing a script. That would be much helpful for users.
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.
I wrote the example as an e2e test, not user oriented feature demonstration.
controllers/common/types.go
Outdated
@@ -29,6 +29,13 @@ import ( | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
) | |||
|
|||
const ( | |||
// AnnotationCleanFinalizer key | |||
AnnotationCleanFinalizer = `chaos-mesh/cleanFinalizer` |
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.
It seems we should define the annotation key prefix for chaos-mesh. What about chaosmesh.pingcap.com/
@zhouqiang-cl @cwen0
} | ||
|
||
networkchaos.Finalizers = utils.RemoveFromFinalizer(networkchaos.Finalizers, key) | ||
} | ||
|
||
return nil | ||
if networkchaos.Annotations[common.AnnotationCleanFinalizer] == common.AnnotationCleanFinalizerForced { | ||
r.Log.Info("Force cleanup all finalizers") |
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.
Please add the target chaos object name/namespace/type in the log.
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.
Done
/run-e2e-test |
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.
LGTM
@Yisaer PTAL |
/merge |
/run-all-tests |
@yujunz merge failed. |
/merge |
/run-all-tests |
@yujunz merge failed. |
/run-e2e-test |
/merge |
/run-all-tests |
@yujunz merge failed. |
I don't know why merge failed after 2 minutes. But all tests are passed. I will merge it now. |
* Support force cleanup in networkchaos * Add example of force clean finalizer * Amend according to review comments Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>
What problem does this PR solve?
#227
What is changed and how does it work?
Force clean finalizer
Check List
Tests
examples/clean-finalizer
)Code changes
Does this PR introduce a user-facing change?: