-
Notifications
You must be signed in to change notification settings - Fork 523
Delete coreDNS components during vcluster delete op #2956
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
Delete coreDNS components during vcluster delete op #2956
Conversation
pkg/coredns/coredns.go
Outdated
} | ||
|
||
var errs []error | ||
for _, deleteFn := range deleteFuncs { |
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 think we can simplify this, we can just do
err := client.AppsV1().Deployments(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labelSelector})
if err != nil {
errs = append(errs, err)
}
err = client.CoreV1().Pods(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labelSelector})
if err != nil {
errs = append(errs, err)
}
services, err := client.CoreV1().Services(namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector})
if err != nil {
return err
}
if len(services.Items) != 0 {
for _, svc := range services.Items {
err = client.CoreV1().Services(namespace).Delete(ctx, svc.Name, metav1.DeleteOptions{})
if err != nil {
errs = append(errs, err)
}
}
I don't see the reason why we need an array of functions here to iterate over, just makes the code harder to understand.
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.
@FabianKramm Made the suggested changes, please take a look.
a3cdc0a
to
b71f46b
Compare
address review comments
b71f46b
to
4ce4ff7
Compare
* delete coredns components during vcluster delete op * address review comments address review comments
What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix
What does this pull request do? Which issues does it resolve? (use
resolves #<issue_number>
if possible)resolves ENG-7242
Please provide a short message that should be published in the vcluster release notes
Fixed an issue where coreDNS components don't get deleted during vcluster delete operation
What else do we need to know?