feat(recipe): delete all resources belonging to a gvk from a particular namespace#101
feat(recipe): delete all resources belonging to a gvk from a particular namespace#101amitbhatt818 wants to merge 4 commits intomayadata-io:masterfrom amitbhatt818:delete
Conversation
pkg/job/delete_all.go
Outdated
| @@ -0,0 +1,49 @@ | |||
| package job | |||
There was a problem hiding this comment.
@amitbhatt818 One of the first things that I would do is to explain what this PR is all about in the PR body.
It should explain everything to a reviewer to let this reviewer help as much as possible.
Note that a reviewer may be a maintainer or a new contributor to this project. The levels of knowledge & expertise will vary. We should put all effort to explain things in a manner it can be understood by all these personas.
Can you rebase from master?
There was a problem hiding this comment.
Added description in the PR body. And rebased the branch.
pkg/job/delete_all.go
Outdated
|
|
||
| func (r *TaskRunner) deleteAll() (*types.TaskStatus, error) { | ||
| var message = fmt.Sprintf( | ||
| "Delete: Resource %s %s: GVK %s", |
There was a problem hiding this comment.
The message should start as DeleteAll: ...
| "openebs.io/metac/dynamic/clientset" | ||
| ) | ||
|
|
||
| func (r *TaskRunner) deleteAll() (*types.TaskStatus, error) { |
There was a problem hiding this comment.
Do you think this should have a dedicated struct. For example:
type Deleting struct {}
func NewDeleter(config DeletingConfig) *Deleting {}
func (d *Deleting) DeleteAll() {}
func (d *Deleting) Delete() {}
pkg/job/delete_all.go
Outdated
| err = client. | ||
| Namespace(r.Task.DeleteAll.State.GetNamespace()). | ||
| Delete( | ||
| r.Task.DeleteAll.State.GetKind(), |
There was a problem hiding this comment.
Delete does not take kind as an argument. It takes Name.
In this case we should use DeleteAll or DeleteCollection method.
| r.tryRunAssert, | ||
| r.tryRunDelete, | ||
| r.tryRunApply, | ||
| r.tryRunDeleteAll, |
There was a problem hiding this comment.
can you rearrange tryRunDeleteAll just after tryRunDelete
There was a problem hiding this comment.
Resolved this comment
types/job/delete_all.go
Outdated
| "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
| ) | ||
|
|
||
| // DeleteAll deletes the state found in the cluster |
There was a problem hiding this comment.
Changed the comment
| "openebs.io/metac/dynamic/clientset" | ||
| ) | ||
|
|
||
| func (r *TaskRunner) deleteAll() (*types.TaskStatus, error) { |
There was a problem hiding this comment.
Please add Unit Tests for all the changes or additions.
There was a problem hiding this comment.
I will add unit test for these all changes In my coming PR @AmitKumarDas
Signed-off-by: Amit Bhatt <amitbhatt818@gmail.com>
Signed-off-by: Amit Bhatt <amitbhatt818@gmail.com>
Signed-off-by: Amit Bhatt <amitbhatt818@gmail.com>
Signed-off-by: Amit Bhatt <amitbhatt818@gmail.com>
Why We Need This PR?
Some more Information:
Experiment YAML
Result
Signed-off-by: Amit Bhatt amitbhatt818@gmail.com